mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 13:33:30 +01:00
Clear timeout IDs from array after execution
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -149,6 +149,8 @@ class Client extends EventEmitter {
|
|||||||
this.token = null;
|
this.token = null;
|
||||||
this.email = null;
|
this.email = null;
|
||||||
this.password = null;
|
this.password = null;
|
||||||
|
this._timeouts = [];
|
||||||
|
this._intervals = [];
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
@@ -160,7 +162,11 @@ class Client extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(...params) {
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user