main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
302 bytes
|
Line | |
---|
1 | export default function debounce(fn) {
|
---|
2 | var pending;
|
---|
3 | return function () {
|
---|
4 | if (!pending) {
|
---|
5 | pending = new Promise(function (resolve) {
|
---|
6 | Promise.resolve().then(function () {
|
---|
7 | pending = undefined;
|
---|
8 | resolve(fn());
|
---|
9 | });
|
---|
10 | });
|
---|
11 | }
|
---|
12 |
|
---|
13 | return pending;
|
---|
14 | };
|
---|
15 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.