Skip to content

Commit 361f181

Browse files
alxhubjasonaden
authored andcommitted
feat(platform-webworker): deprecate platform-webworker (#30642)
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
1 parent b408445 commit 361f181

File tree

15 files changed

+61
-0
lines changed

15 files changed

+61
-0
lines changed

aio/content/guide/deprecations.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
122122
| --- | ----------- | --------------------- | ----- |
123123
| [`preserveQueryParams`](api/router/NavigationExtras#preserveQueryParams) | [`queryParamsHandling`](api/router/NavigationExtras#queryParamsHandling) | v4 | none |
124124

125+
{@a platform-webworker}
126+
### @angular/platform-webworker
127+
128+
| API | Replacement | Deprecation announced | Notes |
129+
| --- | ----------- | --------------------- | ----- |
130+
| [All entry points](api/platform-webworker) | none | v8 | See [platform-webworker](#webworker-apps)|
131+
132+
{@a platform-webworker-dynamic}
133+
### @angular/platform-webworker-dynamic
134+
135+
| API | Replacement | Deprecation announced | Notes |
136+
| --- | ----------- | --------------------- | ----- |
137+
| [All entry points](api/platform-webworker-dynamic) | none | v8 | See [platform-webworker](#webworker-apps)|
125138

126139
{@a upgrade}
127140
### @angular/upgrade
@@ -380,6 +393,21 @@ Instead, use web workers primarily for offloading CPU intensive, but functionall
380393

381394

382395

396+
{@a webworker-apps}
397+
### platform-webworker Angular applications
398+
399+
400+
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.
401+
402+
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:
403+
404+
* Poor or non-existent support for web worker APIs in web crawlers/indexers.
405+
* Poor support in build and bundling tooling.
406+
407+
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`.
408+
409+
Going forward, we will focus our efforts related to web workers around their primary use case of offloading CPU-intensive but not critical work.
410+
383411
{@a removed}
384412
## Removed APIs
385413

packages/platform-webworker-dynamic/src/platform-webworker-dynamic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export {VERSION} from './version';
1616

1717
/**
1818
* @publicApi
19+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1920
*/
2021
export const platformWorkerAppDynamic =
2122
createPlatformFactory(platformCoreDynamic, 'workerAppDynamic', [

packages/platform-webworker-dynamic/src/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ import {Version} from '@angular/core';
1616

1717
/**
1818
* @publicApi
19+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1920
*/
2021
export const VERSION = new Version('0.0.0-PLACEHOLDER');

packages/platform-webworker/src/platform-webworker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export {platformWorkerUi} from './worker_render';
2424
* Bootstraps the worker ui.
2525
*
2626
* @publicApi
27+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
2728
*/
2829
export function bootstrapWorkerUi(
2930
workerScriptUri: string, customProviders: StaticProvider[] = []): Promise<PlatformRef> {

packages/platform-webworker/src/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ import {Version} from '@angular/core';
1616

1717
/**
1818
* @publicApi
19+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1920
*/
2021
export const VERSION = new Version('0.0.0-PLACEHOLDER');

packages/platform-webworker/src/web_workers/shared/client_message_broker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {Serializer, SerializerTypes} from './serializer';
1212

1313
/**
1414
* @publicApi
15+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1516
*/
1617
@Injectable()
1718
export class ClientMessageBrokerFactory {
@@ -39,6 +40,7 @@ interface PromiseCompleter {
3940

4041
/**
4142
* @publicApi
43+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
4244
*/
4345
export class ClientMessageBroker {
4446
private _pending = new Map<string, PromiseCompleter>();

packages/platform-webworker/src/web_workers/shared/message_bus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {EventEmitter, NgZone} from '@angular/core';
1717
* by the corresponding MessageBusSource.
1818
*
1919
* @publicApi
20+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
2021
*/
2122
export abstract class MessageBus implements MessageBusSource, MessageBusSink {
2223
/**

packages/platform-webworker/src/web_workers/shared/serializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {RenderStore} from './render_store';
1212

1313
/**
1414
* @publicApi
15+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1516
*/
1617
export const enum SerializerTypes {
1718
// RendererType2

packages/platform-webworker/src/web_workers/shared/service_message_broker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {Serializer, SerializerTypes} from '../shared/serializer';
1313

1414
/**
1515
* @publicApi
16+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
1617
*/
1718
@Injectable()
1819
export class ServiceMessageBrokerFactory {
@@ -40,6 +41,7 @@ export class ServiceMessageBrokerFactory {
4041
* If that method returns a promise, the UIMessageBroker returns the result to the worker.
4142
*
4243
* @publicApi
44+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
4345
*/
4446
export class ServiceMessageBroker {
4547
private _sink: EventEmitter<any>;
@@ -91,6 +93,7 @@ export class ServiceMessageBroker {
9193

9294
/**
9395
* @publicApi
96+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
9497
*/
9598
export interface ReceivedMessage {
9699
method: string;

packages/platform-webworker/src/web_workers/ui/location_providers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {MessageBasedPlatformLocation} from './platform_location';
2222
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
2323
* include these providers when setting up the render thread.
2424
* @publicApi
25+
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
2526
*/
2627
export const WORKER_UI_LOCATION_PROVIDERS = <StaticProvider[]>[
2728
{provide: MessageBasedPlatformLocation, deps: [ServiceMessageBrokerFactory,

0 commit comments

Comments
 (0)