mirror of
https://git.hmsn.ink/kospo/helptalk/api.git
synced 2026-03-20 18:23:32 +09:00
first
This commit is contained in:
15
sample/dev/talk/bundle/popper-2.11.8/esm/utils/debounce.js
Normal file
15
sample/dev/talk/bundle/popper-2.11.8/esm/utils/debounce.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export default function debounce(fn) {
|
||||
var pending;
|
||||
return function () {
|
||||
if (!pending) {
|
||||
pending = new Promise(function (resolve) {
|
||||
Promise.resolve().then(function () {
|
||||
pending = undefined;
|
||||
resolve(fn());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return pending;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user