pre-installations and preparations
This commit is contained in:
1 parent
3e5a0329cb
commit
201d621ac3
6977 files changed
+742826
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
// Corresponds to 10 frames at 60 Hz.
|
||||
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
|
||||
export default function debounce(func) {
|
||||
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
|
||||
var timeout;
|
||||
function debounced() {
|
||||
var _this = this;
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
var later = function later() {
|
||||
// @ts-ignore
|
||||
func.apply(_this, args);
|
||||
};
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
}
|
||||
debounced.clear = function () {
|
||||
clearTimeout(timeout);
|
||||
};
|
||||
return debounced;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export { default } from './debounce';
|
||||
export * from './debounce';
|
||||
Reference in new issue
Block a user