1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-dojo

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
debounce.js 923 Байты
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Mangala SSS Khalsa Отправлено 06.10.2014 05:05 04101da
define([], function(){
// module:
// dojo/debounce
// summary:
// This module provide a debouncer
return function(cb, wait){
// summary:
// Create a function that will only execute after `wait` milliseconds
// description:
// Create a function that will only execute after `wait` milliseconds
// of repeated execution. Useful for delaying some event action slightly to allow
// for rapidly-firing events such as window.resize, node.mousemove and so on.
// cb: Function
// A callback to fire. Like hitch() and partial(), arguments passed to the
// returned function curry along to the original callback.
// wait: Integer
// Time to spend caching executions before actually executing.
var timer;
return function(){
if(timer){
clearTimeout(timer);
}
var self = this;
var a = arguments;
timer = setTimeout(function(){
cb.apply(self, a);
}, wait);
};
};
});

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-dojo.git
git@api.gitlife.ru:oschina-mirror/mirrors-dojo.git
oschina-mirror
mirrors-dojo
mirrors-dojo
master