feat(dom): add location and history as DOM-like APIs.

Instead of global access methods.
This commit is contained in:
Rado Kirov
2015-05-05 14:50:53 -07:00
parent 0520ca68b4
commit f356d03362
6 changed files with 34 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import {global} from 'angular2/src/facade/lang';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
export class Location {
@ -7,9 +7,9 @@ export class Location {
_history;
constructor() {
this._subject = new EventEmitter();
this._location = global.location;
this._history = global.history;
global.addEventListener('popstate', (_) => this._onPopState(_), false);
this._location = DOM.getLocation();
this._history = DOM.getHistory();
DOM.getGlobalEventTarget('window').addEventListener('popstate', (_) => this._onPopState(_), false);
}
_onPopState(_) {