Unsubscribe on true

This commit is contained in:
Jaco Greeff 2016-12-09 18:17:31 +01:00
parent 99846e2ad2
commit 0cbef30508
2 changed files with 4 additions and 4 deletions

View File

@ -317,7 +317,7 @@ export default class Contract {
_sendData (subscriptionId, error, logs) {
const { autoRemove, callback } = this._subscriptions[subscriptionId];
let result = false;
let result = true;
try {
result = callback(error, logs);
@ -325,7 +325,7 @@ export default class Contract {
console.warn('_sendData', subscriptionId, error);
}
if (autoRemove && !result && typeof result === 'boolean') {
if (autoRemove && result && typeof result === 'boolean') {
this.unsubscribe(subscriptionId);
}
}

View File

@ -103,7 +103,7 @@ export default class Manager {
_sendData (subscriptionId, error, data) {
const { autoRemove, callback } = this.subscriptions[subscriptionId];
let result = false;
let result = true;
try {
result = callback(error, data);
@ -111,7 +111,7 @@ export default class Manager {
console.error(`Unable to update callback for subscriptionId ${subscriptionId}`, error);
}
if (autoRemove && !result && typeof result === 'boolean') {
if (autoRemove && result && typeof result === 'boolean') {
this.unsubscribe(subscriptionId);
}
}