ellie-idb / blocklandjs

BlocklandJS - a implementation of V8 in Blockland. Bad code included.
2 stars 0 forks source link

Add setTimeout, clearTimeout, setInterval, and clearInterval #21

Closed Elletra closed 6 years ago

Elletra commented 6 years ago

setTimeout returns an ID that can be passed into clearTimeout setInterval returns an ID that can be passed into clearInterval

Also, perhaps consider adding a window object?

ellie-idb commented 6 years ago

Okay, good lord. This has been implemented with the uv.timer class. To use,

var a = new uv.timer();
a.start(500, 123, function(){print('test');}); //500 is the timeout, 123 is the repeat interval.
a.stop(); //To stop.
a.set_repeat(666); //This timer will now repeat every 666 ms..