X Tutup
Skip to content

Commit 2674eac

Browse files
committed
feat(router): Support unsubscription from Location by returning the subscription.
1 parent 8dd3082 commit 2674eac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/angular2/src/mock/location_mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export class SpyLocation implements Location {
4444
}
4545

4646
subscribe(onNext: (value: any) => void, onThrow: (error: any) => void = null,
47-
onReturn: () => void = null) {
48-
ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
47+
onReturn: () => void = null): Object {
48+
return ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
4949
}
5050

5151
// TODO: remove these once Location is an interface, and can be implemented cleanly

modules/angular2/src/router/location.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ export class Location {
144144
* Subscribe to the platform's `popState` events.
145145
*/
146146
subscribe(onNext: (value: any) => void, onThrow: (exception: any) => void = null,
147-
onReturn: () => void = null): void {
148-
ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
147+
onReturn: () => void = null): Object {
148+
return ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
149149
}
150150
}
151151

0 commit comments

Comments
 (0)
X Tutup