Skip to content

Commit

Permalink
nodejs Timer implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
0b1kn00b committed Jun 20, 2013
1 parent 690b868 commit 4aa2353
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/massive/munit/util/Timer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class Timer
#elseif flash
var me = this;
id = untyped _global["setInterval"](function() { me.run(); },time_ms);
#elseif nodejs
var arr :Array<Dynamic> = untyped global.haxe_timers = global.haxe_timers == null ? [] : global.haxe_timers;
var me = this;
me.id = arr.length;
arr[me.id] = me;
#elseif js
id = arr.length;
arr[id] = this;
Expand All @@ -100,6 +105,8 @@ class Timer
untyped __global__["flash.utils.clearInterval"](id);
#elseif flash
untyped _global["clearInterval"](id);
#elseif nodejs
untyped clearInterval(timerId);
#elseif js
untyped window.clearInterval(timerId);
arr[id] = null;
Expand Down

0 comments on commit 4aa2353

Please sign in to comment.