Skip to content

Commit

Permalink
fix(common): add PopStateEvent interface (#13400)
Browse files Browse the repository at this point in the history
Closes #13378

PR Close #13400
  • Loading branch information
Dzmitry Shylovich authored and mhevery committed Jan 31, 2017
1 parent f89d004 commit fe44118
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion modules/@angular/common/src/location/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import {EventEmitter, Injectable} from '@angular/core';

import {LocationStrategy} from './location_strategy';

/** @experimental */
export interface PopStateEvent {
pop?: boolean;
type?: string;
url?: string;
}

/**
* @whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
Expand Down Expand Up @@ -122,7 +128,7 @@ export class Location {
* Subscribe to the platform's `popState` events.
*/
subscribe(
onNext: (value: any) => void, onThrow: (exception: any) => void = null,
onNext: (value: PopStateEvent) => void, onThrow: (exception: any) => void = null,
onReturn: () => void = null): Object {
return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn});
}
Expand Down
9 changes: 8 additions & 1 deletion tools/public_api_guard/common/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export declare class Location {
path(includeHash?: boolean): string;
prepareExternalUrl(url: string): string;
replaceState(path: string, query?: string): void;
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): Object;
subscribe(onNext: (value: PopStateEvent) => void, onThrow?: (exception: any) => void, onReturn?: () => void): Object;
static joinWithSlash(start: string, end: string): string;
static normalizeQueryParams(params: string): string;
static stripTrailingSlash(url: string): string;
Expand Down Expand Up @@ -239,6 +239,13 @@ export declare abstract class PlatformLocation {
abstract replaceState(state: any, title: string, url: string): void;
}

/** @experimental */
export interface PopStateEvent {
pop?: boolean;
type?: string;
url?: string;
}

/** @stable */
export declare class SlicePipe implements PipeTransform {
transform(value: any, start: number, end?: number): any;
Expand Down

1 comment on commit fe44118

@mhevery
Copy link
Contributor

@mhevery mhevery commented on fe44118 Feb 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caretaker:

  • do not merge into 2.4.x

Please sign in to comment.