remove listeners correctly
This commit is contained in:
parent
1b6ac99ea2
commit
cdfa30ebd2
|
@ -119,14 +119,21 @@ class Test {
|
||||||
if (this.error) {
|
if (this.error) {
|
||||||
return callback(this.error);
|
return callback(this.error);
|
||||||
}
|
}
|
||||||
this.events.once('ready', () => {
|
|
||||||
self.events.removeListener('deployError', () => {});
|
let errorCallback, readyCallback;
|
||||||
callback();
|
|
||||||
});
|
errorCallback = (err) => {
|
||||||
this.events.once('deployError', (err) => {
|
self.events.removeListener('ready', readyCallback);
|
||||||
self.events.removeListener('ready', () => {});
|
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
readyCallback = () => {
|
||||||
|
self.events.removeListener('deployError', errorCallback);
|
||||||
|
callback();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.events.once('ready', readyCallback);
|
||||||
|
this.events.once('deployError', errorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
config(options, callback) {
|
config(options, callback) {
|
||||||
|
|
Loading…
Reference in New Issue