feat(Collector): return a boolean on checkEnd (#6289)

This commit is contained in:
Rodry
2021-08-05 20:34:17 +01:00
committed by GitHub
parent b4afcf8236
commit f473f43d08
2 changed files with 3 additions and 2 deletions

View File

@@ -207,7 +207,6 @@ class Collector extends EventEmitter {
/**
* Resets the collector's timeout and idle timer.
* @param {CollectorResetTimerOptions} [options] Options for reseting
*/
resetTimer({ time, idle } = {}) {
if (this._timeout) {
@@ -222,10 +221,12 @@ class Collector extends EventEmitter {
/**
* Checks whether the collector should end, and if so, ends it.
* @returns {boolean} Whether the collector ended or not
*/
checkEnd() {
const reason = this.endReason;
if (reason) this.stop(reason);
return Boolean(reason);
}
/**