Skip to content

Commit

Permalink
fix disable
Browse files Browse the repository at this point in the history
  • Loading branch information
roma219 committed Apr 2, 2018
1 parent 1006d46 commit acbb8d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/actions/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const initConnection = ({ commit, getters }, changeNode) => {
if (status === 'error' || status === 'closed') {
commit(types.WS_DISCONNECTED);
active = false;
API.ChainListener.disable();
await API.Connection.disconnect();
initConnection({ commit, getters }, true);
}
Expand Down
6 changes: 3 additions & 3 deletions src/services/api/chain-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class ChainListener {
this._subscribers = [];
this._enabled = false;
}
enable() {
if (this._enabled) this.disable();
async enable() {
if (this._enabled) await this.disable();
Apis.instance().db_api().exec('set_subscribe_callback', [this._mainCallback.bind(this), true]);
this._enabled = true;
}
disable() {
Apis.instance().db_api().exec('cancel_all_subscriptions', []).then(() => {
return Apis.instance().db_api().exec('cancel_all_subscriptions', []).then(() => {
this._enabled = false;
});
}
Expand Down

0 comments on commit acbb8d0

Please sign in to comment.