Documentation ¶
Index ¶
- func Bind[T any](w Window, element string, callback func(Event) T)
- func Clean()
- func Decode(str string) string
- func DeleteAllProfiles()
- func Encode(str string) string
- func Exit()
- func GetArg[T any](e Event) (arg T, err error)
- func GetArgAt[T any](e Event, idx uint) (arg T, err error)
- func SetDefaultRootFolder(path string)
- func SetRootFolder(path string)
- func SetTLSCertificate(certificate_pem string, private_key_pem string)
- func SetTimeout(seconds uint)
- func Wait()
- type Browser
- type Event
- type EventType
- type Runtime
- type ScriptOptions
- type Void
- type Window
- func (w Window) Bind(element string, callback func(Event) any)
- func (w Window) Close()
- func (w Window) DeleteProfile()
- func (w Window) Destroy()
- func (w Window) GetChildProcessID() uint64
- func (w Window) GetParentProcessID() uint64
- func (w Window) GetUrl() string
- func (w Window) IsShown() bool
- func (w Window) Navigate(url string)
- func (w Window) NewWindow()
- func (w Window) Run(script string)
- func (w Window) Script(script string, options ScriptOptions) (resp string, err error)
- func (w Window) SetHide(status bool)
- func (w Window) SetIcon(icon string, icon_type string)
- func (w Window) SetKiosk(enable bool)
- func (w Window) SetPort(port uint) bool
- func (w Window) SetPosition(x uint, y uint)
- func (w Window) SetProfile(name string, path string)
- func (w Window) SetProxy(name string, proxyServer string)
- func (w Window) SetPublic(name string, status bool)
- func (w Window) SetRootFolder(path string)
- func (w Window) SetRuntime(runtime Runtime)
- func (w Window) SetSize(width uint, height uint)
- func (w Window) Show(content string) (err error)
- func (w Window) ShowBrowser(content string, browser Browser) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind binds a specific html element click event with a function. Empty element means all events.
func Clean ¶ added in v2.4.2
func Clean()
Clean frees all memory resources. It should only be called at the end.
func DeleteAllProfiles ¶ added in v2.4.2
func DeleteAllProfiles()
DeleteAllProfiles deletes all local web-browser profile folders. It should only be called at the end.
func GetArgAt ¶ added in v2.4.1
GetArgAt parses the JavaScript argument with the specified index into a Go data type.
func SetDefaultRootFolder ¶ added in v2.4.2
func SetDefaultRootFolder(path string)
SetDefaultRootFolder sets the web-server root folder path for all windows.
func SetRootFolder ¶ added in v2.4.1
func SetRootFolder(path string)
SetRootFolder sets the web-server root folder path for all windows. Deprecated: use SetDefaultRootFolder instead
func SetTLSCertificate ¶ added in v2.4.2
SetTLSCertificate sets the SSL/TLS certificate and the private key content, both in PEM format. This works only with the `webui-2-secure` library. If set to empty, WebUI will generate a self-signed certificate.
func SetTimeout ¶
func SetTimeout(seconds uint)
SetTimeout sets the maximum time in seconds to wait for the browser to start.
Types ¶
type Event ¶
type Event struct { Window Window EventType EventType Element string // contains filtered or unexported fields }
type ScriptOptions ¶ added in v2.4.1
type Window ¶ added in v2.4.1
type Window uint
func NewWindow ¶
func NewWindow() Window
NewWindow creates a new WebUI window object and returns the window number.
func NewWindowId ¶ added in v2.4.1
func NewWindowId() Window
NewWindowId returns a free window number that can be used with `NewWindow`.
func (Window) Bind ¶ added in v2.4.1
Bind binds a specific html element click event with a function. Empty element means all events.
func (Window) Close ¶ added in v2.4.1
func (w Window) Close()
Close closes the window. The window object will still exist.
func (Window) DeleteProfile ¶ added in v2.4.2
func (w Window) DeleteProfile()
DeleteProfile deletes the specified windows local web-browser profile folder.
func (Window) Destroy ¶ added in v2.4.1
func (w Window) Destroy()
Destroy closes the window and free all memory resources.
func (Window) GetChildProcessID ¶ added in v2.4.2
GetParentProcessID returns the ID of the last child process.
func (Window) GetParentProcessID ¶ added in v2.4.2
GetParentProcessID returns the ID of the parent process (The web browser may re-create another new process).
func (Window) NewWindow ¶ added in v2.4.1
func (w Window) NewWindow()
NewWindow creates a new webui window object using a specified window number.
func (Window) Script ¶ added in v2.4.1
func (w Window) Script(script string, options ScriptOptions) (resp string, err error)
Script executes JavaScript and returns the response (Make sure the response buffer can hold the response). The default BufferSize is 8KiB.
func (Window) SetHide ¶ added in v2.4.1
SetHide determines whether the window is run in hidden mode.
func (Window) SetKiosk ¶ added in v2.4.1
SetKiosk determines whether Kiosk mode (full screen) is enabled for the window.
func (Window) SetPort ¶ added in v2.4.2
SetPort sets a custom web-server network port to be used by WebUI.
func (Window) SetPosition ¶ added in v2.4.1
SetPosition sets the window position.
func (Window) SetProfile ¶ added in v2.4.1
SetProfile sets the web browser profile to use. An empty `name` and `path` means the default user profile. Needs to be called before `webui_show()`.
func (Window) SetProxy ¶ added in v2.4.2
SetProxy sets the web browser proxyServer to use. Need to be called before `Show()`.
func (Window) SetPublic ¶ added in v2.4.2
SetPublic allows a specific window address to be accessible from a public network.
func (Window) SetRootFolder ¶ added in v2.4.1
SetRootFolder sets the web-server root folder path for the window.
func (Window) SetRuntime ¶ added in v2.4.1
SetRuntime sets the runtime for .js and .ts files to Deno and Nodejs.