Skip to content

Commit 4fc37ae

Browse files
committed
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
1 parent 2fd1e88 commit 4fc37ae

File tree

17 files changed

+47
-54
lines changed

17 files changed

+47
-54
lines changed

modules/@angular/platform-browser-dynamic/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {COMMON_DIRECTIVES, COMMON_PIPES} from '@angular/common';
22
import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler';
33
import {ApplicationRef, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES, ReflectiveInjector, Type, coreLoadAndBootstrap} from '@angular/core';
4-
import {BROWSER_APP_PROVIDERS, WORKER_APP_APPLICATION_PROVIDERS, WORKER_RENDER_APPLICATION_PROVIDERS, WORKER_SCRIPT, browserPlatform, workerAppPlatform, workerRenderPlatform} from '@angular/platform-browser';
4+
import {BROWSER_APP_PROVIDERS, WORKER_APP_APPLICATION_PROVIDERS, WORKER_SCRIPT, WORKER_UI_APPLICATION_PROVIDERS, browserPlatform, workerAppPlatform, workerUiPlatform} from '@angular/platform-browser';
55

66
import {ReflectionCapabilities, reflector} from './core_private';
77
import {PromiseWrapper} from './src/facade/async';
@@ -110,16 +110,16 @@ export function bootstrap(
110110
}
111111

112112

113-
export function bootstrapRender(
113+
export function bootstrapWorkerUi(
114114
workerScriptUri: string,
115115
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ApplicationRef> {
116116
var app = ReflectiveInjector.resolveAndCreate(
117117
[
118-
WORKER_RENDER_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,
118+
WORKER_UI_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,
119119
{provide: WORKER_SCRIPT, useValue: workerScriptUri},
120120
isPresent(customProviders) ? customProviders : []
121121
],
122-
workerRenderPlatform().injector);
122+
workerUiPlatform().injector);
123123
// Return a promise so that we keep the same semantics as Dart,
124124
// and we might want to wait for the app side to come up
125125
// in the future...
@@ -141,7 +141,7 @@ const WORKER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
141141
];
142142

143143

144-
export function bootstrapApp(
144+
export function bootstrapWorkerApp(
145145
appComponentType: Type,
146146
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
147147
var appInjector = ReflectiveInjector.resolveAndCreate(

modules/@angular/platform-browser/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from
1818
export {PRIMITIVE} from './src/web_workers/shared/serializer';
1919
export * from './src/web_workers/shared/message_bus';
2020
export {WORKER_APP_LOCATION_PROVIDERS} from './src/web_workers/worker/location_providers';
21-
export {WORKER_RENDER_LOCATION_PROVIDERS} from './src/web_workers/ui/location_providers';
21+
export {WORKER_UI_LOCATION_PROVIDERS} from './src/web_workers/ui/location_providers';
2222

2323
export * from './src/worker_render';
2424
export * from './src/worker_app';

modules/@angular/platform-browser/src/web_workers/ui/location_providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {MessageBasedPlatformLocation} from './platform_location';
99
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
1010
* include these providers when setting up the render thread.
1111
*/
12-
export const WORKER_RENDER_LOCATION_PROVIDERS = [
12+
export const WORKER_UI_LOCATION_PROVIDERS = [
1313
MessageBasedPlatformLocation, BrowserPlatformLocation,
1414
{provide: APP_INITIALIZER, useFactory: initUiLocation, multi: true, deps: [Injector]}
1515
];

modules/@angular/platform-browser/src/worker_render.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,18 @@ export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
5050
*
5151
* TODO(vicb): create an interface for startable services to implement
5252
*/
53-
export const WORKER_RENDER_STARTABLE_MESSAGING_SERVICE =
53+
export const WORKER_UI_STARTABLE_MESSAGING_SERVICE =
5454
new OpaqueToken('WorkerRenderStartableMsgService');
5555

56-
export const WORKER_RENDER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
56+
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
5757
PLATFORM_COMMON_PROVIDERS, {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true},
5858
{provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true}
5959
];
6060

61-
export const WORKER_RENDER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
61+
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
6262
APPLICATION_COMMON_PROVIDERS,
6363
MessageBasedRenderer,
64-
{
65-
provide: WORKER_RENDER_STARTABLE_MESSAGING_SERVICE,
66-
useExisting: MessageBasedRenderer,
67-
multi: true
68-
},
64+
{provide: WORKER_UI_STARTABLE_MESSAGING_SERVICE, useExisting: MessageBasedRenderer, multi: true},
6965
BROWSER_SANITIZATION_PROVIDERS,
7066
{provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
7167
{provide: DOCUMENT, useFactory: _document, deps: []},
@@ -92,13 +88,13 @@ export const WORKER_RENDER_APPLICATION_PROVIDERS: Array<any /*Type | Provider |
9288
{provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance]}
9389
];
9490

95-
export function initializeGenericWorkerRenderer(injector: Injector) {
91+
function initializeGenericWorkerRenderer(injector: Injector) {
9692
var bus = injector.get(MessageBus);
9793
let zone = injector.get(NgZone);
9894
bus.attachToZone(zone);
9995

10096
// initialize message services after the bus has been created
101-
let services = injector.get(WORKER_RENDER_STARTABLE_MESSAGING_SERVICE);
97+
let services = injector.get(WORKER_UI_STARTABLE_MESSAGING_SERVICE);
10298
zone.runGuarded(() => { services.forEach((svc: any /** TODO #9100 */) => { svc.start(); }); });
10399
}
104100

@@ -112,9 +108,9 @@ function initWebWorkerRenderPlatform(): void {
112108
BrowserGetTestability.init();
113109
}
114110

115-
export function workerRenderPlatform(): PlatformRef {
111+
export function workerUiPlatform(): PlatformRef {
116112
if (isBlank(getPlatform())) {
117-
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_RENDER_PLATFORM_PROVIDERS));
113+
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_UI_PLATFORM_PROVIDERS));
118114
}
119115
return assertPlatform(WORKER_RENDER_PLATFORM_MARKER);
120116
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ImageDemo} from './index_common';
2-
import {bootstrapApp} from '@angular/platform-browser-dynamic';
2+
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
33

44
export function main() {
5-
bootstrapApp(ImageDemo);
5+
bootstrapWorkerApp(ImageDemo);
66
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {bootstrapRender} from '@angular/platform-browser-dynamic';
1+
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
22

33
export function main() {
4-
bootstrapRender("loader.js");
4+
bootstrapWorkerUi("loader.js");
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {InputCmp} from './index_common';
2-
import {bootstrapApp} from '@angular/platform-browser-dynamic';
2+
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
33

44
export function main() {
5-
bootstrapApp(InputCmp);
5+
bootstrapWorkerApp(InputCmp);
66
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {bootstrapRender} from '@angular/platform-browser-dynamic';
1+
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
22

33
export function main() {
4-
bootstrapRender("loader.js");
4+
bootstrapWorkerUi("loader.js");
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {HelloCmp} from './index_common';
2-
import {bootstrapApp} from '@angular/platform-browser-dynamic';
2+
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
33

44
export function main() {
5-
bootstrapApp(HelloCmp);
5+
bootstrapWorkerApp(HelloCmp);
66
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {bootstrapRender} from '@angular/platform-browser-dynamic';
1+
import {bootstrapWorkerUi} from '@angular/platform-browser-dynamic';
22

33
export function main() {
4-
bootstrapRender("loader.js");
4+
bootstrapWorkerUi("loader.js");
55
}

0 commit comments

Comments
 (0)