Skip to content

Commit

Permalink
Merge branch '1.0' into issue/2329
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida authored Feb 10, 2019
2 parents e71f4fa + 80325f6 commit 914f375
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import AbstractSubscription from '../../../lib/subscriptions/AbstractSubscription';
import isFunction from 'lodash/isFunction';

export default class LogSubscription extends AbstractSubscription {
/**
Expand Down Expand Up @@ -56,16 +57,22 @@ export default class LogSubscription extends AbstractSubscription {
logs.forEach((log) => {
const formattedLog = this.onNewSubscriptionItem(log);

callback(false, formattedLog);
if (isFunction(callback)) {
callback(false, formattedLog);
}

this.emit('data', formattedLog);
});

delete this.options.fromBlock;
super.subscribe(callback);
})
.catch((error) => {
if (isFunction(callback)) {
callback(error, null);
}

this.emit('error', error);
callback(error, null);
});

return this;
Expand Down

0 comments on commit 914f375

Please sign in to comment.