Skip to content

Commit eb5491b

Browse files
committed
Added GetPort method (closes #46)
1 parent 8c18aef commit eb5491b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

v2/lib.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,13 @@ func (w Window) GetChildProcessID() uint64 {
345345
return uint64(C.webui_get_child_process_id(C.size_t(w)))
346346
}
347347

348-
// SetPort sets a custom web-server network port to be used by WebUI.
348+
// GetPort returns the network port of the running window.
349+
func (w Window) GetPort() int {
350+
return int(C.webui_get_port(C.size_t(w)))
351+
}
352+
353+
// SetPort sets a custom web-server network port to be used by WebUI. Returns
354+
// true if the port is free and usable by WebUI.
349355
func (w Window) SetPort(port uint) bool {
350356
return bool(C.webui_set_port(C.size_t(w), C.size_t(port)))
351357
}

0 commit comments

Comments
 (0)