File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ import (
1414 "io"
1515 "log"
1616 "os"
17+ "os/exec"
18+ "runtime"
1719 "strings"
1820
1921 "github.com/disintegration/imaging"
@@ -61,6 +63,24 @@ type Placeholder struct {
6163 Transform string `json:"transform"`
6264}
6365
66+ func (a * App ) OpenBrowser (url string ) {
67+ var err error
68+
69+ switch runtime .GOOS {
70+ case "linux" :
71+ err = exec .Command ("xdg-open" , url ).Start ()
72+ case "windows" :
73+ err = exec .Command ("rundll32" , "url.dll,FileProtocolHandler" , url ).Start ()
74+ case "darwin" :
75+ err = exec .Command ("open" , url ).Start ()
76+ default :
77+ err = fmt .Errorf ("unsupported platform" )
78+ }
79+ if err != nil {
80+ log .Fatal (err )
81+ }
82+ }
83+
6484func (a * App ) Proceed (b64image string , placehldr string , csvData string ) string {
6585 reader := base64 .NewDecoder (base64 .StdEncoding , strings .NewReader (b64image ))
6686 m , _ , err := image .Decode (reader )
Original file line number Diff line number Diff line change 33
44export function Greet ( arg1 :string ) :Promise < string > ;
55
6+ export function OpenBrowser ( arg1 :string ) :Promise < void > ;
7+
68export function Proceed ( arg1 :string , arg2 :string , arg3 :string ) :Promise < string > ;
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ export function Greet(arg1) {
66 return window [ 'go' ] [ 'main' ] [ 'App' ] [ 'Greet' ] ( arg1 ) ;
77}
88
9+ export function OpenBrowser ( arg1 ) {
10+ return window [ 'go' ] [ 'main' ] [ 'App' ] [ 'OpenBrowser' ] ( arg1 ) ;
11+ }
12+
913export function Proceed ( arg1 , arg2 , arg3 ) {
1014 return window [ 'go' ] [ 'main' ] [ 'App' ] [ 'Proceed' ] ( arg1 , arg2 , arg3 ) ;
1115}
You can’t perform that action at this time.
0 commit comments