@@ -39,9 +39,9 @@ pub const WebUIError = error{
3939 ProcessError ,
4040 /// get HWND failed, this is only occur on MS window
4141 HWNDError ,
42- /// get or set windows litening prot failed
42+ /// get or set windows listening prot failed
4343 PortError ,
44- /// run javescript failed
44+ /// run javascript failed
4545 ScriptError ,
4646 /// allocate memory failed
4747 AllocateFailed ,
@@ -53,7 +53,7 @@ pub const WebUIErrorInfo = struct {
5353 msg : [:0 ]const u8 ,
5454};
5555
56- /// through this fhunc , we can get webui's lastest error number and error message
56+ /// through this func , we can get webui's lastest error number and error message
5757pub fn getLastError () WebUIErrorInfo {
5858 return .{
5959 .num = c .webui_get_last_error_number (),
@@ -65,9 +65,8 @@ pub fn getLastError() WebUIErrorInfo {
6565window_handle : usize ,
6666
6767/// Creating a new WebUI window object.
68- pub fn newWindow () ! webui {
68+ pub fn newWindow () webui {
6969 const window_handle = c .webui_new_window ();
70- if (window_handle == 0 ) return WebUIError .CreateWindowError ;
7170
7271 return .{
7372 .window_handle = window_handle ,
@@ -80,7 +79,6 @@ pub fn newWindowWithId(id: usize) !webui {
8079 return WebUIError .CreateWindowError ;
8180 }
8281 const window_handle = c .webui_new_window_id (id );
83- if (window_handle == 0 ) return WebUIError .CreateWindowError ;
8482
8583 return .{
8684 .window_handle = window_handle ,
@@ -89,9 +87,8 @@ pub fn newWindowWithId(id: usize) !webui {
8987
9088/// Get a free window number that can be used with
9189/// `newWindowWithId`
92- pub fn getNewWindowId () ! usize {
90+ pub fn getNewWindowId () usize {
9391 const window_id = c .webui_get_new_window_id ();
94- if (window_id == 0 ) return WebUIError .CreateWindowError ;
9592
9693 return window_id ;
9794}
@@ -664,7 +661,6 @@ pub fn interfaceIsAppRunning() bool {
664661/// Get a unique window ID.
665662pub fn interfaceGetWindowId (self : webui ) usize {
666663 const window_id = c .webui_interface_get_window_id (self .window_handle );
667- if (window_id == 0 ) return WebUIError .CreateWindowError ;
668664 return window_id ;
669665}
670666
@@ -826,7 +822,7 @@ pub fn binding(self: webui, element: [:0]const u8, comptime callback: anytype) !
826822 }
827823 const str_ptr = e .getStringAt (i );
828824 param_tup [i ] = str_ptr ;
829- }else {
825+ } else {
830826 @compileError ("not support []u8" );
831827 }
832828 },
0 commit comments