
DEPRECATION: platform-webworker has been around since the initial release of Angular version 2. It began as an experiment to leverage Angular's rendering architecture and try something different: to run an entire web application in a web worker. We've learned a lot from this experiment, and have come to the conclusion that pushing entire applications to run in a web worker is not a recipe for success for most applications. This is due to a number of unresolved issues, including: * Poor or non-existent support for web worker APIs in web crawlers/indexers. * Poor support in build and bundling tooling. As a result, as of Angular version 8, we are deprecating the `platform-webworker` APIs in Angular. This consists of both NPM packages, `@angular/platform-webworker` and `@angular/platform-webworker-dynamic`. Going forward, we will focus our efforts related to web workers around their primary use case of offloading CPU-intensive but not critical work. FW-1339 #resolve PR Close #30642
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {PlatformRef, StaticProvider} from '@angular/core';
|
|
|
|
import {WORKER_SCRIPT, platformWorkerUi} from './worker_render';
|
|
|
|
export {VERSION} from './version';
|
|
export {ClientMessageBroker, ClientMessageBrokerFactory, FnArg, UiArguments} from './web_workers/shared/client_message_broker';
|
|
export {MessageBus, MessageBusSink, MessageBusSource} from './web_workers/shared/message_bus';
|
|
export {SerializerTypes} from './web_workers/shared/serializer';
|
|
export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from './web_workers/shared/service_message_broker';
|
|
export {WORKER_UI_LOCATION_PROVIDERS} from './web_workers/ui/location_providers';
|
|
export {WORKER_APP_LOCATION_PROVIDERS} from './web_workers/worker/location_providers';
|
|
export {WorkerAppModule, platformWorkerApp} from './worker_app';
|
|
export {platformWorkerUi} from './worker_render';
|
|
|
|
/**
|
|
* Bootstraps the worker ui.
|
|
*
|
|
* @publicApi
|
|
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
|
|
*/
|
|
export function bootstrapWorkerUi(
|
|
workerScriptUri: string, customProviders: StaticProvider[] = []): Promise<PlatformRef> {
|
|
// For now, just creates the worker ui platform...
|
|
const platform = platformWorkerUi([
|
|
{provide: WORKER_SCRIPT, useValue: workerScriptUri},
|
|
...customProviders,
|
|
]);
|
|
|
|
return Promise.resolve(platform);
|
|
}
|