From b31c2ea6010e2f2f4fd57faaea8b48b941db106b Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Mon, 11 Mar 2013 09:28:37 +0100 Subject: [PATCH] JS: Orderbook: Get current state when subscribing. --- src/js/orderbook.js | 4 ++-- src/js/remote.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/orderbook.js b/src/js/orderbook.js index c78674e079..00ac29b23a 100644 --- a/src/js/orderbook.js +++ b/src/js/orderbook.js @@ -32,7 +32,7 @@ var OrderBook = function (remote, if (OrderBook.subscribe_events.indexOf(type) !== -1) { if (!self._subs && 'open' === self._remote._online_state) { self._remote.request_subscribe() - .books([self.to_json()]) + .books([self.to_json()], true) .request(); } self._subs += 1; @@ -54,7 +54,7 @@ var OrderBook = function (remote, this._remote.on('connect', function () { if (self._subs) { self._remote.request_subscribe() - .books([self.to_json()]) + .books([self.to_json()], true) .request(); } }); diff --git a/src/js/remote.js b/src/js/remote.js index 2f99748b2a..fed0252564 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -203,7 +203,7 @@ Request.prototype.rt_accounts = function (accounts) { return this.accounts(accounts, true); }; -Request.prototype.books = function (books) { +Request.prototype.books = function (books, state) { var procBooks = []; for (var i = 0, l = books.length; i < l; i++) { @@ -221,6 +221,8 @@ Request.prototype.books = function (books) { json["IssuerIn"] = UInt160.json_rewrite(book["IssuerIn"]); } + if (state || book["StateNow"]) json["StateNow"] = true; + procBooks.push(json); } this.message.books = procBooks;