@File: /surebert/functions/fireAfterDelay.js
@Description: This constructor creates an object that fires a function on a timeout. The function can be swicthed out at any point before the delay reaches the fires by resetting the .func property of your instance
var myWaiting= new sb.fireAfterDelay({
func : function(){
alert('hello');
},
seconds : 2
});
@File: /surebert/functions/fireAfterDelay.js
@Description: Stops a sb.delayedFiring object instance from firing if exexuted before the delay has expired.
var myWaiting= new sb.fireAfterDelay({
func : function(){
alert('hello');
},
seconds : 2
});
//if this is executed before the 2 seconds are up, then the dealyed firing is aborted
myWaiting.abort();
@File: /surebert/functions/fireAfterDelay.js
@Description: Fires a function after waiting the specified number of seconds or milliseconds. You can run this on any function if globals are not disabled. If they are you would need to use the call method demostrated below.
//with globals on
function hello(){
alert('hello');
}
//fires the function after 10 seconds
var myEvent = hello.fireAfterDelay({seconds : 10});
//this would abort the event before it ran if executed before the ten seconds were up
myEvent.abort();
//with globals off
sb.functions.fireAfterDelay.call(hello,1);