mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 23:45:51 +00:00
JS: Orderbook: Get current state when subscribing.
This commit is contained in:
@@ -32,7 +32,7 @@ var OrderBook = function (remote,
|
|||||||
if (OrderBook.subscribe_events.indexOf(type) !== -1) {
|
if (OrderBook.subscribe_events.indexOf(type) !== -1) {
|
||||||
if (!self._subs && 'open' === self._remote._online_state) {
|
if (!self._subs && 'open' === self._remote._online_state) {
|
||||||
self._remote.request_subscribe()
|
self._remote.request_subscribe()
|
||||||
.books([self.to_json()])
|
.books([self.to_json()], true)
|
||||||
.request();
|
.request();
|
||||||
}
|
}
|
||||||
self._subs += 1;
|
self._subs += 1;
|
||||||
@@ -54,7 +54,7 @@ var OrderBook = function (remote,
|
|||||||
this._remote.on('connect', function () {
|
this._remote.on('connect', function () {
|
||||||
if (self._subs) {
|
if (self._subs) {
|
||||||
self._remote.request_subscribe()
|
self._remote.request_subscribe()
|
||||||
.books([self.to_json()])
|
.books([self.to_json()], true)
|
||||||
.request();
|
.request();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ Request.prototype.rt_accounts = function (accounts) {
|
|||||||
return this.accounts(accounts, true);
|
return this.accounts(accounts, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
Request.prototype.books = function (books) {
|
Request.prototype.books = function (books, state) {
|
||||||
var procBooks = [];
|
var procBooks = [];
|
||||||
|
|
||||||
for (var i = 0, l = books.length; i < l; i++) {
|
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"]);
|
json["IssuerIn"] = UInt160.json_rewrite(book["IssuerIn"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state || book["StateNow"]) json["StateNow"] = true;
|
||||||
|
|
||||||
procBooks.push(json);
|
procBooks.push(json);
|
||||||
}
|
}
|
||||||
this.message.books = procBooks;
|
this.message.books = procBooks;
|
||||||
|
|||||||
Reference in New Issue
Block a user