fix(web-workers): fix bindings

This commit is contained in:
vsavkin 2015-10-08 16:42:34 -07:00
parent f3ab527688
commit 1100c9b1e3
4 changed files with 32 additions and 15 deletions

View File

@ -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_)
];

View File

@ -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,
];

View File

@ -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),

View File

@ -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: "<h1>WebWorker MessageBroker Test</h1>"})
export class App {
constructor(private _serviceBrokerFactory: ServiceMessageBrokerFactory) {