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