Version 2.0

This commit is contained in:
Randall
2021-06-12 19:26:05 -04:00
committed by GitHub
parent dea019c42c
commit b8da556091
16 changed files with 3071 additions and 76 deletions

View File

@ -0,0 +1,16 @@
module.exports = class KeyTimeout {
constructor() {
this.timeoutHandleForKey = {};
}
clearTimeout(key) {
clearTimeout(this.timeoutHandleForKey[key]);
}
updateTimeout(key, durationMs, callback) {
this.clearTimeout(key);
this.timeoutHandleForKey[key] = setTimeout(() => {
callback();
}, durationMs);
}
};