All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.deferred.js Maven / Gradle / Ivy

The newest version!
define(function(){

	return function(fn, delay){
	
		//delay in millis
		delay = delay > 0 ? delay : 500;
	
		var args, handle;
	
		return function(){
			args = arguments;
			//reset timeout
			if (handle)
				clearTimeout(handle);
				
			handle = setTimeout(function(){
				fn.apply(undefined, args);
				handle = undefined;
			}, delay);
		};
	
	};

});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy