Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion v2/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,18 @@ func (w Window) GetChildProcessID() uint64 {
return uint64(C.webui_get_child_process_id(C.size_t(w)))
}

// SetPort sets a custom web-server network port to be used by WebUI.
// GetPort returns the network port of the running window. If the window isn't
// running, an error is returned.
func (w Window) GetPort() (int, error) {
port := int(C.webui_get_port(C.size_t(w)))
if port == 0 {
return 0, errors.New("error: failed to get port")
}
return port, nil
}

// SetPort sets a custom web-server network port to be used by WebUI. Returns
// true if the port is free and usable by WebUI.
func (w Window) SetPort(port uint) bool {
return bool(C.webui_set_port(C.size_t(w), C.size_t(port)))
}
Expand Down
Loading