From 1100c9b1e380e88568043845dbe970d1abdc5483 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Thu, 8 Oct 2015 16:42:34 -0700 Subject: [PATCH] fix(web-workers): fix bindings --- modules/angular2/http.ts | 4 +-- .../src/web_workers/ui/di_bindings.ts | 29 ++++++++++++------- .../web_workers/worker/application_common.ts | 12 ++++++-- .../message_broker/index_common.ts | 2 +- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/modules/angular2/http.ts b/modules/angular2/http.ts index 81212f5be9..4942a0c6aa 100644 --- a/modules/angular2/http.ts +++ b/modules/angular2/http.ts @@ -7,7 +7,7 @@ import {bind, Binding} from 'angular2/core'; import {Http, Jsonp} from './src/http/http'; import {XHRBackend, XHRConnection} from './src/http/backends/xhr_backend'; -import {JSONPBackend, JSONPConnection} from './src/http/backends/jsonp_backend'; +import {JSONPBackend, JSONPBackend_, JSONPConnection} from './src/http/backends/jsonp_backend'; import {BrowserXhr} from './src/http/backends/browser_xhr'; import {BrowserJsonp} from './src/http/backends/browser_jsonp'; import {BaseRequestOptions, RequestOptions} from './src/http/base_request_options'; @@ -278,5 +278,5 @@ export const JSONP_BINDINGS: any[] = [ BrowserJsonp, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), - JSONPBackend + bind(JSONPBackend).toClass(JSONPBackend_) ]; diff --git a/modules/angular2/src/web_workers/ui/di_bindings.ts b/modules/angular2/src/web_workers/ui/di_bindings.ts index 4a5584bc55..d8e80b5c68 100644 --- a/modules/angular2/src/web_workers/ui/di_bindings.ts +++ b/modules/angular2/src/web_workers/ui/di_bindings.ts @@ -18,7 +18,7 @@ import {HammerGesturesPlugin} from 'angular2/src/core/render/dom/events/hammer_g import {AppViewPool, APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool'; import {Renderer} from 'angular2/src/core/render/api'; import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url'; -import {DomRenderer, DOCUMENT} from 'angular2/src/core/render/render'; +import {DomRenderer, DomRenderer_, DOCUMENT} from 'angular2/src/core/render/render'; import {APP_ID_RANDOM_BINDING} from 'angular2/src/core/application_tokens'; import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry'; import { @@ -30,13 +30,16 @@ import { } from 'angular2/src/core/render/dom/shared_styles_host'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; -import {AppViewManager} from 'angular2/src/core/linker/view_manager'; +import {AppViewManager, AppViewManager_} from 'angular2/src/core/linker/view_manager'; import {AppViewManagerUtils} from 'angular2/src/core/linker/view_manager_utils'; import {AppViewListener} from 'angular2/src/core/linker/view_listener'; import {ViewResolver} from 'angular2/src/core/linker/view_resolver'; import {DirectiveResolver} from 'angular2/src/core/linker/directive_resolver'; import {ExceptionHandler} from 'angular2/src/core/facade/exceptions'; -import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; +import { + DynamicComponentLoader, + DynamicComponentLoader_ +} from 'angular2/src/core/linker/dynamic_component_loader'; import {UrlResolver} from 'angular2/src/core/compiler/url_resolver'; import {Testability} from 'angular2/src/core/testability/testability'; import {XHR} from 'angular2/src/core/compiler/xhr'; @@ -53,8 +56,14 @@ import {MessageBus} from 'angular2/src/web_workers/shared/message_bus'; import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer'; import {MessageBasedXHRImpl} from 'angular2/src/web_workers/ui/xhr_impl'; import {WebWorkerSetup} from 'angular2/src/web_workers/ui/setup'; -import {ServiceMessageBrokerFactory} from 'angular2/src/web_workers/shared/service_message_broker'; -import {ClientMessageBrokerFactory} from 'angular2/src/web_workers/shared/client_message_broker'; +import { + ServiceMessageBrokerFactory, + ServiceMessageBrokerFactory_ +} from 'angular2/src/web_workers/shared/service_message_broker'; +import { + ClientMessageBrokerFactory, + ClientMessageBrokerFactory_ +} from 'angular2/src/web_workers/shared/client_message_broker'; var _rootInjector: Injector; @@ -71,7 +80,7 @@ function _injectorBindings(): any[] { new Binding(EVENT_MANAGER_PLUGINS, {toClass: DomEventsPlugin, multi: true}), new Binding(EVENT_MANAGER_PLUGINS, {toClass: KeyEventsPlugin, multi: true}), new Binding(EVENT_MANAGER_PLUGINS, {toClass: HammerGesturesPlugin, multi: true}), - DomRenderer, + bind(DomRenderer).toClass(DomRenderer_), bind(Renderer).toAlias(DomRenderer), APP_ID_RANDOM_BINDING, DomSharedStylesHost, @@ -83,7 +92,7 @@ function _injectorBindings(): any[] { RenderProtoViewRefStore, AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), - AppViewManager, + bind(AppViewManager).toClass(AppViewManager_), AppViewManagerUtils, AppViewListener, ProtoViewFactory, @@ -95,7 +104,7 @@ function _injectorBindings(): any[] { bind(ExceptionHandler).toFactory(() => new ExceptionHandler(DOM), []), bind(XHR).toValue(new XHRImpl()), UrlResolver, - DynamicComponentLoader, + bind(DynamicComponentLoader).toClass(DynamicComponentLoader_), Testability, AnchorBasedAppRootUrl, bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl), @@ -103,8 +112,8 @@ function _injectorBindings(): any[] { WebWorkerSetup, MessageBasedXHRImpl, MessageBasedRenderer, - ServiceMessageBrokerFactory, - ClientMessageBrokerFactory, + bind(ServiceMessageBrokerFactory).toClass(ServiceMessageBrokerFactory_), + bind(ClientMessageBrokerFactory).toClass(ClientMessageBrokerFactory_), BrowserDetails, AnimationBuilder, ]; diff --git a/modules/angular2/src/web_workers/worker/application_common.ts b/modules/angular2/src/web_workers/worker/application_common.ts index 4e2bfc9ab8..dccb44b514 100644 --- a/modules/angular2/src/web_workers/worker/application_common.ts +++ b/modules/angular2/src/web_workers/worker/application_common.ts @@ -16,7 +16,14 @@ import {WebWorkerXHRImpl} from 'angular2/src/web_workers/worker/xhr_impl'; import {AppRootUrl} from 'angular2/src/core/compiler/app_root_url'; import {WebWorkerRenderer} from './renderer'; import {Renderer} from 'angular2/src/core/render/api'; -import {ClientMessageBrokerFactory} from 'angular2/src/web_workers/shared/client_message_broker'; +import { + ClientMessageBrokerFactory, + ClientMessageBrokerFactory_ +} from 'angular2/src/web_workers/shared/client_message_broker'; +import { + ServiceMessageBrokerFactory, + ServiceMessageBrokerFactory_ +} from 'angular2/src/web_workers/shared/service_message_broker'; import {MessageBus} from 'angular2/src/web_workers/shared/message_bus'; import { platformCommon, @@ -90,7 +97,8 @@ function webWorkerBindings(appComponentType, bus: MessageBus, initData: {[key: s compilerBindings(), Serializer, bind(MessageBus).toValue(bus), - ClientMessageBrokerFactory, + bind(ClientMessageBrokerFactory).toClass(ClientMessageBrokerFactory_), + bind(ServiceMessageBrokerFactory).toClass(ServiceMessageBrokerFactory_), WebWorkerRenderer, bind(Renderer).toAlias(WebWorkerRenderer), bind(ON_WEB_WORKER).toValue(true), diff --git a/modules/examples/src/web_workers/message_broker/index_common.ts b/modules/examples/src/web_workers/message_broker/index_common.ts index 193a323a94..174f474d44 100644 --- a/modules/examples/src/web_workers/message_broker/index_common.ts +++ b/modules/examples/src/web_workers/message_broker/index_common.ts @@ -3,7 +3,7 @@ import {Component, View, ServiceMessageBrokerFactory, PRIMITIVE} from "angular2/ const ECHO_CHANNEL = "ECHO"; -@Component({selector: 'app', viewBindings: [ServiceMessageBrokerFactory]}) +@Component({selector: 'app'}) @View({template: "

WebWorker MessageBroker Test

"}) export class App { constructor(private _serviceBrokerFactory: ServiceMessageBrokerFactory) {