public this.delay(Function callback, Number delay)
function exactly once. A value n > 0 triggers the delayed function exactly n+1 times. A value of -1 triggers the delayed function indefinitely.
The delay method will execute a function after a given amount of time in milliseconds.
It is not a wrapper for setTimeout
.
If Crafty is paused, the delay is interrupted with the pause and then resume when unpaused
If the entity is destroyed, the delay is also destroyed and will not have effect.
console.log("start");
this.delay(function() {
console.log("100ms later");
}, 100, 0);