From 4fc37aeabda1969a50da4f390b22f3c68a94baa2 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 15 Jun 2016 08:25:31 -0700 Subject: [PATCH] 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 --- .../platform-browser-dynamic/index.ts | 10 +++++----- modules/@angular/platform-browser/index.ts | 2 +- .../src/web_workers/ui/location_providers.ts | 2 +- .../platform-browser/src/worker_render.ts | 20 ++++++++----------- .../web_workers/images/background_index.ts | 4 ++-- .../src/web_workers/images/index.ts | 4 ++-- .../src/web_workers/input/background_index.ts | 4 ++-- .../playground/src/web_workers/input/index.ts | 4 ++-- .../kitchen_sink/background_index.ts | 4 ++-- .../src/web_workers/kitchen_sink/index.ts | 4 ++-- .../message_broker/background_index.ts | 4 ++-- .../src/web_workers/message_broker/index.ts | 4 ++-- .../web_workers/router/background_index.ts | 4 ++-- .../src/web_workers/router/index.ts | 6 +++--- .../src/web_workers/todo/background_index.ts | 4 ++-- .../playground/src/web_workers/todo/index.ts | 4 ++-- tools/public_api_guard/public_api_spec.ts | 17 +++++++--------- 17 files changed, 47 insertions(+), 54 deletions(-) diff --git a/modules/@angular/platform-browser-dynamic/index.ts b/modules/@angular/platform-browser-dynamic/index.ts index 66c8b85072..c3b50ef37c 100644 --- a/modules/@angular/platform-browser-dynamic/index.ts +++ b/modules/@angular/platform-browser-dynamic/index.ts @@ -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): Promise { 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 = [ ]; -export function bootstrapApp( +export function bootstrapWorkerApp( appComponentType: Type, customProviders?: Array): Promise> { var appInjector = ReflectiveInjector.resolveAndCreate( diff --git a/modules/@angular/platform-browser/index.ts b/modules/@angular/platform-browser/index.ts index 18798255ad..b2447c3723 100644 --- a/modules/@angular/platform-browser/index.ts +++ b/modules/@angular/platform-browser/index.ts @@ -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'; diff --git a/modules/@angular/platform-browser/src/web_workers/ui/location_providers.ts b/modules/@angular/platform-browser/src/web_workers/ui/location_providers.ts index f9dbcab34e..af94aa61dd 100644 --- a/modules/@angular/platform-browser/src/web_workers/ui/location_providers.ts +++ b/modules/@angular/platform-browser/src/web_workers/ui/location_providers.ts @@ -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]} ]; diff --git a/modules/@angular/platform-browser/src/worker_render.ts b/modules/@angular/platform-browser/src/worker_render.ts index 70ef1ddbe3..33455206cc 100644 --- a/modules/@angular/platform-browser/src/worker_render.ts +++ b/modules/@angular/platform-browser/src/worker_render.ts @@ -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 = [ +export const WORKER_UI_PLATFORM_PROVIDERS: Array = [ PLATFORM_COMMON_PROVIDERS, {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true}, {provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true} ]; -export const WORKER_RENDER_APPLICATION_PROVIDERS: Array = [ +export const WORKER_UI_APPLICATION_PROVIDERS: Array = [ 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 { 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); } diff --git a/modules/playground/src/web_workers/images/background_index.ts b/modules/playground/src/web_workers/images/background_index.ts index c6d25f74c1..f8d749a040 100644 --- a/modules/playground/src/web_workers/images/background_index.ts +++ b/modules/playground/src/web_workers/images/background_index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/images/index.ts b/modules/playground/src/web_workers/images/index.ts index eec4c2a8ac..0bc9535fcb 100644 --- a/modules/playground/src/web_workers/images/index.ts +++ b/modules/playground/src/web_workers/images/index.ts @@ -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"); } diff --git a/modules/playground/src/web_workers/input/background_index.ts b/modules/playground/src/web_workers/input/background_index.ts index d2e16ec932..2f753f80fb 100644 --- a/modules/playground/src/web_workers/input/background_index.ts +++ b/modules/playground/src/web_workers/input/background_index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/input/index.ts b/modules/playground/src/web_workers/input/index.ts index eec4c2a8ac..0bc9535fcb 100644 --- a/modules/playground/src/web_workers/input/index.ts +++ b/modules/playground/src/web_workers/input/index.ts @@ -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"); } diff --git a/modules/playground/src/web_workers/kitchen_sink/background_index.ts b/modules/playground/src/web_workers/kitchen_sink/background_index.ts index e04f3476c8..5c1479be2d 100644 --- a/modules/playground/src/web_workers/kitchen_sink/background_index.ts +++ b/modules/playground/src/web_workers/kitchen_sink/background_index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/kitchen_sink/index.ts b/modules/playground/src/web_workers/kitchen_sink/index.ts index eec4c2a8ac..0bc9535fcb 100644 --- a/modules/playground/src/web_workers/kitchen_sink/index.ts +++ b/modules/playground/src/web_workers/kitchen_sink/index.ts @@ -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"); } diff --git a/modules/playground/src/web_workers/message_broker/background_index.ts b/modules/playground/src/web_workers/message_broker/background_index.ts index d499f5a3f6..2b142374fb 100644 --- a/modules/playground/src/web_workers/message_broker/background_index.ts +++ b/modules/playground/src/web_workers/message_broker/background_index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/message_broker/index.ts b/modules/playground/src/web_workers/message_broker/index.ts index 881162ec41..15443544a4 100644 --- a/modules/playground/src/web_workers/message_broker/index.ts +++ b/modules/playground/src/web_workers/message_broker/index.ts @@ -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) { diff --git a/modules/playground/src/web_workers/router/background_index.ts b/modules/playground/src/web_workers/router/background_index.ts index 7dea1f79a2..c6e21eb263 100644 --- a/modules/playground/src/web_workers/router/background_index.ts +++ b/modules/playground/src/web_workers/router/background_index.ts @@ -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} diff --git a/modules/playground/src/web_workers/router/index.ts b/modules/playground/src/web_workers/router/index.ts index 49e6b2267a..4db655cd7f 100644 --- a/modules/playground/src/web_workers/router/index.ts +++ b/modules/playground/src/web_workers/router/index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/todo/background_index.ts b/modules/playground/src/web_workers/todo/background_index.ts index 3540b38138..ba389e3ff1 100644 --- a/modules/playground/src/web_workers/todo/background_index.ts +++ b/modules/playground/src/web_workers/todo/background_index.ts @@ -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); } diff --git a/modules/playground/src/web_workers/todo/index.ts b/modules/playground/src/web_workers/todo/index.ts index eec4c2a8ac..0bc9535fcb 100644 --- a/modules/playground/src/web_workers/todo/index.ts +++ b/modules/playground/src/web_workers/todo/index.ts @@ -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"); } diff --git a/tools/public_api_guard/public_api_spec.ts b/tools/public_api_guard/public_api_spec.ts index 9436d51c37..9e961eaa14 100644 --- a/tools/public_api_guard/public_api_spec.ts +++ b/tools/public_api_guard/public_api_spec.ts @@ -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', 'const WORKER_APP_LOCATION_PROVIDERS:any', 'const WORKER_APP_PLATFORM_PROVIDERS:Array', - 'const WORKER_RENDER_APPLICATION_PROVIDERS:Array', - 'const WORKER_RENDER_LOCATION_PROVIDERS:any', - 'const WORKER_RENDER_PLATFORM_PROVIDERS:Array', - 'const WORKER_RENDER_STARTABLE_MESSAGING_SERVICE:any', 'const WORKER_SCRIPT:OpaqueToken', + 'const WORKER_UI_APPLICATION_PROVIDERS:Array', + 'const WORKER_UI_LOCATION_PROVIDERS:any', + 'const WORKER_UI_PLATFORM_PROVIDERS:Array', + '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):Promise>', - 'bootstrapApp(appComponentType:Type, customProviders?:Array):Promise>', - 'bootstrapRender(workerScriptUri:string, customProviders?:Array):Promise', + 'bootstrapWorkerApp(appComponentType:Type, customProviders?:Array):Promise>', + 'bootstrapWorkerUi(workerScriptUri:string, customProviders?:Array):Promise', 'const BROWSER_APP_COMPILER_PROVIDERS:Array', 'const CACHED_TEMPLATE_PROVIDER:Array', ];