Skip to content

Commit

Permalink
perf(DeferSubscriber): split up 'tryDefer()' into a method to call a …
Browse files Browse the repository at this point in the history
…factory function.
  • Loading branch information
tetsuharuohzeki committed Apr 7, 2016
1 parent d851194 commit 566f46b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/observable/DeferObservable.ts
Expand Up @@ -73,12 +73,16 @@ class DeferSubscriber<T> extends OuterSubscriber<T, T> {

private tryDefer(): void {
try {
const result = this.factory.call(this);
if (result) {
this.add(subscribeToResult(this, result));
}
this._callFactory();
} catch (err) {
this._error(err);
}
}

private _callFactory(): void {
const result = this.factory();
if (result) {
this.add(subscribeToResult(this, result));
}
}
}

0 comments on commit 566f46b

Please sign in to comment.