JS: Orderbook: Get current state when subscribing.

This commit is contained in:
Stefan Thomas
2013-03-11 09:28:37 +01:00
parent 99c2f44cfa
commit b31c2ea601
2 changed files with 5 additions and 3 deletions

View File

@@ -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();
}
});

View File

@@ -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;