fix setTyping and many other timeout/interval based methods

This commit is contained in:
Amish Shah
2016-08-31 19:27:46 +01:00
parent b18aaa8711
commit 892e162229
2 changed files with 8 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -158,15 +158,19 @@ class Client extends EventEmitter {
}
setInterval(...params) {
this._intervals.push(setInterval(...params));
const interval = setInterval(...params);
this._intervals.push(interval);
return interval;
}
setTimeout(...params) {
const restParams = params.slice(1);
this._timeouts.push(setTimeout(() => {
const timeout = setTimeout(() => {
this._timeouts.splice(this._timeouts.indexOf(params[0]), 1);
params[0]();
}, ...restParams));
}, ...restParams);
this._timeouts.push(timeout);
return timeout;
}
/**