This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
electron.go
47 lines (43 loc) · 2.8 KB
/
electron.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package electron
import "github.com/gopherjs/gopherjs/js"
var jsElectron = js.Global.Get("require").Invoke("electron")
func GetApp() App {
return &_App{jsElectron.Get("app")}
}
//It creates a new BrowserWindow with native properties as set by the options
//type BrowserWindowOptions struct {
// Width int //Window's width in pixels. Default is 800
// Height int //Window's height in pixels. Default is 600
// X int //Window's left offset from screen. Default is to center the window.
// Y int //Window's top offset from screen. Default is to center the window.
// UseContentSize bool //The width and height would be used as web page's size, which means the actual window's size will include window frame's size and be slightly larger. Default is false.
// Center bool //Show window in the center of the screen.
// MinWidth int //Window's minimum width. Default is 0.
// MinHeight int //Window's minimum height. Default is 0.
// MaxWidth int //Window's maximum width. Default is no limit.
// MaxHeight int //Window's maximum height. Default is no limit.
// Resizable bool //Whether window is resizable. Default is true.
// AlwaysOnTop bool //Whether the window should always stay on top of other windows. Default is false.
// Fullscreen bool //Whether the window should show in fullscreen. When set to false the fullscreen button will be hidden or disabled on OS X. Default is false.
// SkipTaskbar bool //Whether to show the window in taskbar. Default is false.
// Kiosk bool //The kiosk mode. Default is false.
// Title string //Default window title. Default is "Electron".
// Icon interface{} //The window icon, when omitted on Windows the executable's icon would be used as window icon.
// Show bool //Whether window should be shown when created. Default is true.
// Frame bool //Specify false to create a Frameless Window. Default is true
// AcceptFirstMouse bool
// DisableAutoHideCursor bool
// AutoHideMenuBar bool
// EnableLargerThanScreen bool
// BackgroundColor string `js:"backgroundColor"`
// DarkTheme bool
// Transparent bool
// Type string
// TitleBarStyle string
// WebPreferences interface{}
// NodeIntegration bool
//}
func NewBrowserWindow(opts *map[string]interface{}) BrowserWindow {
var bw = jsElectron.Get("BrowserWindow").New(opts)
return &_BrowserWindow{Object: bw, WebContents: &_WebContents{Object: bw.Get("webContents")}}
}