-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(RouterInstruction): Pass the subscriber back through NgZone (#70)
- Loading branch information
1 parent
e6a2920
commit 894b088
Showing
4 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NgZone } from 'angular2/core'; | ||
import { Operator } from 'rxjs/Operator'; | ||
import { Subscriber } from 'rxjs/Subscriber'; | ||
|
||
|
||
export class ZoneOperator<T> implements Operator<T, T> { | ||
constructor(private _zone: NgZone) { } | ||
|
||
call(subscriber: Subscriber<T>): Subscriber<T> { | ||
return new ZoneSubscriber(subscriber, this._zone); | ||
} | ||
} | ||
|
||
class ZoneSubscriber<T> extends Subscriber<T> { | ||
constructor(destination: Subscriber<T>, private _zone: NgZone) { | ||
super(destination); | ||
} | ||
|
||
protected _next(value: T) { | ||
this._zone.run(() => this.destination.next(value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters