File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -345,7 +345,18 @@ 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. If the window isn't
349+ // running, an error is returned.
350+ func (w Window ) GetPort () (int , error ) {
351+ port := int (C .webui_get_port (C .size_t (w )))
352+ if port == 0 {
353+ return 0 , errors .New ("error: failed to get port" )
354+ }
355+ return port , nil
356+ }
357+
358+ // SetPort sets a custom web-server network port to be used by WebUI. Returns
359+ // true if the port is free and usable by WebUI.
349360func (w Window ) SetPort (port uint ) bool {
350361 return bool (C .webui_set_port (C .size_t (w ), C .size_t (port )))
351362}
You can’t perform that action at this time.
0 commit comments