fix(web_workers): remove unnecessary setup module and AppRootUrl

Since AppRootUrl is removed, the logic for extending and emitting
the root url as part of the setup seems unnecessary.

BREAKING CHANGES:

The setupWebWorker function exported from 
angular2/platform/worker_app  no longer returns a promise of providers, 
but instead synchronously returns providers.

Related to #5815
Closes #5820
This commit is contained in:
Jeff Cross
2015-12-10 16:24:46 -08:00
parent ed2c25eb2f
commit a885f37dfa
8 changed files with 6 additions and 72 deletions

View File

@ -2,7 +2,6 @@
* All channels used by angular's WebWorker components are listed here.
* You should not use these channels in your application code.
*/
export const SETUP_CHANNEL = "ng-WebWorkerSetup";
export const RENDERER_CHANNEL = "ng-Renderer";
export const XHR_CHANNEL = "ng-XHR";
export const EVENT_CHANNEL = "ng-events";

View File

@ -1,27 +0,0 @@
import {SETUP_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {AnchorBasedAppRootUrl} from 'angular2/src/compiler/anchor_based_app_root_url';
import {StringWrapper} from 'angular2/src/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.callEmit(sink, {"rootUrl": this.rootUrl});
}
});
}
}