mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Check listeners length before removeAllListeners, fixing possible WebPack EventEmitter bug
This commit is contained in:
@@ -186,8 +186,10 @@ OrderBook.prototype.unsubscribe = function() {
|
||||
this._shouldSubscribe = false;
|
||||
|
||||
OrderBook.EVENTS.forEach(function(event) {
|
||||
this.removeAllListeners(event);
|
||||
}, this);
|
||||
if (self.listeners(event).length > 0) {
|
||||
self.removeAllListeners(event);
|
||||
}
|
||||
});
|
||||
|
||||
this.emit('unsubscribe');
|
||||
};
|
||||
@@ -366,6 +368,10 @@ OrderBook.prototype.setFundedAmount = function(offer, fundedAmount) {
|
||||
return offer;
|
||||
}
|
||||
|
||||
function sixFigures(str) {
|
||||
return str.substring(0, str.indexOf('.') + 7);
|
||||
};
|
||||
|
||||
var takerGetsValue = (typeof offer.TakerGets === 'object')
|
||||
? offer.TakerGets.value
|
||||
: offer.TakerGets;
|
||||
|
||||
Reference in New Issue
Block a user