File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1919const std = @import ("std" );
2020
2121const parser = @import ("netsurf" );
22+ const jsruntime = @import ("jsruntime" );
23+ const Callback = jsruntime .Callback ;
24+ const CallbackArg = jsruntime .CallbackArg ;
25+ const Loop = jsruntime .Loop ;
2226
2327const EventTarget = @import ("../dom/event_target.zig" ).EventTarget ;
2428
@@ -82,4 +86,16 @@ pub const Window = struct {
8286 if (self .storageShelf == null ) return parser .DOMError .NotSupported ;
8387 return & self .storageShelf .? .bucket .session ;
8488 }
89+
90+ // TODO handle callback arguments.
91+ pub fn _setTimeout (_ : * Window , loop : * Loop , cbk : Callback , delay : ? u32 ) ! u32 {
92+ const ddelay : u63 = delay orelse 0 ;
93+ loop .timeout (ddelay * std .time .ns_per_ms , cbk );
94+ // TODO handle timeout ID
95+ return 1 ;
96+ }
97+
98+ pub fn _clearTimeout (_ : * Window , _ : * Loop , id : u32 ) ! void {
99+ _ = id ;
100+ }
85101};
You can’t perform that action at this time.
0 commit comments