debounce.js
1.26 KB
// github: https://github.com/component/debounce
// update: https://wzrd.in/standalone/debounce@latest
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.debounce=e()}}(function(){return function e(n,t,o){function r(f,i){if(!t[f]){if(!n[f]){var l="function"==typeof require&&require;if(!i&&l)return l(f,!0);if(u)return u(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var c=t[f]={exports:{}};n[f][0].call(c.exports,function(e){var t=n[f][1][e];return r(t?t:e)},c,c.exports,e,n,t,o)}return t[f].exports}for(var u="function"==typeof require&&require,f=0;f<o.length;f++)r(o[f]);return r}({1:[function(e,n,t){n.exports=function(e,n,t){function o(){var a=Date.now()-i;a<n&&a>=0?r=setTimeout(o,n-a):(r=null,t||(l=e.apply(f,u),f=u=null))}var r,u,f,i,l;null==n&&(n=100);var a=function(){f=this,u=arguments,i=Date.now();var a=t&&!r;return r||(r=setTimeout(o,n)),a&&(l=e.apply(f,u),f=u=null),l};return a.clear=function(){r&&(clearTimeout(r),r=null)},a.flush=function(){r&&(l=e.apply(f,u),f=u=null,clearTimeout(r),r=null)},a}},{}]},{},[1])(1)});