From 3b636ce2d184d1462919427ae08f64dcffb4b5f7 Mon Sep 17 00:00:00 2001 From: Ivan Tivonenko Date: Wed, 10 Jun 2015 18:09:13 +0300 Subject: [PATCH] [FIX] emit empty offers list (RT-3462) For autobridged order books, emit 'model' event, even if offers is empty, to indicate that orderbook is loaded --- src/core/orderbook.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/orderbook.js b/src/core/orderbook.js index b71a3b8a..400318e8 100644 --- a/src/core/orderbook.js +++ b/src/core/orderbook.js @@ -255,7 +255,7 @@ OrderBook.prototype.unsubscribe = function() { * @param {Function} callback */ -OrderBook.prototype.requestOffers = function(callback) { +OrderBook.prototype.requestOffers = function(callback=function() {}) { const self = this; if (!this._shouldSubscribe) { @@ -1207,6 +1207,8 @@ OrderBook.prototype.mergeDirectAndAutobridgedBooks = function() { const self = this; if (_.isEmpty(this._offers) && _.isEmpty(this._offersAutobridged)) { + // still emit empty offers list to indicate that load is completed + this.emit('model', []); return; }