Tobias Bosch 6b5d345a2b refactor(core): adjust imports for move files to the right place
- render/xhr_* -> compiler/xhr_*
- render/event_config -> linker/event_config
- render/dom/schema -> compiler/schema
- render/dom/compiler/* -> compiler/*
- render/dom/view/shared_styles_host -> render/dom/shared_styles_host
2015-10-02 13:38:51 -07:00

28 lines
1003 B
TypeScript

import {SETUP_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {AnchorBasedAppRootUrl} from 'angular2/src/core/compiler/anchor_based_app_root_url';
import {StringWrapper} from 'angular2/src/core/facade/lang';
import {Injectable} from 'angular2/src/core/di';
@Injectable()
export class WebWorkerSetup {
rootUrl: string;
constructor(private _bus: MessageBus, anchorBasedAppRootUrl: AnchorBasedAppRootUrl) {
this.rootUrl = anchorBasedAppRootUrl.value;
}
start(): void {
this._bus.initChannel(SETUP_CHANNEL, false);
var sink = this._bus.to(SETUP_CHANNEL);
var source = this._bus.from(SETUP_CHANNEL);
ObservableWrapper.subscribe(source, (message: string) => {
if (StringWrapper.equals(message, "ready")) {
ObservableWrapper.callNext(sink, {"rootUrl": this.rootUrl});
}
});
}
}