haxeneko

Neko and haxe.Timer.delayed()


As every Haxe developer knows, you could use haxe.Timer.delayed() to delay function call for some time. But this function doesn't exist for Neko at all. Is there a way to achieve the same results?


Solution

  • Have to check it first but

    function delayed(f, time) {
       neko.vm.Thread.create(function() {
           neko.Sys.sleep(time);
           f();
       });
    }
    

    might be the closest thing possible. The only cons is that application becomes multi threaded which could lead to serious problems.