mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 05:52:05 +00:00
Clear timeout IDs from array after execution
This commit is contained in:
parent
680ac48e3d
commit
4f41a86dd3
2 changed files with 8 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
|
@ -149,6 +149,8 @@ class Client extends EventEmitter {
|
|||
this.token = null;
|
||||
this.email = null;
|
||||
this.password = null;
|
||||
this._timeouts = [];
|
||||
this._intervals = [];
|
||||
resolve();
|
||||
})
|
||||
.catch(reject);
|
||||
|
|
@ -160,7 +162,11 @@ class Client extends EventEmitter {
|
|||
}
|
||||
|
||||
setTimeout(...params) {
|
||||
this._timeouts.push(setTimeout(...params));
|
||||
const restParams = params.slice(1);
|
||||
this._timeouts.push(setTimeout(() => {
|
||||
this._timeouts.splice(this._timeouts.indexOf(params[0]), 1);
|
||||
params[0]();
|
||||
}, ...restParams));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue