fix(webworkers): rename all web worker apis with "render" to "ui"
"render" is gramatically incorrect and confusing to developers who used this api. Since webworker apis were exposed only in master, renaming these before the rc2 release is not a breaking change
This commit is contained in:
parent
2fd1e88199
commit
4fc37aeabd
|
@ -1,7 +1,7 @@
|
|||
import {COMMON_DIRECTIVES, COMMON_PIPES} from '@angular/common';
|
||||
import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler';
|
||||
import {ApplicationRef, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES, ReflectiveInjector, Type, coreLoadAndBootstrap} from '@angular/core';
|
||||
import {BROWSER_APP_PROVIDERS, WORKER_APP_APPLICATION_PROVIDERS, WORKER_RENDER_APPLICATION_PROVIDERS, WORKER_SCRIPT, browserPlatform, workerAppPlatform, workerRenderPlatform} from '@angular/platform-browser';
|
||||
import {BROWSER_APP_PROVIDERS, WORKER_APP_APPLICATION_PROVIDERS, WORKER_SCRIPT, WORKER_UI_APPLICATION_PROVIDERS, browserPlatform, workerAppPlatform, workerUiPlatform} from '@angular/platform-browser';
|
||||
|
||||
import {ReflectionCapabilities, reflector} from './core_private';
|
||||
import {PromiseWrapper} from './src/facade/async';
|
||||
|
@ -110,16 +110,16 @@ export function bootstrap(
|
|||
}
|
||||
|
||||
|
||||
export function bootstrapRender(
|
||||
export function bootstrapWorkerUi(
|
||||
workerScriptUri: string,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ApplicationRef> {
|
||||
var app = ReflectiveInjector.resolveAndCreate(
|
||||
[
|
||||
WORKER_RENDER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,
|
||||
WORKER_UI_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,
|
||||
{provide: WORKER_SCRIPT, useValue: workerScriptUri},
|
||||
isPresent(customProviders) ? customProviders : []
|
||||
],
|
||||
workerRenderPlatform().injector);
|
||||
workerUiPlatform().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...
|
||||
|
@ -141,7 +141,7 @@ const WORKER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
|||
];
|
||||
|
||||
|
||||
export function bootstrapApp(
|
||||
export function bootstrapWorkerApp(
|
||||
appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
|
||||
var appInjector = ReflectiveInjector.resolveAndCreate(
|
||||
|
|
|
@ -18,7 +18,7 @@ export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from
|
|||
export {PRIMITIVE} from './src/web_workers/shared/serializer';
|
||||
export * from './src/web_workers/shared/message_bus';
|
||||
export {WORKER_APP_LOCATION_PROVIDERS} from './src/web_workers/worker/location_providers';
|
||||
export {WORKER_RENDER_LOCATION_PROVIDERS} from './src/web_workers/ui/location_providers';
|
||||
export {WORKER_UI_LOCATION_PROVIDERS} from './src/web_workers/ui/location_providers';
|
||||
|
||||
export * from './src/worker_render';
|
||||
export * from './src/worker_app';
|
||||
|
|
|
@ -9,7 +9,7 @@ import {MessageBasedPlatformLocation} from './platform_location';
|
|||
* 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 = [
|
||||
export const WORKER_UI_LOCATION_PROVIDERS = [
|
||||
MessageBasedPlatformLocation, BrowserPlatformLocation,
|
||||
{provide: APP_INITIALIZER, useFactory: initUiLocation, multi: true, deps: [Injector]}
|
||||
];
|
||||
|
|
|
@ -50,22 +50,18 @@ export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
|
|||
*
|
||||
* TODO(vicb): create an interface for startable services to implement
|
||||
*/
|
||||
export const WORKER_RENDER_STARTABLE_MESSAGING_SERVICE =
|
||||
export const WORKER_UI_STARTABLE_MESSAGING_SERVICE =
|
||||
new OpaqueToken('WorkerRenderStartableMsgService');
|
||||
|
||||
export const WORKER_RENDER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
PLATFORM_COMMON_PROVIDERS, {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true},
|
||||
{provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true}
|
||||
];
|
||||
|
||||
export const WORKER_RENDER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
MessageBasedRenderer,
|
||||
{
|
||||
provide: WORKER_RENDER_STARTABLE_MESSAGING_SERVICE,
|
||||
useExisting: MessageBasedRenderer,
|
||||
multi: true
|
||||
},
|
||||
{provide: WORKER_UI_STARTABLE_MESSAGING_SERVICE, useExisting: MessageBasedRenderer, multi: true},
|
||||
BROWSER_SANITIZATION_PROVIDERS,
|
||||
{provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
|
||||
{provide: DOCUMENT, useFactory: _document, deps: []},
|
||||
|
@ -92,13 +88,13 @@ export const WORKER_RENDER_APPLICATION_PROVIDERS: Array<any /*Type | Provider |
|
|||
{provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance]}
|
||||
];
|
||||
|
||||
export function initializeGenericWorkerRenderer(injector: Injector) {
|
||||
function initializeGenericWorkerRenderer(injector: Injector) {
|
||||
var bus = injector.get(MessageBus);
|
||||
let zone = injector.get(NgZone);
|
||||
bus.attachToZone(zone);
|
||||
|
||||
// initialize message services after the bus has been created
|
||||
let services = injector.get(WORKER_RENDER_STARTABLE_MESSAGING_SERVICE);
|
||||
let services = injector.get(WORKER_UI_STARTABLE_MESSAGING_SERVICE);
|
||||
zone.runGuarded(() => { services.forEach((svc: any /** TODO #9100 */) => { svc.start(); }); });
|
||||
}
|
||||
|
||||
|
@ -112,9 +108,9 @@ function initWebWorkerRenderPlatform(): void {
|
|||
BrowserGetTestability.init();
|
||||
}
|
||||
|
||||
export function workerRenderPlatform(): PlatformRef {
|
||||
export function workerUiPlatform(): PlatformRef {
|
||||
if (isBlank(getPlatform())) {
|
||||
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM_PROVIDERS));
|
||||
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_UI_PLATFORM_PROVIDERS));
|
||||
}
|
||||
return assertPlatform(WORKER_RENDER_PLATFORM_MARKER);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {ImageDemo} from './index_common';
|
||||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(ImageDemo);
|
||||
bootstrapWorkerApp(ImageDemo);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrapRender} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js");
|
||||
bootstrapWorkerUi("loader.js");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {InputCmp} from './index_common';
|
||||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(InputCmp);
|
||||
bootstrapWorkerApp(InputCmp);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrapRender} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js");
|
||||
bootstrapWorkerUi("loader.js");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {HelloCmp} from './index_common';
|
||||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(HelloCmp);
|
||||
bootstrapWorkerApp(HelloCmp);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrapRender} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js");
|
||||
bootstrapWorkerUi("loader.js");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
import {App} from './index_common';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(App);
|
||||
bootstrapWorkerApp(App);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import {ApplicationRef} from '@angular/core';
|
||||
import {UiArguments, FnArg, PRIMITIVE, ClientMessageBrokerFactory} from '@angular/platform-browser';
|
||||
import {bootstrapRender} from "@angular/platform-browser-dynamic";
|
||||
import {bootstrapWorkerUi} from "@angular/platform-browser-dynamic";
|
||||
|
||||
const ECHO_CHANNEL = "ECHO";
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js").then((ref) => afterBootstrap(ref));
|
||||
bootstrapWorkerUi("loader.js").then((ref) => afterBootstrap(ref));
|
||||
}
|
||||
|
||||
function afterBootstrap(ref: ApplicationRef) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
|
||||
import {WORKER_APP_LOCATION_PROVIDERS} from '@angular/platform-browser';
|
||||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
|
||||
import {App} from './index_common';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(App, [
|
||||
bootstrapWorkerApp(App, [
|
||||
ROUTER_PROVIDERS,
|
||||
WORKER_APP_LOCATION_PROVIDERS,
|
||||
{provide: LocationStrategy, useClass: HashLocationStrategy}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {WORKER_RENDER_LOCATION_PROVIDERS} from '@angular/platform-browser';
|
||||
import {bootstrapRender} from "@angular/platform-browser-dynamic";
|
||||
import {WORKER_UI_LOCATION_PROVIDERS} from '@angular/platform-browser';
|
||||
import {bootstrapWorkerUi} from "@angular/platform-browser-dynamic";
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js", WORKER_RENDER_LOCATION_PROVIDERS);
|
||||
bootstrapWorkerUi("loader.js", WORKER_UI_LOCATION_PROVIDERS);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {TodoApp} from './index_common';
|
||||
import {bootstrapApp} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapApp(TodoApp);
|
||||
bootstrapWorkerApp(TodoApp);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrapRender} from '@angular/platform-browser-dynamic';
|
||||
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
|
||||
|
||||
export function main() {
|
||||
bootstrapRender("loader.js");
|
||||
bootstrapWorkerUi("loader.js");
|
||||
}
|
||||
|
|
|
@ -1051,8 +1051,6 @@ const COMMON = [
|
|||
'Validators.nullValidator(c:AbstractControl):{[key:string]:boolean}',
|
||||
'Validators.pattern(pattern:string):ValidatorFn',
|
||||
'Validators.required(control:AbstractControl):{[key:string]:boolean}',
|
||||
// TODO: rename to LocationChangeEvent
|
||||
// TODO: rename to LocationChangeListener
|
||||
];
|
||||
|
||||
const COMMON_TESTING = [
|
||||
|
@ -1520,11 +1518,11 @@ const PLATFORM_BROWSER = [
|
|||
'const WORKER_APP_APPLICATION_PROVIDERS:Array<any>',
|
||||
'const WORKER_APP_LOCATION_PROVIDERS:any',
|
||||
'const WORKER_APP_PLATFORM_PROVIDERS:Array<any>',
|
||||
'const WORKER_RENDER_APPLICATION_PROVIDERS:Array<any>',
|
||||
'const WORKER_RENDER_LOCATION_PROVIDERS:any',
|
||||
'const WORKER_RENDER_PLATFORM_PROVIDERS:Array<any>',
|
||||
'const WORKER_RENDER_STARTABLE_MESSAGING_SERVICE:any',
|
||||
'const WORKER_SCRIPT:OpaqueToken',
|
||||
'const WORKER_UI_APPLICATION_PROVIDERS:Array<any>',
|
||||
'const WORKER_UI_LOCATION_PROVIDERS:any',
|
||||
'const WORKER_UI_PLATFORM_PROVIDERS:Array<any>',
|
||||
'const WORKER_UI_STARTABLE_MESSAGING_SERVICE:any',
|
||||
'disableDebugTools():void',
|
||||
'DomEventsPlugin',
|
||||
'DomEventsPlugin.addEventListener(element:HTMLElement, eventName:string, handler:Function):Function',
|
||||
|
@ -1551,7 +1549,6 @@ const PLATFORM_BROWSER = [
|
|||
'HammerGestureConfig.buildHammer(element:HTMLElement):HammerInstance',
|
||||
'HammerGestureConfig.events:string[]',
|
||||
'HammerGestureConfig.overrides:{[key:string]:Object}',
|
||||
'initializeGenericWorkerRenderer(injector:Injector):any',
|
||||
'KeyEventsPlugin',
|
||||
'KeyEventsPlugin.addEventListener(element:HTMLElement, eventName:string, handler:Function):Function',
|
||||
'KeyEventsPlugin.constructor()',
|
||||
|
@ -1601,7 +1598,7 @@ const PLATFORM_BROWSER = [
|
|||
'WebWorkerInstance.init(worker:Worker, bus:MessageBus):any',
|
||||
'WebWorkerInstance.worker:Worker',
|
||||
'workerAppPlatform():PlatformRef',
|
||||
'workerRenderPlatform():PlatformRef',
|
||||
'workerUiPlatform():PlatformRef',
|
||||
];
|
||||
|
||||
const PLATFORM_BROWSER_TESTING = [
|
||||
|
@ -1648,8 +1645,8 @@ const PLATFORM_BROWSER_TESTING_E2E = [
|
|||
|
||||
const PLATFORM_BROWSER_DYNAMIC = [
|
||||
'bootstrap(appComponentType:Type, customProviders?:Array<any>):Promise<ComponentRef<any>>',
|
||||
'bootstrapApp(appComponentType:Type, customProviders?:Array<any>):Promise<ComponentRef<any>>',
|
||||
'bootstrapRender(workerScriptUri:string, customProviders?:Array<any>):Promise<ApplicationRef>',
|
||||
'bootstrapWorkerApp(appComponentType:Type, customProviders?:Array<any>):Promise<ComponentRef<any>>',
|
||||
'bootstrapWorkerUi(workerScriptUri:string, customProviders?:Array<any>):Promise<ApplicationRef>',
|
||||
'const BROWSER_APP_COMPILER_PROVIDERS:Array<any>',
|
||||
'const CACHED_TEMPLATE_PROVIDER:Array<any>',
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue