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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user