@ -5,7 +5,8 @@ import 'dart:async';
|
||||
import 'dart:core';
|
||||
import 'package:angular2/src/web_workers/shared/message_bus.dart'
|
||||
show MessageBus;
|
||||
import 'package:angular2/src/web_workers/ui/impl.dart' show bootstrapUICommon, WebWorkerApplication;
|
||||
import 'package:angular2/src/web_workers/ui/impl.dart'
|
||||
show bootstrapUICommon, WebWorkerApplication;
|
||||
import 'package:angular2/src/web_workers/shared/isolate_message_bus.dart';
|
||||
|
||||
/**
|
||||
@ -37,7 +38,7 @@ Future<IsolateInstance> spawnWebWorker(Uri uri) async {
|
||||
class UIMessageBusSource extends IsolateMessageBusSource {
|
||||
UIMessageBusSource(ReceivePort port) : super(port);
|
||||
|
||||
Future<SendPort> get sink => rawDataStream.firstWhere((message) {
|
||||
Future<SendPort> get sink => stream.firstWhere((message) {
|
||||
return message is SendPort;
|
||||
});
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ export function bootstrapUICommon(bus: MessageBus): WebWorkerApplication {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
var zone = createNgZone();
|
||||
wtfInit();
|
||||
bus.attachToZone(zone);
|
||||
return zone.run(() => {
|
||||
var injector = createInjector(zone, bus);
|
||||
injector.get(MessageBasedRenderCompiler).start();
|
||||
@ -47,11 +48,11 @@ export class WebWorkerApplication {
|
||||
constructor(private _clientMessageBrokerFactory: ClientMessageBrokerFactory,
|
||||
private _serviceMessageBrokerFactory: ServiceMessageBrokerFactory) {}
|
||||
|
||||
createClientMessageBroker(channel: string): ClientMessageBroker {
|
||||
return this._clientMessageBrokerFactory.createMessageBroker(channel);
|
||||
createClientMessageBroker(channel: string, runInZone: boolean = true): ClientMessageBroker {
|
||||
return this._clientMessageBrokerFactory.createMessageBroker(channel, runInZone);
|
||||
}
|
||||
|
||||
createServiceMessageBroker(channel: string): ServiceMessageBroker {
|
||||
return this._serviceMessageBrokerFactory.createMessageBroker(channel);
|
||||
createServiceMessageBroker(channel: string, runInZone: boolean = true): ServiceMessageBroker {
|
||||
return this._serviceMessageBrokerFactory.createMessageBroker(channel, runInZone);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export class MessageBasedRenderCompiler {
|
||||
private _renderCompiler: RenderCompiler) {}
|
||||
|
||||
start(): void {
|
||||
var broker = this._brokerFactory.createMessageBroker(RENDER_COMPILER_CHANNEL);
|
||||
var broker = this._brokerFactory.createMessageBroker(RENDER_COMPILER_CHANNEL, false);
|
||||
broker.registerMethod("compileHost", [RenderDirectiveMetadata],
|
||||
bind(this._renderCompiler.compileHost, this._renderCompiler),
|
||||
ProtoViewDto);
|
||||
|
@ -26,6 +26,7 @@ export class MessageBasedRenderer {
|
||||
|
||||
start(): void {
|
||||
var broker = this._brokerFactory.createMessageBroker(RENDERER_CHANNEL);
|
||||
this._bus.initChannel(EVENT_CHANNEL);
|
||||
broker.registerMethod("createRootHostView",
|
||||
[RenderProtoViewRef, PRIMITIVE, PRIMITIVE, PRIMITIVE],
|
||||
bind(this._createRootHostView, this));
|
||||
|
@ -14,6 +14,7 @@ export class WebWorkerSetup {
|
||||
}
|
||||
|
||||
start(): void {
|
||||
this._bus.initChannel(SETUP_CHANNEL, false);
|
||||
var sink = this._bus.to(SETUP_CHANNEL);
|
||||
var source = this._bus.from(SETUP_CHANNEL);
|
||||
|
||||
|
Reference in New Issue
Block a user