refactor(common): rename UrlChangeEvent and UrlChangeListener to LocationChangeEvent and LocationChangeListener
These apis are not expected to be used anyone, hence I'm not documenting this change as a breaking.
This commit is contained in:

committed by
Victor Berchet

parent
8a2324f86a
commit
1f5a5895e5
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {PlatformLocation, UrlChangeListener} from '@angular/common';
|
||||
import {LocationChangeListener, PlatformLocation} from '@angular/common';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
@ -45,11 +45,11 @@ export class BrowserPlatformLocation extends PlatformLocation {
|
||||
|
||||
getBaseHrefFromDOM(): string { return getDOM().getBaseHref(); }
|
||||
|
||||
onPopState(fn: UrlChangeListener): void {
|
||||
onPopState(fn: LocationChangeListener): void {
|
||||
getDOM().getGlobalEventTarget('window').addEventListener('popstate', fn, false);
|
||||
}
|
||||
|
||||
onHashChange(fn: UrlChangeListener): void {
|
||||
onHashChange(fn: LocationChangeListener): void {
|
||||
getDOM().getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {UrlChangeListener} from '@angular/common';
|
||||
import {LocationChangeListener} from '@angular/common';
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {BrowserPlatformLocation} from '../../browser/location/browser_platform_location';
|
||||
@ -28,9 +28,9 @@ export class MessageBasedPlatformLocation {
|
||||
private _platformLocation: BrowserPlatformLocation, bus: MessageBus,
|
||||
private _serializer: Serializer) {
|
||||
this._platformLocation.onPopState(
|
||||
<UrlChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
|
||||
<LocationChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
|
||||
this._platformLocation.onHashChange(
|
||||
<UrlChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
|
||||
<LocationChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
|
||||
this._broker = this._brokerFactory.createMessageBroker(ROUTER_CHANNEL);
|
||||
this._channelSink = bus.to(ROUTER_CHANNEL);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {PlatformLocation, UrlChangeListener} from '@angular/common';
|
||||
import {LocationChangeListener, PlatformLocation} from '@angular/common';
|
||||
import {BaseException, Injectable} from '@angular/core';
|
||||
|
||||
import {EventEmitter} from '../../facade/async';
|
||||
@ -75,9 +75,9 @@ export class WebWorkerPlatformLocation extends PlatformLocation {
|
||||
'Attempt to get base href from DOM from WebWorker. You must either provide a value for the APP_BASE_HREF token through DI or use the hash location strategy.');
|
||||
}
|
||||
|
||||
onPopState(fn: UrlChangeListener): void { this._popStateListeners.push(fn); }
|
||||
onPopState(fn: LocationChangeListener): void { this._popStateListeners.push(fn); }
|
||||
|
||||
onHashChange(fn: UrlChangeListener): void { this._hashChangeListeners.push(fn); }
|
||||
onHashChange(fn: LocationChangeListener): void { this._hashChangeListeners.push(fn); }
|
||||
|
||||
get pathname(): string {
|
||||
if (this._location === null) {
|
||||
|
Reference in New Issue
Block a user