fix(WebWorker): remove the platform-browser dependency on compiler

This commit is contained in:
Victor Berchet 2016-05-13 13:22:29 -07:00
parent a01a54c180
commit 6e62217b78
92 changed files with 1331 additions and 496 deletions

View File

@ -22,7 +22,7 @@ ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/base64-js/lib/b64.js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs/bundles/Rx.js .
ln -s ../../../../node_modules/rxjs .
ln -s ../../../../node_modules/angular/angular.js .
cd -

View File

@ -30,14 +30,14 @@ describe("template codegen output", () => {
it("should be able to create the basic component", () => {
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_STATIC_PROVIDERS,
browserPlatform().injector);
browserPlatform().injector);
var comp = BasicNgFactory.create(appInjector);
expect(comp.instance).toBeTruthy();
});
it("should support ngIf", () => {
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_STATIC_PROVIDERS,
browserPlatform().injector);
browserPlatform().injector);
var comp = BasicNgFactory.create(appInjector);
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
expect(debugElement.children.length).toBe(2);
@ -50,7 +50,7 @@ describe("template codegen output", () => {
it("should support ngFor", () => {
const appInjector = ReflectiveInjector.resolveAndCreate(BROWSER_APP_STATIC_PROVIDERS,
browserPlatform().injector);
browserPlatform().injector);
var comp = BasicNgFactory.create(appInjector);
var debugElement = <DebugElement>getDebugNode(comp.location.nativeElement);
expect(debugElement.children.length).toBe(2);

View File

@ -1,5 +1,5 @@
import {Type, isBlank, isPresent, assertionsEnabled} from '../src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from './di';
import {Type} from '../src/facade/lang';
import {Provider} from './di';
import {Console} from './console';
import {Reflector, reflector} from './reflection/reflection';
import {ReflectorReader} from './reflection/reflector_reader';

View File

@ -252,6 +252,10 @@ class FunctionWrapper {
static apply(Function fn, posArgs) {
return Function.apply(fn, posArgs);
}
static Function bind(Function fn, dynamic scope) {
return fn;
}
}
const _NAN_KEY = const Object();

View File

@ -379,6 +379,8 @@ export class RegExpMatcherWrapper {
export class FunctionWrapper {
static apply(fn: Function, posArgs: any): any { return fn.apply(null, posArgs); }
static bind(fn: Function, scope: any): Function { return fn.bind(scope); }
}
// JS has NaN !== NaN

View File

@ -373,12 +373,12 @@ var PLATFORM_BROWSER: string[] = [
'DOCUMENT',
'ELEMENT_PROBE_PROVIDERS',
'DomEventsPlugin',
'KeyEventsPlugin',
'EVENT_MANAGER_PLUGINS',
'EventManager',
'HAMMER_GESTURE_CONFIG',
'HammerGestureConfig',
'bootstrapStatic',
'browserStaticPlatform',
'browserPlatform',
'BrowserPlatformLocation',
'AngularEntrypoint:dart',
@ -387,7 +387,32 @@ var PLATFORM_BROWSER: string[] = [
'SecurityContext',
'Title',
'disableDebugTools',
'enableDebugTools'
'enableDebugTools',
'ClientMessageBroker',
'ClientMessageBrokerFactory',
'FnArg',
'MessageBus',
'PRIMITIVE',
'ReceivedMessage',
'ServiceMessageBroker',
'ServiceMessageBrokerFactory',
'UiArguments',
'WORKER_APP_APPLICATION_COMMON_PROVIDERS',
'WORKER_APP_APPLICATION_PROVIDERS',
'WORKER_APP_PLATFORM_PROVIDERS',
'WORKER_RENDER_APPLICATION_COMMON_PROVIDERS',
'WORKER_RENDER_APPLICATION_PROVIDERS',
'WORKER_RENDER_PLATFORM_PROVIDERS',
'WORKER_RENDER_STARTABLE_MESSAGING_SERVICE',
'WORKER_SCRIPT',
'WORKER_APP_LOCATION_PROVIDERS',
'WORKER_RENDER_LOCATION_PROVIDERS',
'workerAppPlatform',
'workerRenderPlatform',
'WebWorkerInstance',
'bootstrapStaticApp',
'bootstrapStaticRender',
'initializeGenericWorkerRenderer'
];
var PLATFORM_BROWSER_TESTING: string[] = [
@ -395,8 +420,6 @@ var PLATFORM_BROWSER_TESTING: string[] = [
'TEST_BROWSER_STATIC_PLATFORM_PROVIDERS',
'ADDITIONAL_TEST_BROWSER_PROVIDERS', // This should be made private
'BrowserDetection',
'DOMTestComponentRenderer',
'TestComponentRenderer',
'browserDetection',
'dispatchEvent',
'el',
@ -410,11 +433,19 @@ var PLATFORM_BROWSER_DYNAMIC: string[] = [
'CACHED_TEMPLATE_PROVIDER',
'bootstrap',
'UrlChangeEvent:dart',
'UrlChangeListener:dart'
'UrlChangeListener:dart',
'WORKER_APP_DYNAMIC_APPLICATION_PROVIDERS',
'WORKER_RENDER_DYNAMIC_APPLICATION_PROVIDERS',
'bootstrapApp',
'bootstrapRender'
];
var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] =
['TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS', 'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS'];
var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] = [
'TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS',
'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS',
'ADDITIONAL_DYNAMIC_TEST_BROWSER_PROVIDERS',
'DOMTestComponentRenderer'
];
var PLATFORM_SERVER: string[] = ['Parse5DomAdapter'];

View File

@ -1 +1,4 @@
export * from './platform_browser_dynamic';
export * from './src/platform_browser_dynamic';
export * from './src/worker_render';
export * from './src/worker_app';

View File

@ -1,4 +1,7 @@
import {__platform_browser_private__ as _} from '@angular/platform-browser';
export type DomAdapter = _.DomAdapter;
export function getDOM(): _.DomAdapter{return _.getDOM()};
export function getDOM(): _.DomAdapter {
return _.getDOM()
}

View File

@ -1,12 +1,20 @@
import {
reflector,
ReflectiveInjector,
coreLoadAndBootstrap,
Type,
ComponentRef
} from '@angular/core';
import {COMPILER_PROVIDERS, XHR} from '@angular/compiler';
import {CachedXHR} from './src/xhr/xhr_cache';
import {Provider, Type, ComponentRef} from '@angular/core';
import {isPresent} from './src/facade/lang';
import {XHRImpl} from './src/xhr/xhr_impl';
import {BROWSER_APP_COMMON_PROVIDERS, browserPlatform} from '@angular/platform-browser';
import {reflector, ReflectiveInjector, coreLoadAndBootstrap} from '@angular/core';
import {getDOM} from './platform_browser_private';
import {ReflectionCapabilities} from './core_private';
import {CachedXHR} from '../src/xhr/xhr_cache';
import {isPresent} from '../src/facade/lang';
import {XHRImpl} from '../src/xhr/xhr_impl';
import {
browserPlatform,
BROWSER_APP_COMMON_PROVIDERS,
} from '@angular/platform-browser';
import {ReflectionCapabilities} from '../core_private';
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[{provide: XHR, useClass: CachedXHR}];
@ -21,8 +29,6 @@ export const BROWSER_APP_DYNAMIC_PROVIDERS: Array<any /*Type | Provider | any[]*
{provide: XHR, useClass: XHRImpl},
];
/**
* Bootstrapping for Angular applications.
*

View File

@ -0,0 +1,5 @@
/**
* All channels used by angular's WebWorker components are listed here.
* You should not use these channels in your application code.
*/
export const XHR_CHANNEL = "ng-XHR";

View File

@ -0,0 +1,23 @@
import {Injectable} from '@angular/core';
import {PRIMITIVE, ServiceMessageBrokerFactory} from '@angular/platform-browser';
import {XHR_CHANNEL} from '../shared/messaging_api';
import {XHR} from '@angular/compiler';
import {FunctionWrapper} from '../../facade/lang';
/**
* XHR requests triggered on the worker side are executed on the UI side.
*
* This is only strictly required for Dart where the isolates do not have access to XHRs.
*
* @internal
*/
@Injectable()
export class MessageBasedXHRImpl {
constructor(private _brokerFactory: ServiceMessageBrokerFactory, private _xhr: XHR) {}
start(): void {
var broker = this._brokerFactory.createMessageBroker(XHR_CHANNEL);
broker.registerMethod("get", [PRIMITIVE], FunctionWrapper.bind(this._xhr.get, this._xhr),
PRIMITIVE);
}
}

View File

@ -1,16 +1,18 @@
import {Injectable} from '@angular/core/src/di';
import {XHR} from '@angular/compiler/src/xhr';
import {Injectable} from '@angular/core';
import {XHR} from '@angular/compiler';
import {
FnArg,
UiArguments,
ClientMessageBroker,
ClientMessageBrokerFactory
} from '../shared/client_message_broker';
} from '@angular/platform-browser';
import {XHR_CHANNEL} from '../shared/messaging_api';
/**
* Implementation of compiler/xhr that relays XHR requests to the UI side where they are sent
* and the result is proxied back to the worker
* and the result is proxied back to the worker.
*
* This is only strictly required for Dart where isolates do not have access to the XHRs.
*/
@Injectable()
export class WebWorkerXHRImpl extends XHR {

View File

@ -0,0 +1,28 @@
import {WORKER_APP_APPLICATION_PROVIDERS, workerAppPlatform} from '@angular/platform-browser';
import {COMPILER_PROVIDERS, XHR} from '@angular/compiler';
import {WebWorkerXHRImpl} from './web_workers/worker/xhr_impl';
import {isPresent} from './facade/lang';
import {
PlatformRef,
Type,
ComponentRef,
ReflectiveInjector,
coreLoadAndBootstrap,
} from '@angular/core';
export const WORKER_APP_DYNAMIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
WORKER_APP_APPLICATION_PROVIDERS,
COMPILER_PROVIDERS,
WebWorkerXHRImpl,
/* @ts2dart_Provider */ {provide: XHR, useExisting: WebWorkerXHRImpl}
];
export function bootstrapApp(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
var appInjector = ReflectiveInjector.resolveAndCreate(
[WORKER_APP_DYNAMIC_APPLICATION_PROVIDERS, isPresent(customProviders) ? customProviders : []],
workerAppPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}

View File

@ -0,0 +1,38 @@
import {XHR} from "@angular/compiler";
import {XHRImpl} from "./xhr/xhr_impl";
import {MessageBasedXHRImpl} from "./web_workers/ui/xhr_impl";
import {
WORKER_RENDER_APPLICATION_PROVIDERS,
WORKER_RENDER_STARTABLE_MESSAGING_SERVICE
} from '@angular/platform-browser';
import {
ApplicationRef,
PlatformRef,
ReflectiveInjector,
} from '@angular/core';
import {workerRenderPlatform, WORKER_SCRIPT} from '@angular/platform-browser';
import {isPresent} from './facade/lang';
import {PromiseWrapper} from './facade/async';
export const WORKER_RENDER_DYNAMIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
WORKER_RENDER_APPLICATION_PROVIDERS,
/* @ts2dart_Provider */ {provide: XHR, useClass: XHRImpl},
MessageBasedXHRImpl,
/* @ts2dart_Provider */ {provide: WORKER_RENDER_STARTABLE_MESSAGING_SERVICE, useExisting: MessageBasedXHRImpl, multi: true},
];
export function bootstrapRender(
workerScriptUri: string,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ApplicationRef> {
var app = ReflectiveInjector.resolveAndCreate(
[
WORKER_RENDER_DYNAMIC_APPLICATION_PROVIDERS,
/* @ts2dart_Provider */ {provide: WORKER_SCRIPT, useValue: workerScriptUri},
isPresent(customProviders) ? customProviders : []
],
workerRenderPlatform().injector);
// Return a promise so that we keep the same semantics as Dart,
// and we might want to wait for the app side to come up
// in the future...
return PromiseWrapper.resolve(app.get(ApplicationRef));
}

View File

@ -0,0 +1 @@
<span>from external template</span>

View File

@ -1,16 +1,13 @@
import {
inject,
describe,
it,
expect,
beforeEach,
beforeEachProviders
} from '@angular/core/testing/testing_internal';
import {inject, describe, it, expect} from '@angular/core/testing/testing_internal';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {SpyMessageBroker} from './spies';
import {WebWorkerXHRImpl} from '@angular/platform-browser/src/web_workers/worker/xhr_impl';
import {SpyMessageBroker} from '@angular/platform-browser/test/web_workers/worker/spies';
import {WebWorkerXHRImpl} from '@angular/platform-browser-dynamic/src/web_workers/worker/xhr_impl';
import {PromiseWrapper} from '../../../src/facade/async';
import {MockMessageBrokerFactory, expectBrokerCall} from '../shared/web_worker_test_util';
import {
MockMessageBrokerFactory,
expectBrokerCall
} from '@angular/platform-browser/test/web_workers/shared/web_worker_test_util';
export function main() {
describe("WebWorkerXHRImpl", () => {

View File

@ -1 +1,2 @@
export * from './testing/browser';
export * from './testing/dom_test_component_renderer';

View File

@ -3,7 +3,14 @@ import {
ADDITIONAL_TEST_BROWSER_PROVIDERS
} from '@angular/platform-browser/testing';
import {BROWSER_APP_DYNAMIC_PROVIDERS} from '../index';
import {DirectiveResolver, ViewResolver} from '@angular/compiler';
import {
MockDirectiveResolver,
MockViewResolver,
TestComponentRenderer,
TestComponentBuilder
} from '@angular/compiler/testing';
import {DOMTestComponentRenderer} from './dom_test_component_renderer';
/**
* Default platform providers for testing.
@ -11,8 +18,20 @@ import {BROWSER_APP_DYNAMIC_PROVIDERS} from '../index';
export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[TEST_BROWSER_STATIC_PLATFORM_PROVIDERS];
export const ADDITIONAL_DYNAMIC_TEST_BROWSER_PROVIDERS = [
/*@ts2dart_Provider*/ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
/*@ts2dart_Provider*/ {provide: ViewResolver, useClass: MockViewResolver},
TestComponentBuilder,
/*@ts2dart_Provider*/ {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer},
];
/**
* Default application providers for testing.
*/
export const TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[BROWSER_APP_DYNAMIC_PROVIDERS, ADDITIONAL_TEST_BROWSER_PROVIDERS];
/*@ts2dart_const*/[
BROWSER_APP_DYNAMIC_PROVIDERS,
ADDITIONAL_TEST_BROWSER_PROVIDERS,
ADDITIONAL_DYNAMIC_TEST_BROWSER_PROVIDERS
];

View File

@ -1,8 +1,8 @@
import {Inject, Injectable} from '@angular/core';
import {DOCUMENT} from '../src/dom/dom_tokens';
import {getDOM} from '../src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser';
import {getDOM} from '../platform_browser_private';
import {TestComponentRenderer} from '@angular/compiler/testing';
import {el} from './browser_util';
import {el} from '@angular/platform-browser/testing';
/**
* A DOM based implementation of the TestComponentRenderer.

View File

@ -1 +1,6 @@
export * from './src/platform_browser';
export * from './src/worker_render';
export * from './src/worker_app';
export * from './private_export';

View File

@ -5,7 +5,7 @@ import * as css_animation_options from './src/animate/css_animation_options';
import * as animation from './src/animate/animation';
import * as dom_adapter from './src/dom/dom_adapter';
import * as browser_adapter from './src/browser/browser_adapter';
import * as browser_common from './src/browser_common';
export namespace __platform_browser_private__ {
export type DomAdapter = dom_adapter.DomAdapter;

View File

@ -1,5 +1,4 @@
import {
Provider,
PLATFORM_INITIALIZER,
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
@ -36,7 +35,8 @@ import {
import {DomSharedStylesHost} from './dom/shared_styles_host';
import {AnimationBuilder} from './animate/animation_builder';
import {BrowserDetails} from './animate/browser_details';
import {PlatformLocation} from '@angular/common';
import {BrowserPlatformLocation} from './browser/location/browser_platform_location';
export {Title} from './browser/title';
export {BrowserDomAdapter} from './browser/browser_adapter';
export {enableDebugTools, disableDebugTools} from './browser/tools/tools';
@ -54,6 +54,7 @@ export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2d
/*@ts2dart_Provider*/ {provide: BROWSER_PLATFORM_MARKER, useValue: true},
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_Provider*/ {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
/*@ts2dart_Provider*/ {provide: PlatformLocation, useClass: BrowserPlatformLocation}
];
function _exceptionHandler(): ExceptionHandler {
@ -101,14 +102,9 @@ export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/
];
export {
HAMMER_GESTURE_CONFIG,
HammerGestureConfig
} from '../src/dom/events/hammer_gestures'
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from '../src/dom/events/hammer_gestures';
export function
initDomAdapter() {
export function initDomAdapter() {
BrowserDomAdapter.makeCurrent();
wtfInit();
BrowserGetTestability.init();

View File

@ -1,13 +1,5 @@
import {
ReflectiveInjector,
PlatformRef,
getPlatform,
createPlatform,
assertPlatform
} from '@angular/core';
import {isBlank} from './facade/lang';
import {BROWSER_PROVIDERS, BROWSER_PLATFORM_MARKER} from './browser_common';
export {DomEventsPlugin} from './dom/events/dom_events';
export {KeyEventsPlugin} from './dom/events/key_events';
export {EventManager, EVENT_MANAGER_PLUGINS} from './dom/events/event_manager';
export {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
@ -23,7 +15,6 @@ export {
HammerGestureConfig
} from './browser_common';
export * from '../private_export';
export {DOCUMENT} from './dom/dom_tokens';
export {
@ -38,16 +29,7 @@ export {
export {
bootstrapStatic,
browserStaticPlatform,
browserPlatform,
BROWSER_APP_STATIC_PROVIDERS,
BrowserPlatformLocation
} from './platform_browser_static';
export function browserPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
}
return assertPlatform(BROWSER_PLATFORM_MARKER);
}
} from './platform_browser_static';

View File

@ -26,13 +26,12 @@ export {
/**
* An array of providers that should be passed into `application()` when bootstrapping a component
* when all templates
* have been precompiled offline.
* when all templates have been precompiled offline.
*/
export const BROWSER_APP_STATIC_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ BROWSER_APP_COMMON_PROVIDERS;
export function browserStaticPlatform(): PlatformRef {
export function browserPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
}
@ -52,6 +51,6 @@ export function bootstrapStatic(appComponentType: Type,
let appProviders = isPresent(customProviders) ? [BROWSER_APP_STATIC_PROVIDERS, customProviders] :
BROWSER_APP_STATIC_PROVIDERS;
var appInjector =
ReflectiveInjector.resolveAndCreate(appProviders, browserStaticPlatform().injector);
ReflectiveInjector.resolveAndCreate(appProviders, browserPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}

View File

@ -1,3 +1,3 @@
import {OpaqueToken} from '@angular/core/src/di';
import {OpaqueToken} from '@angular/core';
export const ON_WEB_WORKER = /*@ts2dart_const*/ new OpaqueToken('WebWorker.onWebWorker');

View File

@ -1,6 +1,5 @@
import {EventEmitter} from '../../../src/facade/async';
import {NgZone} from '@angular/core/src/zone/ng_zone';
export {EventEmitter, Observable} from '../../../src/facade/async';
import {NgZone} from '@angular/core';
/**
* Message Bus is a low level API used to communicate between the UI and the background.

View File

@ -3,6 +3,5 @@
* You should not use these channels in your application code.
*/
export const RENDERER_CHANNEL = "ng-Renderer";
export const XHR_CHANNEL = "ng-XHR";
export const EVENT_CHANNEL = "ng-Events";
export const ROUTER_CHANNEL = "ng-Router";

View File

@ -2,8 +2,7 @@ import {MessageBus, MessageBusSource, MessageBusSink} from './message_bus';
import {BaseException} from '../../../src/facade/exceptions';
import {EventEmitter, ObservableWrapper} from '../../../src/facade/async';
import {StringMapWrapper} from '../../../src/facade/collection';
import {Injectable} from '@angular/core/src/di';
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {Injectable, NgZone} from '@angular/core';
// TODO(jteplitz602) Replace this with the definition in lib.webworker.d.ts(#3492)
export interface PostMessageTarget { postMessage: (message: any, transfer?:[ArrayBuffer]) => void; }

View File

@ -1,4 +1,4 @@
import {Injectable} from '@angular/core/src/di';
import {Injectable} from '@angular/core';
@Injectable()
export class RenderStore {

View File

@ -1,4 +1,4 @@
import {Injectable} from '@angular/core/src/di';
import {Injectable} from '@angular/core';
import {ListWrapper, Map} from '../../../src/facade/collection';
import {Serializer} from '../shared/serializer';
import {isPresent, Type, FunctionWrapper} from '../../../src/facade/lang';

View File

@ -1,11 +0,0 @@
library angular2.src.web_workers.ui.bind;
/**
* Binding is not necessary in dart.
* This method just returns the passed function regardless of scope.
* It's only here to match the TypeScript implementation.
* TODO(jteplitz602) Have ts2dart remove calls to bind(#3820)
*/
Function bind(Function fn, dynamic scope) {
return fn;
}

View File

@ -1,3 +0,0 @@
export function bind(fn: Function, scope: any): Function {
return fn.bind(scope);
}

View File

@ -0,0 +1,21 @@
import {MessageBasedPlatformLocation} from './platform_location';
import {BrowserPlatformLocation} from '../../browser/location/browser_platform_location';
import {APP_INITIALIZER, Injector, NgZone} from '@angular/core';
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
*/
export const WORKER_RENDER_LOCATION_PROVIDERS = /*@ts2dart_const*/[
MessageBasedPlatformLocation,
BrowserPlatformLocation,
/* @ts2dart_Provider */ {provide: APP_INITIALIZER, useFactory: initUiLocation, multi: true, deps: [Injector]}
];
function initUiLocation(injector: Injector): () => void {
return () => {
let zone = injector.get(NgZone);
zone.runGuarded(() => injector.get(MessageBasedPlatformLocation).start());
};
}

View File

@ -1,15 +1,13 @@
import {
BrowserPlatformLocation
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
import {BrowserPlatformLocation} from '../../browser/location/browser_platform_location';
import {UrlChangeListener} from '@angular/common';
import {Injectable} from '@angular/core/src/di';
import {Injectable} from '@angular/core';
import {ROUTER_CHANNEL} from '../shared/messaging_api';
import {ServiceMessageBrokerFactory, ServiceMessageBroker} from '../shared/service_message_broker';
import {PRIMITIVE, Serializer} from '../shared/serializer';
import {bind} from './bind';
import {LocationType} from '../shared/serialized_types';
import {MessageBus} from '../shared/message_bus';
import {EventEmitter, ObservableWrapper, PromiseWrapper} from '../../../src/facade/async';
import {FunctionWrapper} from '../../../src/facade/lang';
@Injectable()
export class MessageBasedPlatformLocation {
@ -19,23 +17,30 @@ export class MessageBasedPlatformLocation {
constructor(private _brokerFactory: ServiceMessageBrokerFactory,
private _platformLocation: BrowserPlatformLocation, bus: MessageBus,
private _serializer: Serializer) {
this._platformLocation.onPopState(<UrlChangeListener>bind(this._sendUrlChangeEvent, this));
this._platformLocation.onHashChange(<UrlChangeListener>bind(this._sendUrlChangeEvent, this));
this._platformLocation.onPopState(
<UrlChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
this._platformLocation.onHashChange(
<UrlChangeListener>FunctionWrapper.bind(this._sendUrlChangeEvent, this));
this._broker = this._brokerFactory.createMessageBroker(ROUTER_CHANNEL);
this._channelSink = bus.to(ROUTER_CHANNEL);
}
start(): void {
this._broker.registerMethod("getLocation", null, bind(this._getLocation, this), LocationType);
this._broker.registerMethod("setPathname", [PRIMITIVE], bind(this._setPathname, this));
this._broker.registerMethod("pushState", [PRIMITIVE, PRIMITIVE, PRIMITIVE],
bind(this._platformLocation.pushState, this._platformLocation));
this._broker.registerMethod("replaceState", [PRIMITIVE, PRIMITIVE, PRIMITIVE],
bind(this._platformLocation.replaceState, this._platformLocation));
this._broker.registerMethod("forward", null,
bind(this._platformLocation.forward, this._platformLocation));
this._broker.registerMethod("back", null,
bind(this._platformLocation.back, this._platformLocation));
this._broker.registerMethod("getLocation", null, FunctionWrapper.bind(this._getLocation, this),
LocationType);
this._broker.registerMethod("setPathname", [PRIMITIVE],
FunctionWrapper.bind(this._setPathname, this));
this._broker.registerMethod(
"pushState", [PRIMITIVE, PRIMITIVE, PRIMITIVE],
FunctionWrapper.bind(this._platformLocation.pushState, this._platformLocation));
this._broker.registerMethod(
"replaceState", [PRIMITIVE, PRIMITIVE, PRIMITIVE],
FunctionWrapper.bind(this._platformLocation.replaceState, this._platformLocation));
this._broker.registerMethod(
"forward", null,
FunctionWrapper.bind(this._platformLocation.forward, this._platformLocation));
this._broker.registerMethod(
"back", null, FunctionWrapper.bind(this._platformLocation.back, this._platformLocation));
}
private _getLocation(): Promise<Location> {

View File

@ -1,12 +1,11 @@
import {Injectable} from '@angular/core/src/di';
import {Injectable, RootRenderer, Renderer, RenderComponentType} from '@angular/core';
import {MessageBus} from '../shared/message_bus';
import {Serializer, PRIMITIVE, RenderStoreObject} from '../shared/serializer';
import {RootRenderer, Renderer, RenderComponentType} from '@angular/core/src/render/api';
import {EVENT_CHANNEL, RENDERER_CHANNEL} from '../shared/messaging_api';
import {bind} from './bind';
import {EventDispatcher} from '../ui/event_dispatcher';
import {RenderStore} from '../shared/render_store';
import {ServiceMessageBrokerFactory} from '../shared/service_message_broker';
import {FunctionWrapper} from '../../facade/lang';
@Injectable()
export class MessageBasedRenderer {
@ -22,55 +21,55 @@ export class MessageBasedRenderer {
this._eventDispatcher = new EventDispatcher(this._bus.to(EVENT_CHANNEL), this._serializer);
broker.registerMethod("renderComponent", [RenderComponentType, PRIMITIVE],
bind(this._renderComponent, this));
FunctionWrapper.bind(this._renderComponent, this));
broker.registerMethod("selectRootElement", [RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._selectRootElement, this));
FunctionWrapper.bind(this._selectRootElement, this));
broker.registerMethod("createElement",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._createElement, this));
FunctionWrapper.bind(this._createElement, this));
broker.registerMethod("createViewRoot", [RenderStoreObject, RenderStoreObject, PRIMITIVE],
bind(this._createViewRoot, this));
FunctionWrapper.bind(this._createViewRoot, this));
broker.registerMethod("createTemplateAnchor", [RenderStoreObject, RenderStoreObject, PRIMITIVE],
bind(this._createTemplateAnchor, this));
FunctionWrapper.bind(this._createTemplateAnchor, this));
broker.registerMethod("createText",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._createText, this));
FunctionWrapper.bind(this._createText, this));
broker.registerMethod("projectNodes", [RenderStoreObject, RenderStoreObject, RenderStoreObject],
bind(this._projectNodes, this));
FunctionWrapper.bind(this._projectNodes, this));
broker.registerMethod("attachViewAfter",
[RenderStoreObject, RenderStoreObject, RenderStoreObject],
bind(this._attachViewAfter, this));
FunctionWrapper.bind(this._attachViewAfter, this));
broker.registerMethod("detachView", [RenderStoreObject, RenderStoreObject],
bind(this._detachView, this));
FunctionWrapper.bind(this._detachView, this));
broker.registerMethod("destroyView", [RenderStoreObject, RenderStoreObject, RenderStoreObject],
bind(this._destroyView, this));
FunctionWrapper.bind(this._destroyView, this));
broker.registerMethod("setElementProperty",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._setElementProperty, this));
FunctionWrapper.bind(this._setElementProperty, this));
broker.registerMethod("setElementAttribute",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._setElementAttribute, this));
FunctionWrapper.bind(this._setElementAttribute, this));
broker.registerMethod("setBindingDebugInfo",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._setBindingDebugInfo, this));
FunctionWrapper.bind(this._setBindingDebugInfo, this));
broker.registerMethod("setElementClass",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._setElementClass, this));
FunctionWrapper.bind(this._setElementClass, this));
broker.registerMethod("setElementStyle",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._setElementStyle, this));
FunctionWrapper.bind(this._setElementStyle, this));
broker.registerMethod("invokeElementMethod",
[RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._invokeElementMethod, this));
FunctionWrapper.bind(this._invokeElementMethod, this));
broker.registerMethod("setText", [RenderStoreObject, RenderStoreObject, PRIMITIVE],
bind(this._setText, this));
FunctionWrapper.bind(this._setText, this));
broker.registerMethod("listen", [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE],
bind(this._listen, this));
FunctionWrapper.bind(this._listen, this));
broker.registerMethod("listenGlobal", [RenderStoreObject, PRIMITIVE, PRIMITIVE, PRIMITIVE],
bind(this._listenGlobal, this));
FunctionWrapper.bind(this._listenGlobal, this));
broker.registerMethod("listenDone", [RenderStoreObject, RenderStoreObject],
bind(this._listenDone, this));
FunctionWrapper.bind(this._listenDone, this));
}
private _renderComponent(renderComponentType: RenderComponentType, rendererId: number) {

View File

@ -1,19 +0,0 @@
import {MessageBasedPlatformLocation} from './platform_location';
import {
BrowserPlatformLocation
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
import {APP_INITIALIZER, Provider, Injector, NgZone} from '@angular/core';
export const WORKER_RENDER_ROUTER = /*@ts2dart_const*/[
MessageBasedPlatformLocation,
BrowserPlatformLocation,
/* @ts2dart_Provider */ {provide: APP_INITIALIZER, useFactory: initRouterListeners, multi: true, deps: [Injector]}
];
function initRouterListeners(injector: Injector): () => void {
return () => {
let zone = injector.get(NgZone);
zone.runGuarded(() => injector.get(MessageBasedPlatformLocation).start());
};
}

View File

@ -1,16 +0,0 @@
import {Injectable} from '@angular/core';
import {PRIMITIVE} from '../shared/serializer';
import {XHR_CHANNEL} from '../shared/messaging_api';
import {XHR} from '@angular/compiler';
import {ServiceMessageBrokerFactory} from '../shared/service_message_broker';
import {bind} from './bind';
@Injectable()
export class MessageBasedXHRImpl {
constructor(private _brokerFactory: ServiceMessageBrokerFactory, private _xhr: XHR) {}
start(): void {
var broker = this._brokerFactory.createMessageBroker(XHR_CHANNEL);
broker.registerMethod("get", [PRIMITIVE], bind(this._xhr.get, this._xhr), PRIMITIVE);
}
}

View File

@ -0,0 +1,22 @@
import {NgZone, APP_INITIALIZER} from '@angular/core';
import {PlatformLocation} from '@angular/common';
import {WebWorkerPlatformLocation} from './platform_location';
/**
* Those providers should be added when the router is used in a worker context in addition to the
* {@link ROUTER_PROVIDERS} and after them.
*/
export const WORKER_APP_LOCATION_PROVIDERS = /*@ts2dart_const*/[
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: WebWorkerPlatformLocation},
{
provide: APP_INITIALIZER,
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () =>
initWorkerLocation(platformLocation, zone),
multi: true,
deps: [PlatformLocation, NgZone]
}
];
function initWorkerLocation(platformLocation: WebWorkerPlatformLocation, zone: NgZone): Promise<boolean> {
return zone.runGuarded(() => platformLocation.init());
}

View File

@ -1,11 +1,11 @@
import {Injectable} from '@angular/core/src/di';
import {Injectable} from '@angular/core';
import {
FnArg,
UiArguments,
ClientMessageBroker,
ClientMessageBrokerFactory
} from '../shared/client_message_broker';
import {PlatformLocation, UrlChangeEvent, UrlChangeListener} from '@angular/common';
import {PlatformLocation, UrlChangeListener} from '@angular/common';
import {ROUTER_CHANNEL} from '../shared/messaging_api';
import {LocationType} from '../shared/serialized_types';
import {PromiseWrapper, EventEmitter, ObservableWrapper} from '../../../src/facade/async';

View File

@ -2,24 +2,19 @@ import {
Renderer,
RootRenderer,
RenderComponentType,
RenderDebugInfo
} from '@angular/core/src/render/api';
import {
ClientMessageBroker,
ClientMessageBrokerFactory,
FnArg,
UiArguments
} from '../shared/client_message_broker';
import {isPresent, isBlank, print} from '../../../src/facade/lang';
Injectable,
ViewEncapsulation
} from '@angular/core';
import {RenderDebugInfo} from '../../../core_private';
import {ClientMessageBrokerFactory, FnArg, UiArguments} from '../shared/client_message_broker';
import {isPresent, isBlank} from '../../../src/facade/lang';
import {ListWrapper} from '../../../src/facade/collection';
import {Injectable} from '@angular/core/src/di';
import {RenderStore} from '../shared/render_store';
import {RENDERER_CHANNEL} from '../shared/messaging_api';
import {RENDERER_CHANNEL, EVENT_CHANNEL} from '../shared/messaging_api';
import {Serializer, RenderStoreObject} from '../shared/serializer';
import {EVENT_CHANNEL} from '../shared/messaging_api';
import {MessageBus} from '../shared/message_bus';
import {ObservableWrapper} from '../../../src/facade/async';
import {ViewEncapsulation} from '@angular/core';
import {deserializeGenericEvent} from './event_deserializer';
@Injectable()

View File

@ -1,20 +0,0 @@
import {Provider, NgZone, APP_INITIALIZER} from '@angular/core';
import {PlatformLocation} from '@angular/common';
import {WebWorkerPlatformLocation} from './platform_location';
import {ROUTER_PROVIDERS} from '@angular/router';
export var WORKER_APP_ROUTER = [
ROUTER_PROVIDERS,
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: WebWorkerPlatformLocation},
{
provide: APP_INITIALIZER,
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () =>
initRouter(platformLocation, zone),
multi: true,
deps: [PlatformLocation, NgZone]
}
];
function initRouter(platformLocation: WebWorkerPlatformLocation, zone: NgZone): Promise<boolean> {
return zone.runGuarded(() => { return platformLocation.init(); });
}

View File

@ -0,0 +1,390 @@
library angular2.dom.webWorkerAdapter;
import 'abstract_html_adapter.dart';
import 'package:angular2/platform/common_dom.dart';
/**
* This adapter is required to log error messages.
*
* Note: other methods all throw as the DOM is not accessible directly
* in web worker context.
*/
class WebWorkerDomAdapter implements DomAdapter {
static void makeCurrent() {
setRootDomAdapter(new WebWorkerDomAdapter());
}
logError(error) {
print('${error}');
}
log(error) {
print('${error}');
}
logGroup(error) {
print('${error}');
}
logGroupEnd() {}
hasProperty(element, String name) {
throw 'not implemented';
}
void setProperty(Element element, String name, Object value) =>
throw 'not implemented';
getProperty(Element element, String name) => throw 'not implemented';
invoke(Element element, String methodName, List args) =>
throw 'not implemented';
get attrToPropMap => throw 'not implemented';
set attrToPropMap(value) {
throw 'readonly';
}
getGlobalEventTarget(String target) {
throw 'not implemented';
}
getTitle() {
throw 'not implemented';
}
setTitle(String newTitle) {
throw 'not implemented';
}
String getEventKey(event) {
throw 'not implemented';
}
void replaceChild(el, newNode, oldNode) {
throw 'not implemented';
}
dynamic getBoundingClientRect(el) {
throw 'not implemented';
}
Type getXHR() => throw 'not implemented';
Element parse(String templateHtml) => throw 'not implemented';
query(selector) {
throw 'not implemented';
}
querySelector(el, String selector) {
throw 'not implemented';
}
List querySelectorAll(el, String selector) {
throw 'not implemented';
}
on(el, evt, listener) {
throw 'not implemented';
}
Function onAndCancel(el, evt, listener) {
throw 'not implemented';
}
dispatchEvent(el, evt) {
throw 'not implemented';
}
createMouseEvent(eventType) {
throw 'not implemented';
}
createEvent(eventType) {
throw 'not implemented';
}
preventDefault(evt) {
throw 'not implemented';
}
isPrevented(evt) {
throw 'not implemented';
}
getInnerHTML(el) => throw 'not implemented';
getOuterHTML(el) => throw 'not implemented';
String nodeName(node) => throw 'not implemented';
String nodeValue(node) => throw 'not implemented';
String type(node) {
throw 'not implemented';
}
content(node) => throw 'not implemented';
firstChild(el) => throw 'not implemented';
nextSibling(el) => throw 'not implemented';
parentElement(el) => throw 'not implemented';
List childNodes(el) => throw 'not implemented';
List childNodesAsList(el) => throw 'not implemented';
clearNodes(el) {
throw 'not implemented';
}
appendChild(el, node) => throw 'not implemented';
removeChild(el, node) {
throw 'not implemented';
}
remove(el) => throw 'not implemented';
insertBefore(el, node) {
throw 'not implemented';
}
insertAllBefore(el, nodes) {
throw 'not implemented';
}
insertAfter(el, node) {
throw 'not implemented';
}
setInnerHTML(el, value) {
throw 'not implemented';
}
getText(el) => throw 'not implemented';
setText(el, String value) => throw 'not implemented';
getValue(el) {
throw 'not implemented';
}
setValue(el, String value) {
throw 'not implemented';
}
getChecked(el) {
throw 'not implemented';
}
setChecked(el, bool value) {
throw 'not implemented';
}
createComment(String text) => throw 'not implemented';
createTemplate(String html) => throw 'not implemented';
createElement(tagName, [doc]) => throw 'not implemented';
createElementNS(ns, tagName, [doc]) {
throw 'not implemented';
}
createTextNode(String text, [doc]) => throw 'not implemented';
createScriptTag(String attrName, String attrValue, [doc]) {
throw 'not implemented';
}
createStyleElement(String css, [doc]) {
throw 'not implemented';
}
createShadowRoot(el) {
throw 'not implemented';
}
getShadowRoot(el) {
throw 'not implemented';
}
getHost(el) {
throw 'not implemented';
}
clone(node) => throw 'not implemented';
getElementsByClassName(element, String name) {
throw 'not implemented';
}
getElementsByTagName(element, String name) {
throw 'not implemented';
}
List classList(element) => throw 'not implemented';
addClass(element, String className) {
throw 'not implemented';
}
removeClass(element, String className) {
throw 'not implemented';
}
hasClass(element, String className) => throw 'not implemented';
setStyle(element, String styleName, String styleValue) {
throw 'not implemented';
}
bool hasStyle(Element element, String styleName, [String styleValue]) {
throw 'not implemented';
}
removeStyle(element, String styleName) {
throw 'not implemented';
}
getStyle(element, String styleName) {
throw 'not implemented';
}
String tagName(element) => throw 'not implemented';
attributeMap(element) => throw 'not implemented';
hasAttribute(element, String attribute) => throw 'not implemented';
hasAttributeNS(element, String ns, String attribute) {
throw 'not implemented';
}
getAttribute(element, String attribute) => throw 'not implemented';
getAttributeNS(element, String ns, String attribute) {
throw 'not implemented';
}
setAttribute(element, String name, String value) {
throw 'not implemented';
}
setAttributeNS(element, String ns, String name, String value) {
throw 'not implemented';
}
removeAttribute(element, String attribute) {
throw 'not implemented';
}
removeAttributeNS(element, String ns, String attribute) {
throw 'not implemented';
}
templateAwareRoot(el) => throw 'not implemented';
createHtmlDocument() {
throw 'not implemented';
}
defaultDoc() {
throw 'not implemented';
}
bool elementMatches(n, String selector) {
throw 'not implemented';
}
bool isTemplateElement(Element el) => throw 'not implemented';
bool isTextNode(node) => throw 'not implemented';
bool isCommentNode(node) => throw 'not implemented';
bool isElementNode(node) => throw 'not implemented';
bool hasShadowRoot(node) {
throw 'not implemented';
}
bool isShadowRoot(node) {
throw 'not implemented';
}
importIntoDoc(node) {
throw 'not implemented';
}
adoptNode(node) {
throw 'not implemented';
}
String getHref(element) {
throw 'not implemented';
}
void resolveAndSetHref(element, baseUrl, href) {
throw 'not implemented';
}
List getDistributedNodes(Node) {
throw 'not implemented';
}
bool supportsDOMEvents() => throw 'not implemented';
bool supportsNativeShadowDOM() => throw 'not implemented';
getHistory() => throw 'not implemented';
getLocation() {
throw 'not implemented';
}
getBaseHref() {
throw 'not implemented';
}
resetBaseElement() {
throw 'not implemented';
}
String getUserAgent() => throw 'not implemented';
void setData(Element element, String name, String value) {
throw 'not implemented';
}
getComputedStyle(element) {
throw 'not implemented';
}
String getData(Element element, String name) => throw 'not implemented';
// TODO(tbosch): move this into a separate environment class once we have it
setGlobalVar(String name, value) {
throw 'not implemented';
}
requestAnimationFrame(callback) {
throw 'not implemented';
}
cancelAnimationFrame(id) {
throw 'not implemented';
}
performanceNow() {
throw 'not implemented';
}
getAnimationPrefix() {
throw 'not implemented';
}
getTransitionEnd() {
throw 'not implemented';
}
supportsAnimation() {
throw 'not implemented';
}
}

View File

@ -0,0 +1,155 @@
import {Type} from '../../../src/facade/lang';
import {DomAdapter, setRootDomAdapter} from '../../dom/dom_adapter';
/**
* This adapter is required to log error messages.
*
* Note: other methods all throw as the DOM is not accessible directly in web worker context.
*/
export class WorkerDomAdapter extends DomAdapter {
static makeCurrent() { setRootDomAdapter(new WorkerDomAdapter()); }
logError(error) {
if (console.error) {
console.error(error);
} else {
console.log(error);
}
}
log(error) { console.log(error); }
logGroup(error) {
if (console.group) {
console.group(error);
this.logError(error);
} else {
console.log(error);
}
}
logGroupEnd() {
if (console.groupEnd) {
console.groupEnd();
}
}
hasProperty(element, name: string): boolean { throw "not implemented"; }
setProperty(el: Element, name: string, value: any) { throw "not implemented"; }
getProperty(el: Element, name: string): any { throw "not implemented"; }
invoke(el: Element, methodName: string, args: any[]): any { throw "not implemented"; }
getXHR(): Type { throw "not implemented"; }
get attrToPropMap(): {[key: string]: string} { throw "not implemented"; }
set attrToPropMap(value: {[key: string]: string}) { throw "not implemented"; }
parse(templateHtml: string) { throw "not implemented"; }
query(selector: string): any { throw "not implemented"; }
querySelector(el, selector: string): HTMLElement { throw "not implemented"; }
querySelectorAll(el, selector: string): any[] { throw "not implemented"; }
on(el, evt, listener) { throw "not implemented"; }
onAndCancel(el, evt, listener): Function { throw "not implemented"; }
dispatchEvent(el, evt) { throw "not implemented"; }
createMouseEvent(eventType): any { throw "not implemented"; }
createEvent(eventType: string): any { throw "not implemented"; }
preventDefault(evt) { throw "not implemented"; }
isPrevented(evt): boolean { throw "not implemented"; }
getInnerHTML(el): string { throw "not implemented"; }
getTemplateContent(el): any { throw "not implemented"; }
getOuterHTML(el): string { throw "not implemented"; }
nodeName(node): string { throw "not implemented"; }
nodeValue(node): string { throw "not implemented"; }
type(node): string { throw "not implemented"; }
content(node): any { throw "not implemented"; }
firstChild(el): Node { throw "not implemented"; }
nextSibling(el): Node { throw "not implemented"; }
parentElement(el): Node { throw "not implemented"; }
childNodes(el): Node[] { throw "not implemented"; }
childNodesAsList(el): Node[] { throw "not implemented"; }
clearNodes(el) { throw "not implemented"; }
appendChild(el, node) { throw "not implemented"; }
removeChild(el, node) { throw "not implemented"; }
replaceChild(el, newNode, oldNode) { throw "not implemented"; }
remove(el): Node { throw "not implemented"; }
insertBefore(el, node) { throw "not implemented"; }
insertAllBefore(el, nodes) { throw "not implemented"; }
insertAfter(el, node) { throw "not implemented"; }
setInnerHTML(el, value) { throw "not implemented"; }
getText(el): string { throw "not implemented"; }
setText(el, value: string) { throw "not implemented"; }
getValue(el): string { throw "not implemented"; }
setValue(el, value: string) { throw "not implemented"; }
getChecked(el): boolean { throw "not implemented"; }
setChecked(el, value: boolean) { throw "not implemented"; }
createComment(text: string): any { throw "not implemented"; }
createTemplate(html): HTMLElement { throw "not implemented"; }
createElement(tagName, doc?): HTMLElement { throw "not implemented"; }
createElementNS(ns: string, tagName: string, doc?): Element { throw "not implemented"; }
createTextNode(text: string, doc?): Text { throw "not implemented"; }
createScriptTag(attrName: string, attrValue: string, doc?): HTMLElement {
throw "not implemented";
}
createStyleElement(css: string, doc?): HTMLStyleElement { throw "not implemented"; }
createShadowRoot(el): any { throw "not implemented"; }
getShadowRoot(el): any { throw "not implemented"; }
getHost(el): any { throw "not implemented"; }
getDistributedNodes(el): Node[] { throw "not implemented"; }
clone(node: Node): Node { throw "not implemented"; }
getElementsByClassName(element, name: string): HTMLElement[] { throw "not implemented"; }
getElementsByTagName(element, name: string): HTMLElement[] { throw "not implemented"; }
classList(element): any[] { throw "not implemented"; }
addClass(element, className: string) { throw "not implemented"; }
removeClass(element, className: string) { throw "not implemented"; }
hasClass(element, className: string): boolean { throw "not implemented"; }
setStyle(element, styleName: string, styleValue: string) { throw "not implemented"; }
removeStyle(element, styleName: string) { throw "not implemented"; }
getStyle(element, styleName: string): string { throw "not implemented"; }
hasStyle(element, styleName: string, styleValue?: string): boolean { throw "not implemented"; }
tagName(element): string { throw "not implemented"; }
attributeMap(element): Map<string, string> { throw "not implemented"; }
hasAttribute(element, attribute: string): boolean { throw "not implemented"; }
hasAttributeNS(element, ns: string, attribute: string): boolean { throw "not implemented"; }
getAttribute(element, attribute: string): string { throw "not implemented"; }
getAttributeNS(element, ns: string, attribute: string): string { throw "not implemented"; }
setAttribute(element, name: string, value: string) { throw "not implemented"; }
setAttributeNS(element, ns: string, name: string, value: string) { throw "not implemented"; }
removeAttribute(element, attribute: string) { throw "not implemented"; }
removeAttributeNS(element, ns: string, attribute: string) { throw "not implemented"; }
templateAwareRoot(el) { throw "not implemented"; }
createHtmlDocument(): HTMLDocument { throw "not implemented"; }
defaultDoc(): HTMLDocument { throw "not implemented"; }
getBoundingClientRect(el) { throw "not implemented"; }
getTitle(): string { throw "not implemented"; }
setTitle(newTitle: string) { throw "not implemented"; }
elementMatches(n, selector: string): boolean { throw "not implemented"; }
isTemplateElement(el: any): boolean { throw "not implemented"; }
isTextNode(node): boolean { throw "not implemented"; }
isCommentNode(node): boolean { throw "not implemented"; }
isElementNode(node): boolean { throw "not implemented"; }
hasShadowRoot(node): boolean { throw "not implemented"; }
isShadowRoot(node): boolean { throw "not implemented"; }
importIntoDoc(node: Node): Node { throw "not implemented"; }
adoptNode(node: Node): Node { throw "not implemented"; }
getHref(element): string { throw "not implemented"; }
getEventKey(event): string { throw "not implemented"; }
resolveAndSetHref(element, baseUrl: string, href: string) { throw "not implemented"; }
supportsDOMEvents(): boolean { throw "not implemented"; }
supportsNativeShadowDOM(): boolean { throw "not implemented"; }
getGlobalEventTarget(target: string): any { throw "not implemented"; }
getHistory(): History { throw "not implemented"; }
getLocation(): Location { throw "not implemented"; }
getBaseHref(): string { throw "not implemented"; }
resetBaseElement(): void { throw "not implemented"; }
getUserAgent(): string { throw "not implemented"; }
setData(element, name: string, value: string) { throw "not implemented"; }
getComputedStyle(element): any { throw "not implemented"; }
getData(element, name: string): string { throw "not implemented"; }
setGlobalVar(name: string, value: any) { throw "not implemented"; }
requestAnimationFrame(callback): number { throw "not implemented"; }
cancelAnimationFrame(id) { throw "not implemented"; }
performanceNow(): number { throw "not implemented"; }
getAnimationPrefix(): string { throw "not implemented"; }
getTransitionEnd(): string { throw "not implemented"; }
supportsAnimation(): boolean { throw "not implemented"; }
}

View File

@ -10,7 +10,7 @@ import 'dart:isolate';
const OpaqueToken RENDER_SEND_PORT = const OpaqueToken("RenderSendPort");
const List<dynamic> WORKER_APP_APPLICATION = const [
const List<dynamic> WORKER_APP_APPLICATION_PROVIDERS = const [
WORKER_APP_APPLICATION_COMMON,
const Provider(MessageBus,
useFactory: createMessageBus, deps: const [NgZone, RENDER_SEND_PORT]),

View File

@ -1,15 +1,12 @@
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {Provider} from '@angular/core/src/di';
import {Parse5DomAdapter} from '@angular/platform-server';
import {APP_INITIALIZER, NgZone} from '@angular/core';
import {WorkerDomAdapter} from '../web_workers/worker/worker_adapter';
import {
PostMessageBus,
PostMessageBusSink,
PostMessageBusSource
} from '../web_workers/shared/post_message_bus';
import {WORKER_APP_APPLICATION_COMMON} from './worker_app_common';
import {APP_INITIALIZER} from '@angular/core';
import {WORKER_APP_APPLICATION_COMMON_PROVIDERS} from './worker_app_common';
import {MessageBus} from '../web_workers/shared/message_bus';
import {COMPILER_PROVIDERS} from '@angular/compiler/src/compiler';
// TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492)
let _postMessage = {
@ -18,9 +15,8 @@ let _postMessage = {
}
};
export const WORKER_APP_APPLICATION: Array<any /*Type | Provider | any[]*/> = [
WORKER_APP_APPLICATION_COMMON,
COMPILER_PROVIDERS,
export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
WORKER_APP_APPLICATION_COMMON_PROVIDERS,
/* @ts2dart_Provider */ {provide: MessageBus, useFactory: createMessageBus, deps: [NgZone]},
/* @ts2dart_Provider */ {provide: APP_INITIALIZER, useValue: setupWebWorker, multi: true}
];
@ -34,5 +30,5 @@ function createMessageBus(zone: NgZone): MessageBus {
}
function setupWebWorker(): void {
Parse5DomAdapter.makeCurrent();
WorkerDomAdapter.makeCurrent();
}

View File

@ -1,15 +1,13 @@
import {XHR} from '@angular/compiler';
import {WebWorkerXHRImpl} from '../web_workers/worker/xhr_impl';
import {WebWorkerRootRenderer} from '../web_workers/worker/renderer';
import {print} from '../../src/facade/lang';
import {RootRenderer} from '@angular/core/src/render/api';
import {
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
ExceptionHandler,
APPLICATION_COMMON_PROVIDERS,
PLATFORM_COMMON_PROVIDERS,
OpaqueToken
OpaqueToken,
RootRenderer
} from '@angular/core';
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from '@angular/common';
import {
@ -22,8 +20,8 @@ import {
} from '../web_workers/shared/service_message_broker';
import {Serializer} from '../web_workers/shared/serializer';
import {ON_WEB_WORKER} from '../web_workers/shared/api';
import {Provider} from '@angular/core/src/di';
import {RenderStore} from '../web_workers/shared/render_store';
import {BROWSER_SANITIZATION_PROVIDERS} from '../browser_common';
class PrintLogger {
log = print;
@ -35,17 +33,18 @@ class PrintLogger {
export const WORKER_APP_PLATFORM_MARKER =
/*@ts2dart_const*/ new OpaqueToken('WorkerAppPlatformMarker');
export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> =
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_const*/ (
/* @ts2dart_Provider */ {provide: WORKER_APP_PLATFORM_MARKER, useValue: true})
];
export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =
export const WORKER_APP_APPLICATION_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS,
BROWSER_SANITIZATION_PROVIDERS,
Serializer,
/* @ts2dart_Provider */ {provide: PLATFORM_PIPES, useValue: COMMON_PIPES, multi: true},
/* @ts2dart_Provider */ {provide: PLATFORM_DIRECTIVES, useValue: COMMON_DIRECTIVES, multi: true},
@ -55,9 +54,7 @@ export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*
/* @ts2dart_Provider */ {provide: RootRenderer, useExisting: WebWorkerRootRenderer},
/* @ts2dart_Provider */ {provide: ON_WEB_WORKER, useValue: true},
RenderStore,
/* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
WebWorkerXHRImpl,
/* @ts2dart_Provider */ {provide: XHR, useExisting: WebWorkerXHRImpl}
/* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []}
];
function _exceptionHandler(): ExceptionHandler {

View File

@ -2,7 +2,7 @@ library angular2.src.platform.worker_render;
import 'package:angular2/src/platform/worker_render_common.dart'
show
WORKER_RENDER_APPLICATION_COMMON,
WORKER_RENDER_APPLICATION_COMMON_PROVIDERS,
WORKER_RENDER_MESSAGING_PROVIDERS,
WORKER_SCRIPT,
initializeGenericWorkerRenderer;
@ -13,7 +13,7 @@ import 'package:angular2/src/core/di.dart';
import 'dart:isolate';
import 'dart:async';
const WORKER_RENDER_APP = WORKER_RENDER_APPLICATION_COMMON;
const WORKER_RENDER_APP_PROVIDERS = WORKER_RENDER_APPLICATION_COMMON_PROVIDERS;
Future<List> initIsolate(String scriptUri) async {
var instance = await spawnIsolate(Uri.parse(scriptUri));

View File

@ -4,15 +4,16 @@ import {
PostMessageBusSource
} from '../web_workers/shared/post_message_bus';
import {MessageBus} from '../web_workers/shared/message_bus';
import {APP_INITIALIZER} from '@angular/core';
import {Injector, Injectable, Provider} from '@angular/core/src/di';
import {Injector, Injectable, APP_INITIALIZER} from '@angular/core';
import {
WORKER_RENDER_APPLICATION_COMMON,
WORKER_RENDER_APPLICATION_COMMON_PROVIDERS,
WORKER_SCRIPT,
initializeGenericWorkerRenderer
} from './worker_render_common';
import {BaseException} from '../../src/facade/exceptions';
export {WORKER_RENDER_STARTABLE_MESSAGING_SERVICE} from './worker_render_common';
/**
* Wrapper class that exposes the Worker
* and underlying {@link MessageBus} for lower level message passing.
@ -32,8 +33,8 @@ export class WebWorkerInstance {
/**
* An array of providers that should be passed into `application()` when initializing a new Worker.
*/
export const WORKER_RENDER_APPLICATION: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
WORKER_RENDER_APPLICATION_COMMON, WebWorkerInstance,
export const WORKER_RENDER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
WORKER_RENDER_APPLICATION_COMMON_PROVIDERS, WebWorkerInstance,
/*@ts2dart_Provider*/ {
provide: APP_INITIALIZER,
useFactory: (injector => () => initWebWorkerApplication(injector)),

View File

@ -1,6 +1,7 @@
import {IS_DART} from '../../src/facade/lang';
import {MessageBus} from '../web_workers/shared/message_bus';
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {NgZone, Provider, Injector, OpaqueToken, Testability} from '@angular/core';
import {wtfInit} from '../../core_private';
import {
ExceptionHandler,
APPLICATION_COMMON_PROVIDERS,
@ -8,24 +9,17 @@ import {
RootRenderer,
PLATFORM_INITIALIZER
} from '@angular/core';
import {Provider, Injector, OpaqueToken} from '@angular/core/src/di';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_events';
import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_events';
import {HammerGesturesPlugin} from '@angular/platform-browser/src/dom/events/hammer_gestures';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {DomRootRenderer, DomRootRenderer_} from '@angular/platform-browser/src/dom/dom_renderer';
import {
DomSharedStylesHost,
SharedStylesHost
} from '@angular/platform-browser/src/dom/shared_styles_host';
import {getDOM} from '../dom/dom_adapter';
import {DomEventsPlugin} from '../dom/events/dom_events';
import {KeyEventsPlugin} from '../dom/events/key_events';
import {HammerGesturesPlugin} from '../dom/events/hammer_gestures';
import {DOCUMENT} from '../dom/dom_tokens';
import {DomRootRenderer, DomRootRenderer_} from '../dom/dom_renderer';
import {DomSharedStylesHost, SharedStylesHost} from '../dom/shared_styles_host';
import {BrowserDetails} from '../animate/browser_details';
import {AnimationBuilder} from '../animate/animation_builder';
import {Testability} from '@angular/core/src/testability/testability';
import {BrowserGetTestability} from '@angular/platform-browser/src/browser/testability';
import {BrowserGetTestability} from '../browser/testability';
import {BrowserDomAdapter} from '../browser/browser_adapter';
import {BROWSER_SANITIZATION_PROVIDERS} from '../browser_common';
import {wtfInit} from '@angular/core/src/profile/wtf_init';
import {MessageBasedRenderer} from '../web_workers/ui/renderer';
import {
ServiceMessageBrokerFactory,
@ -35,47 +29,38 @@ import {
ClientMessageBrokerFactory,
ClientMessageBrokerFactory_
} from '../web_workers/shared/client_message_broker';
import {
BrowserPlatformLocation
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
import {Serializer} from '../web_workers/shared/serializer';
import {ON_WEB_WORKER} from '../web_workers/shared/api';
import {RenderStore} from '../web_workers/shared/render_store';
import {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from '../dom/events/hammer_gestures';
import {SanitizationService} from '../../core_private';
import {DomSanitizationService} from '../security/dom_sanitization_service';
import {EventManager, EVENT_MANAGER_PLUGINS} from '../dom/events/event_manager';
import {XHR} from "../../../compiler/src/xhr";
import {XHRImpl} from "../../../platform-browser-dynamic/src/xhr/xhr_impl";
import {MessageBasedXHRImpl} from "../web_workers/ui/xhr_impl";
// TODO change these imports once dom_adapter is moved out of core
import {BROWSER_SANITIZATION_PROVIDERS} from '../browser_common';
export const WORKER_SCRIPT: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken("WebWorkerScript");
// Message based Worker classes that listen on the MessageBus
export const WORKER_RENDER_MESSAGING_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[MessageBasedRenderer, MessageBasedXHRImpl];
/**
* A multiple providers used to automatically call the `start()` method after the service is
* created.
*
* TODO(vicb): create an interface for startable services to implement
*/
export const WORKER_RENDER_STARTABLE_MESSAGING_SERVICE =
/*@ts2dart_const*/ new OpaqueToken('WorkerRenderStartableMsgService');
export const WORKER_RENDER_PLATFORM_MARKER =
/*@ts2dart_const*/ new OpaqueToken('WorkerRenderPlatformMarker');
export const WORKER_RENDER_PLATFORM: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
export const WORKER_RENDER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true}),
/* @ts2dart_Provider */ {provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true}
];
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
*/
export const WORKER_RENDER_ROUTER: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[BrowserPlatformLocation];
export const WORKER_RENDER_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =
export const WORKER_RENDER_APPLICATION_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
APPLICATION_COMMON_PROVIDERS,
WORKER_RENDER_MESSAGING_PROVIDERS,
MessageBasedRenderer,
/* @ts2dart_Provider */ {provide: WORKER_RENDER_STARTABLE_MESSAGING_SERVICE, useExisting: MessageBasedRenderer, multi: true},
BROWSER_SANITIZATION_PROVIDERS,
/* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
/* @ts2dart_Provider */ {provide: DOCUMENT, useFactory: _document, deps: []},
@ -88,8 +73,6 @@ export const WORKER_RENDER_APPLICATION_COMMON: Array<any /*Type | Provider | any
/* @ts2dart_Provider */ {provide: DomRootRenderer, useClass: DomRootRenderer_},
/* @ts2dart_Provider */ {provide: RootRenderer, useExisting: DomRootRenderer},
/* @ts2dart_Provider */ {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
/* @ts2dart_Provider */ {provide: XHR, useClass: XHRImpl},
MessageBasedXHRImpl,
/* @ts2dart_Provider */ {provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_},
/* @ts2dart_Provider */ {provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_},
Serializer,
@ -107,9 +90,9 @@ export function initializeGenericWorkerRenderer(injector: Injector) {
let zone = injector.get(NgZone);
bus.attachToZone(zone);
zone.runGuarded(() => {
WORKER_RENDER_MESSAGING_PROVIDERS.forEach((token) => { injector.get(token).start(); });
});
// initialize message services after the bus has been created
let services = injector.get(WORKER_RENDER_STARTABLE_MESSAGING_SERVICE);
zone.runGuarded(() => { services.forEach((svc) => { svc.start(); }); });
}
export function initWebWorkerRenderPlatform(): void {

View File

@ -8,18 +8,18 @@ import 'dart:isolate';
import 'dart:async';
export "package:angular2/src/platform/worker_app_common.dart"
show WORKER_APP_PLATFORM, WORKER_APP_APPLICATION_COMMON;
show WORKER_APP_PLATFORM_PROVIDERS, WORKER_APP_APPLICATION_COMMON_PROVIDERS;
export "package:angular2/src/core/angular_entrypoint.dart"
show AngularEntrypoint;
export "package:angular2/src/platform/worker_app.dart"
show WORKER_APP_APPLICATION, RENDER_SEND_PORT;
show WORKER_APP_APPLICATION_PROVIDERS, RENDER_SEND_PORT;
export 'package:angular2/src/web_workers/shared/client_message_broker.dart'
show ClientMessageBroker, ClientMessageBrokerFactory, FnArg, UiArguments;
export 'package:angular2/src/web_workers/shared/service_message_broker.dart'
show ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory;
export 'package:angular2/src/web_workers/shared/serializer.dart' show PRIMITIVE;
export 'package:angular2/src/web_workers/shared/message_bus.dart';
export 'package:angular2/src/web_workers/worker/router_providers.dart'
export 'package:angular2/src/web_workers/worker/location_providers.dart'
show WORKER_APP_ROUTER;
PlatformRef _platform = null;
@ -28,13 +28,13 @@ SendPort _renderSendPort = null;
PlatformRef workerAppPlatform(SendPort renderSendPort) {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate([
WORKER_APP_PLATFORM,
WORKER_APP_PLATFORM_PROVIDERS,
new Provider(RENDER_SEND_PORT, useValue: renderSendPort)
]));
}
var platform = assertPlatform(WORKER_APP_PLATFORM_MARKER);
if (platform.injector.get(RENDER_SEND_PORT, null) != renderSendPort) {
throw 'Platform has already been created with a different SendPort. Please distroy it first.';
throw 'Platform has already been created with a different SendPort. Please destroy it first.';
}
return platform;
}
@ -44,7 +44,7 @@ Future<ComponentRef<dynamic>> bootstrapApp(
Type appComponentType,
[List<dynamic /*Type | Provider | any[]*/> customProviders]) {
var appInjector = ReflectiveInjector.resolveAndCreate([
WORKER_APP_APPLICATION,
WORKER_APP_APPLICATION_PROVIDERS,
isPresent(customProviders) ? customProviders : []
], workerAppPlatform(renderSendPort).injector);
return coreLoadAndBootstrap(appInjector, appComponentType);

View File

@ -1,6 +1,9 @@
import {isPresent, isBlank} from './facade/lang';
import {WORKER_APP_PLATFORM, WORKER_APP_PLATFORM_MARKER} from './webworker/worker_app_common';
import {WORKER_APP_APPLICATION} from './webworker/worker_app';
import {
WORKER_APP_PLATFORM_PROVIDERS,
WORKER_APP_PLATFORM_MARKER
} from './webworker/worker_app_common';
import {WORKER_APP_APPLICATION_PROVIDERS} from './webworker/worker_app';
import {
PlatformRef,
Type,
@ -12,8 +15,11 @@ import {
assertPlatform
} from '@angular/core';
export {WORKER_APP_PLATFORM, WORKER_APP_APPLICATION_COMMON} from './webworker/worker_app_common';
export {WORKER_APP_APPLICATION} from './webworker/worker_app';
export {
WORKER_APP_PLATFORM_PROVIDERS,
WORKER_APP_APPLICATION_COMMON_PROVIDERS
} from './webworker/worker_app_common';
export {WORKER_APP_APPLICATION_PROVIDERS} from './webworker/worker_app';
export {
ClientMessageBroker,
ClientMessageBrokerFactory,
@ -27,20 +33,20 @@ export {
} from './web_workers/shared/service_message_broker';
export {PRIMITIVE} from './web_workers/shared/serializer';
export * from './web_workers/shared/message_bus';
export {WORKER_APP_ROUTER} from './web_workers/worker/router_providers';
export {WORKER_APP_LOCATION_PROVIDERS} from './web_workers/worker/location_providers';
export function workerAppPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_APP_PLATFORM));
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_APP_PLATFORM_PROVIDERS));
}
return assertPlatform(WORKER_APP_PLATFORM_MARKER);
}
export function bootstrapApp(
export function bootstrapStaticApp(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
var appInjector = ReflectiveInjector.resolveAndCreate(
[WORKER_APP_APPLICATION, isPresent(customProviders) ? customProviders : []],
[WORKER_APP_APPLICATION_PROVIDERS, isPresent(customProviders) ? customProviders : []],
workerAppPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}

View File

@ -24,19 +24,19 @@ export '../src/web_workers/shared/service_message_broker.dart'
export '../src/web_workers/shared/serializer.dart' show PRIMITIVE;
export '../src/web_workers/shared/message_bus.dart';
export '../src/web_workers/ui/router_providers.dart' show WORKER_RENDER_ROUTER;
export '../src/web_workers/ui/location_providers.dart' show WORKER_RENDER_ROUTER;
const WORKER_RENDER_APP = WORKER_RENDER_APPLICATION_COMMON;
PlatformRef workerRenderPlatform() {
PlatformRef workerStaticRenderPlatform() {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM));
}
return assertPlatform(WORKER_RENDER_PLATFORM_MARKER);
}
Future<ApplicationRef> bootstrapRender(
Future<ApplicationRef> bootstrapStaticRender(
String workerScriptUri,
[List<dynamic /*Type | Provider | any[]*/> customProviders]) {
return initIsolate(workerScriptUri).then( (appProviders) {

View File

@ -4,25 +4,28 @@ import {
ApplicationRef,
PlatformRef,
ReflectiveInjector,
Provider,
getPlatform,
createPlatform,
assertPlatform
} from '@angular/core';
import {WORKER_RENDER_APPLICATION} from './webworker/worker_render';
import {WORKER_RENDER_APPLICATION_PROVIDERS} from './webworker/worker_render';
import {
WORKER_SCRIPT,
WORKER_RENDER_PLATFORM,
WORKER_RENDER_PLATFORM_PROVIDERS,
WORKER_RENDER_PLATFORM_MARKER
} from './webworker/worker_render_common';
export {
WORKER_SCRIPT,
WORKER_RENDER_PLATFORM,
WORKER_RENDER_PLATFORM_PROVIDERS,
initializeGenericWorkerRenderer,
WORKER_RENDER_APPLICATION_COMMON
WORKER_RENDER_APPLICATION_COMMON_PROVIDERS
} from './webworker/worker_render_common';
export {WORKER_RENDER_APPLICATION, WebWorkerInstance} from './webworker/worker_render';
export {
WORKER_RENDER_APPLICATION_PROVIDERS,
WORKER_RENDER_STARTABLE_MESSAGING_SERVICE,
WebWorkerInstance
} from './webworker/worker_render';
export {
ClientMessageBroker,
ClientMessageBrokerFactory,
@ -37,26 +40,21 @@ export {
export {PRIMITIVE} from './web_workers/shared/serializer';
export * from './web_workers/shared/message_bus';
/**
* @deprecated Use WORKER_RENDER_APPLICATION
*/
export const WORKER_RENDER_APP = WORKER_RENDER_APPLICATION;
export {WORKER_RENDER_ROUTER} from '../src/web_workers/ui/router_providers';
export {WORKER_RENDER_LOCATION_PROVIDERS} from '../src/web_workers/ui/location_providers';
export function workerRenderPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM));
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM_PROVIDERS));
}
return assertPlatform(WORKER_RENDER_PLATFORM_MARKER);
}
export function bootstrapRender(
export function bootstrapStaticRender(
workerScriptUri: string,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ApplicationRef> {
var pf = ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM);
var app = ReflectiveInjector.resolveAndCreate(
[
WORKER_RENDER_APPLICATION,
WORKER_RENDER_APPLICATION_PROVIDERS,
/* @ts2dart_Provider */ {provide: WORKER_SCRIPT, useValue: workerScriptUri},
isPresent(customProviders) ? customProviders : []
],

View File

@ -1,4 +1,3 @@
export * from './testing/browser_util';
export * from './testing/browser_static';
export * from './testing/matchers';
export * from './testing/dom_test_component_renderer';

View File

@ -1,26 +1,14 @@
import {
APP_ID,
NgZone,
Provider,
PLATFORM_COMMON_PROVIDERS,
PLATFORM_INITIALIZER
} from '@angular/core';
import {DirectiveResolver, ViewResolver, XHR} from '@angular/compiler';
import {APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER} from '@angular/core';
import {BROWSER_APP_COMMON_PROVIDERS} from '../src/browser_common';
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
import {AnimationBuilder} from '../src/animate/animation_builder';
import {MockAnimationBuilder} from './animation_builder_mock';
import {MockDirectiveResolver} from '@angular/compiler/testing';
import {MockViewResolver} from '@angular/compiler/testing';
import {MockLocationStrategy} from '@angular/common/testing';
import {LocationStrategy} from '@angular/common';
import {MockNgZone} from '@angular/core/testing';
import {TestComponentBuilder} from '@angular/compiler/testing';
import {BrowserDetection} from './browser_util';
import {Log} from '@angular/core/testing';
import {ELEMENT_PROBE_PROVIDERS} from '../src/dom/debug/ng_probe';
import {TestComponentRenderer} from '@angular/compiler/testing';
import {DOMTestComponentRenderer} from './dom_test_component_renderer';
import {IS_DART} from '../src/facade/lang';
function initBrowserTests() {
@ -32,8 +20,6 @@ function createNgZone(): NgZone {
return IS_DART ? new MockNgZone() : new NgZone({enableLongStackTrace: true});
}
export {TestComponentRenderer} from '@angular/compiler/testing';
/**
* Default platform providers for testing without a compiler.
*/
@ -47,14 +33,10 @@ export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | an
/*@ts2dart_const*/[
/*@ts2dart_Provider*/ {provide: APP_ID, useValue: 'a'},
ELEMENT_PROBE_PROVIDERS,
/*@ts2dart_Provider*/ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
/*@ts2dart_Provider*/ {provide: ViewResolver, useClass: MockViewResolver},
Log,
TestComponentBuilder,
/*@ts2dart_Provider*/ {provide: NgZone, useFactory: createNgZone},
/*@ts2dart_Provider*/ {provide: LocationStrategy, useClass: MockLocationStrategy},
/*@ts2dart_Provider*/ {provide: AnimationBuilder, useClass: MockAnimationBuilder},
/*@ts2dart_Provider*/ {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer}
/*@ts2dart_Provider*/ {provide: AnimationBuilder, useClass: MockAnimationBuilder}
];
/**

View File

@ -45,7 +45,8 @@ export class BrowserDetection {
}
get isChromeDesktop(): boolean {
return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 && this._ua.indexOf('Edge') == -1;
return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&
this._ua.indexOf('Edge') == -1;
}
}

View File

@ -15,9 +15,7 @@
"@angular/core": ["../../../dist/packages-dist/core"],
"@angular/core/testing": ["../../../dist/packages-dist/core/testing"],
"@angular/common": ["../../../dist/packages-dist/common"],
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"],
"@angular/compiler": ["../../../dist/packages-dist/compiler"],
"@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"]
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"]
},
"rootDir": ".",
"sourceMap": true,

View File

@ -15,9 +15,7 @@
"@angular/core": ["../../../dist/packages-dist/core"],
"@angular/core/testing": ["../../../dist/packages-dist/core/testing"],
"@angular/common": ["../../../dist/packages-dist/common"],
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"],
"@angular/compiler": ["../../../dist/packages-dist/compiler"],
"@angular/compiler/testing": ["../../../dist/packages-dist/compiler/testing"]
"@angular/common/testing": ["../../../dist/packages-dist/common/testing"]
},
"rootDir": ".",
"sourceMap": true,

View File

@ -1,24 +0,0 @@
library angular2.dom.webWorkerAdapter;
import 'abstract_html_adapter.dart';
import 'package:angular2/platform/common_dom.dart';
class WebWorkerDomAdapter extends AbstractHtml5LibAdapter {
static void makeCurrent() {
setRootDomAdapter(new WebWorkerDomAdapter());
}
logError(error) {
print('${error}');
}
log(error) {
print('${error}');
}
logGroup(error) {
print('${error}');
}
logGroupEnd() {}
}

View File

@ -4,7 +4,6 @@ import {
PLATFORM_COMMON_PROVIDERS,
PLATFORM_INITIALIZER,
APPLICATION_COMMON_PROVIDERS,
Renderer,
} from '@angular/core';
import {DirectiveResolver, ViewResolver} from '@angular/compiler';
import {TestComponentBuilder} from '@angular/compiler/testing';
@ -36,7 +35,7 @@ import {
import {DomEventsPlugin} from '@angular/platform-browser';
import {LocationStrategy} from '@angular/common';
import {Log} from '@angular/core/testing';
import {DOMTestComponentRenderer} from '@angular/platform-browser/testing';
import {DOMTestComponentRenderer} from '@angular/platform-browser-dynamic/testing';
import {TestComponentRenderer} from '@angular/compiler/testing';
function initServerTests() {

View File

@ -1,6 +1,4 @@
import {ROUTER_PROVIDERS_COMMON} from './router_providers_common';
import {BrowserPlatformLocation} from '@angular/platform-browser';
import {PlatformLocation} from '@angular/common';
/**
* A list of {@link Provider}s. To use the router, you must add this to your application.
@ -24,7 +22,5 @@ import {PlatformLocation} from '@angular/common';
* bootstrap(AppCmp, [ROUTER_PROVIDERS]);
* ```
*/
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
ROUTER_PROVIDERS_COMMON,
/*@ts2dart_Provider*/ {provide: PlatformLocation, useClass: BrowserPlatformLocation},
];
// TODO: merge with router_providers_common.ts
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[ROUTER_PROVIDERS_COMMON];

View File

@ -1,4 +1,4 @@
import {OpaqueToken, ComponentResolver} from '@angular/core';
import {ComponentResolver} from '@angular/core';
import {LocationStrategy, PathLocationStrategy, Location} from '@angular/common';
import {Router, RouterOutletMap} from './router';
import {RouteSegment} from './segments';

View File

@ -11,8 +11,8 @@ import {
Type,
Testability
} from '@angular/core';
import {BROWSER_APP_DYNAMIC_PROVIDERS} from '@angular/platform-browser-dynamic';
import {browserPlatform} from '@angular/platform-browser';
import {BROWSER_APP_DYNAMIC_PROVIDERS} from '@angular/platform-browser-dynamic';
import {getComponentInfo, ComponentInfo} from './metadata';
import {onError, controllerKey} from './util';
import {

View File

@ -2,7 +2,7 @@
<h2 class="page-title">Drafts</h2>
<ol class="inbox-list">
<li *ngFor="#item of items" class="inbox-item-record">
<li *ngFor="let item of items" class="inbox-item-record">
<a id="item-{{ item.id }}"
[routerLink]="['/detail', item.id]">
{{ item.subject }}</a>

View File

@ -2,7 +2,7 @@
<h2 class="page-title">Inbox</h2>
<ol class="inbox-list">
<li *ngFor="#item of items" class="inbox-item-record">
<li *ngFor="let item of items" class="inbox-item-record">
<a id="item-{{ item.id }}"
[routerLink]="['/detail', item.id]">{{ item.subject }}</a>
</li>

View File

@ -2,7 +2,7 @@ import {InboxApp} from './app/inbox-app';
import {provide} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {ROUTER_PROVIDERS} from '@angular/router';
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
export function main() {
bootstrap(InboxApp,

View File

@ -8,12 +8,9 @@ declare var System: any;
writeScriptTag('/all/playground/vendor/long-stack-trace-zone.js');
writeScriptTag('/all/playground/vendor/system.src.js');
writeScriptTag('/all/playground/vendor/Reflect.js');
writeScriptTag('/all/playground/vendor/Rx.js', 'playgroundBootstrap()');
writeScriptTag('/all/playground/vendor/rxjs/bundles/Rx.js', 'playgroundBootstrap()');
global.playgroundBootstrap = playgroundBootstrap;
////////
function playgroundBootstrap() {
// check query param
var useBundles = location.search.indexOf('bundles=false') == -1;
@ -54,7 +51,8 @@ declare var System: any;
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
// 'rxjs': {
// defaultExtension: 'js'
// }

View File

@ -1,6 +1,6 @@
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Component} from '@angular/core';
import {KeyEventsPlugin} from '@angular/platform-browser/src/dom/events/key_events';
import {KeyEventsPlugin} from '@angular/platform-browser';
@Component({
selector: 'key-events-app',

View File

@ -0,0 +1,124 @@
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
;(function (exports) {
'use strict';
var Arr = (typeof Uint8Array !== 'undefined')
? Uint8Array
: Array
var PLUS = '+'.charCodeAt(0)
var SLASH = '/'.charCodeAt(0)
var NUMBER = '0'.charCodeAt(0)
var LOWER = 'a'.charCodeAt(0)
var UPPER = 'A'.charCodeAt(0)
var PLUS_URL_SAFE = '-'.charCodeAt(0)
var SLASH_URL_SAFE = '_'.charCodeAt(0)
function decode (elt) {
var code = elt.charCodeAt(0)
if (code === PLUS ||
code === PLUS_URL_SAFE)
return 62 // '+'
if (code === SLASH ||
code === SLASH_URL_SAFE)
return 63 // '/'
if (code < NUMBER)
return -1 //no match
if (code < NUMBER + 10)
return code - NUMBER + 26 + 26
if (code < UPPER + 26)
return code - UPPER
if (code < LOWER + 26)
return code - LOWER + 26
}
function b64ToByteArray (b64) {
var i, j, l, tmp, placeHolders, arr
if (b64.length % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
var len = b64.length
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
// base64 is 4/3 + up to two characters of the original data
arr = new Arr(b64.length * 3 / 4 - placeHolders)
// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? b64.length - 4 : b64.length
var L = 0
function push (v) {
arr[L++] = v
}
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
push((tmp & 0xFF0000) >> 16)
push((tmp & 0xFF00) >> 8)
push(tmp & 0xFF)
}
if (placeHolders === 2) {
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
push(tmp & 0xFF)
} else if (placeHolders === 1) {
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
push((tmp >> 8) & 0xFF)
push(tmp & 0xFF)
}
return arr
}
function uint8ToBase64 (uint8) {
var i,
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
output = "",
temp, length
function encode (num) {
return lookup.charAt(num)
}
function tripletToBase64 (num) {
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
}
// go through the array every three bytes, we'll deal with trailing stuff later
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
output += tripletToBase64(temp)
}
// pad the end with zeros, but make sure to not forget the extra bytes
switch (extraBytes) {
case 1:
temp = uint8[uint8.length - 1]
output += encode(temp >> 2)
output += encode((temp << 4) & 0x3F)
output += '=='
break
case 2:
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
output += encode(temp >> 10)
output += encode((temp >> 4) & 0x3F)
output += encode((temp << 2) & 0x3F)
output += '='
break
}
return output
}
exports.toByteArray = b64ToByteArray
exports.fromByteArray = uint8ToBase64
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))

View File

@ -1,5 +1,5 @@
import {ImageDemo} from './index_common';
import {bootstrapApp} from '../../../../@angular/platform-browser/src/worker_app';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapApp(ImageDemo);

View File

@ -1,6 +1,5 @@
import {Provider} from '@angular/core';
import {
bootstrapRender,
} from '../../../../@angular/platform-browser/src/worker_render';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
bootstrapRender("loader.js");
export function main() {
bootstrapRender("loader.js");
}

View File

@ -1,19 +1,38 @@
$SCRIPTS$
importScripts("b64.js");
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js",
"b64.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
}
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/images/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -1,5 +1,5 @@
import {InputCmp} from './index_common';
import {bootstrapApp} from '../../../../@angular/platform-browser/src/worker_app';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapApp(InputCmp);

View File

@ -1,4 +1,5 @@
import {Provider} from '@angular/core';
import {bootstrapRender} from '../../../../@angular/platform-browser/src/worker_render';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
bootstrapRender("loader.js");
export function main() {
bootstrapRender("loader.js");
}

View File

@ -1,17 +1,37 @@
$SCRIPTS$
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
}
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/input/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -1,5 +1,5 @@
import {HelloCmp} from './index_common';
import {bootstrapApp} from '../../../../@angular/platform-browser/src/worker_app';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapApp(HelloCmp);

View File

@ -1,4 +1,5 @@
import {Provider} from '@angular/core';
import {bootstrapRender} from '../../../../@angular/platform-browser/src/worker_render';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
bootstrapRender("loader.js");
export function main() {
bootstrapRender("loader.js");
}

View File

@ -1,17 +1,37 @@
$SCRIPTS$
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
},
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/kitchen_sink/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -1,4 +1,4 @@
import {bootstrapApp} from '../../../../@angular/platform-browser/src/worker_app';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
import {App} from './index_common';
export function main() {

View File

@ -1,15 +1,14 @@
import {Provider, ApplicationRef} from '@angular/core';
import {
bootstrapRender,
UiArguments,
FnArg,
PRIMITIVE,
ClientMessageBrokerFactory
} from '../../../../@angular/platform-browser/src/worker_render';
import {ApplicationRef} from '@angular/core';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
// TODO
import {UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser';
const ECHO_CHANNEL = "ECHO";
bootstrapRender("loader.js").then((ref) => afterBootstrap(ref));
export function main() {
bootstrapRender("loader.js").then((ref) => afterBootstrap(ref));
}
function afterBootstrap(ref: ApplicationRef) {
let brokerFactory: ClientMessageBrokerFactory = ref.injector.get(ClientMessageBrokerFactory);

View File

@ -1,7 +1,6 @@
import {PromiseWrapper} from '@angular/core/src/facade/async';
import {Component} from '@angular/core';
import {ServiceMessageBrokerFactory, PRIMITIVE} from '@angular/platform-browser/src/worker_app';
;
const ECHO_CHANNEL = "ECHO";

View File

@ -1,17 +1,37 @@
$SCRIPTS$
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
},
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/message_broker/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -1,12 +1,15 @@
import {Provider} from '@angular/core';
import {
bootstrapApp,
WORKER_APP_ROUTER
} from '../../../../@angular/platform-browser/src/worker_app';
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
import {WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {App} from './index_common';
export function main() {
bootstrapApp(App,
[WORKER_APP_ROUTER, {provide: LocationStrategy, useClass: HashLocationStrategy}]);
bootstrapApp(App, [
ROUTER_PROVIDERS,
WORKER_APP_LOCATION_PROVIDERS,
{provide: LocationStrategy, useClass: HashLocationStrategy}
]);
}

View File

@ -1,6 +1,7 @@
import {
bootstrapRender,
WORKER_RENDER_ROUTER
} from '../../../../@angular/platform-browser/src/worker_render';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
bootstrapRender("loader.js", WORKER_RENDER_ROUTER);
import {WORKER_RENDER_LOCATION_PROVIDERS} from '@angular/platform-browser';
export function main() {
bootstrapRender("loader.js", WORKER_RENDER_LOCATION_PROVIDERS);
}

View File

@ -1,17 +1,38 @@
$SCRIPTS$
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'@angular/router-deprecated': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
},
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/router/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -1,5 +1,5 @@
import {TodoApp} from './index_common';
import {bootstrapApp} from '../../../../@angular/platform-browser/src/worker_app';
import {bootstrapApp} from '@angular/platform-browser-dynamic';
export function main() {
bootstrapApp(TodoApp);

View File

@ -1,4 +1,5 @@
import {Provider} from '@angular/core';
import {bootstrapRender} from '../../../../@angular/platform-browser/src/worker_render';
import {bootstrapRender} from '@angular/platform-browser-dynamic';
bootstrapRender("loader.js");
export function main() {
bootstrapRender("loader.js");
}

View File

@ -1,17 +1,37 @@
$SCRIPTS$
importScripts("../../../vendor/es6-shim.js",
"../../../vendor/zone.js",
"../../../vendor/long-stack-trace-zone.js",
"../../../vendor/system.src.js",
"../../../vendor/Reflect.js");
System.config({
baseURL: '/',
baseURL: '/all',
map: {'rxjs': '/all/playground/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {
defaultExtension: 'js'
}
},
defaultJSExtensions: true
});
System.import("playground/src/web_workers/todo/background_index")
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });
.then(
function(m) {
try {
m.main();
} catch (e) {
console.error(e);
}
},
function(error) { console.error("error loading background", error); });

View File

@ -19,7 +19,6 @@ exports.config = {
'dist/all/**/e2e_test/**/*_spec.js'
],
exclude: [
'**/web_workers/**', // needs to be setup
'**/key_events/**', // can't tell why this is failing
'**/sourcemap/**' // fails only on travis
],

View File

@ -1241,7 +1241,7 @@ const BROWSER = [
'disableDebugTools():void',
'enableDebugTools(ref:ComponentRef<any>):void',
'inspectNativeElement(element:any):DebugNode',
'browserStaticPlatform():PlatformRef'
'browserPlatform():PlatformRef'
];
describe('public API', () => {