This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
platform-webworker.d.ts
executable file
·367 lines (333 loc) · 13.3 KB
/
platform-webworker.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/**
* @license Angular v11.0.0-next.3+78.sha-1b70dc9
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
import { ErrorHandler } from '@angular/core';
import { EventEmitter } from '@angular/core';
import { InjectionToken } from '@angular/core';
import { LocationChangeListener } from '@angular/common';
import { NgZone } from '@angular/core';
import { PlatformLocation } from '@angular/common';
import { PlatformRef } from '@angular/core';
import { Renderer2 } from '@angular/core';
import { RendererFactory2 } from '@angular/core';
import { RendererType2 } from '@angular/core';
import { StaticProvider } from '@angular/core';
import { Type } from '@angular/core';
import { Version } from '@angular/core';
/**
* Bootstraps the worker ui.
*
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: StaticProvider[]): Promise<PlatformRef>;
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class ClientMessageBroker {
private channel;
private _pending;
private _sink;
private _generateMessageId;
runOnService(args: UiArguments, returnType: Type<any> | SerializerTypes | null): Promise<any> | null;
private _handleMessage;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class ClientMessageBrokerFactory {
private _messageBus;
/**
* Initializes the given channel and attaches a new {@link ClientMessageBroker} to it.
*/
createMessageBroker(channel: string, runInZone?: boolean): ClientMessageBroker;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class FnArg {
value: any;
type: Type<any> | SerializerTypes;
constructor(value: any, type?: Type<any> | SerializerTypes);
}
/**
* Message Bus is a low level API used to communicate between the UI and the background.
* Communication is based on a channel abstraction. Messages published in a
* given channel to one MessageBusSink are received on the same channel
* by the corresponding MessageBusSource.
*
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare abstract class MessageBus implements MessageBusSource, MessageBusSink {
/**
* Sets up a new channel on the MessageBus.
* MUST be called before calling from or to on the channel.
* If runInZone is true then the source will emit events inside the angular zone
* and the sink will buffer messages and send only once the zone exits.
* if runInZone is false then the source will emit events inside the global zone
* and the sink will send messages immediately.
*/
abstract initChannel(channel: string, runInZone?: boolean): void;
/**
* Assigns this bus to the given zone.
* Any callbacks attached to channels where runInZone was set to true on initialization
* will be executed in the given zone.
*/
abstract attachToZone(zone: NgZone): void;
/**
* Returns an {@link EventEmitter} that emits every time a message
* is received on the given channel.
*/
abstract from(channel: string): EventEmitter<any>;
/**
* Returns an {@link EventEmitter} for the given channel
* To publish methods to that channel just call next on the returned emitter
*/
abstract to(channel: string): EventEmitter<any>;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare interface MessageBusSink {
/**
* Sets up a new channel on the MessageBusSink.
* MUST be called before calling to on the channel.
* If runInZone is true the sink will buffer messages and send only once the zone exits.
* if runInZone is false the sink will send messages immediately.
*/
initChannel(channel: string, runInZone: boolean): void;
/**
* Assigns this sink to the given zone.
* Any channels which are initialized with runInZone set to true will wait for the given zone
* to exit before sending messages.
*/
attachToZone(zone: NgZone): void;
/**
* Returns an {@link EventEmitter} for the given channel
* To publish methods to that channel just call next on the returned emitter
*/
to(channel: string): EventEmitter<any>;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare interface MessageBusSource {
/**
* Sets up a new channel on the MessageBusSource.
* MUST be called before calling from on the channel.
* If runInZone is true then the source will emit events inside the angular zone.
* if runInZone is false then the source will emit events inside the global zone.
*/
initChannel(channel: string, runInZone: boolean): void;
/**
* Assigns this source to the given zone.
* Any channels which are initialized with runInZone set to true will emit events that will be
* executed within the given zone.
*/
attachToZone(zone: NgZone): void;
/**
* Returns an {@link EventEmitter} that emits every time a message
* is received on the given channel.
*/
from(channel: string): EventEmitter<any>;
}
declare class NamedEventEmitter {
private _listeners;
listen(eventName: string, callback: Function): void;
unlisten(eventName: string, listener: Function): void;
dispatchEvent(eventName: string, event: any): void;
private _getListeners;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const platformWorkerApp: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const platformWorkerUi: (extraProviders?: StaticProvider[] | undefined) => import("@angular/core").PlatformRef;
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare interface ReceivedMessage {
method: string;
args: any[];
id: string;
type: string;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const enum SerializerTypes {
RENDERER_TYPE_2 = 0,
PRIMITIVE = 1,
RENDER_STORE_OBJECT = 2
}
/**
* Helper class for UIComponents that allows components to register methods.
* If a registered method message is received from the broker on the worker,
* the UIMessageBroker deserializes its arguments and calls the registered method.
* If that method returns a promise, the UIMessageBroker returns the result to the worker.
*
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class ServiceMessageBroker {
private _serializer;
private channel;
private _sink;
private _methods;
registerMethod(methodName: string, signature: Array<Type<any> | SerializerTypes> | null, method: (..._: any[]) => Promise<any> | void, returnType?: Type<any> | SerializerTypes): void;
private _handleMessage;
private _wrapWebWorkerPromise;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class ServiceMessageBrokerFactory {
private _messageBus;
/**
* Initializes the given channel and attaches a new {@link ServiceMessageBroker} to it.
*/
createMessageBroker(channel: string, runInZone?: boolean): ServiceMessageBroker;
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class UiArguments {
method: string;
args?: FnArg[] | undefined;
constructor(method: string, args?: FnArg[] | undefined);
}
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const VERSION: Version;
declare class WebWorkerRenderNode {
events: NamedEventEmitter;
}
/**
* The {@link PlatformLocation} providers that should be added when the {@link Location} is used in
* a worker context.
*
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const WORKER_APP_LOCATION_PROVIDERS: StaticProvider[];
/**
* 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.
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare const WORKER_UI_LOCATION_PROVIDERS: StaticProvider[];
/**
* The ng module for the worker app side.
*
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in a future version
* of Angular
*/
export declare class WorkerAppModule {
}
export declare class ɵangular_packages_platform_webworker_platform_webworker_a {
private _renderStore;
constructor(_renderStore: ɵangular_packages_platform_webworker_platform_webworker_h);
serialize(obj: any, type?: Type<any> | SerializerTypes): Object;
deserialize(map: any, type?: Type<any> | SerializerTypes, data?: any): any;
private _serializeLocation;
private _deserializeLocation;
private _serializeRendererType2;
private _deserializeRendererType2;
}
export declare function ɵangular_packages_platform_webworker_platform_webworker_b(platformLocation: ɵangular_packages_platform_webworker_platform_webworker_i): Promise<any>;
export declare function ɵangular_packages_platform_webworker_platform_webworker_c(platformLocation: ɵangular_packages_platform_webworker_platform_webworker_i, zone: NgZone): () => Promise<boolean>;
export declare function ɵangular_packages_platform_webworker_platform_webworker_d(): ErrorHandler;
export declare function ɵangular_packages_platform_webworker_platform_webworker_e(zone: NgZone): MessageBus;
export declare function ɵangular_packages_platform_webworker_platform_webworker_f(): void;
export declare const ɵangular_packages_platform_webworker_platform_webworker_g: StaticProvider[];
export declare class ɵangular_packages_platform_webworker_platform_webworker_h {
private _nextIndex;
private _lookupById;
private _lookupByObject;
allocateId(): number;
store(obj: any, id: number): void;
remove(obj: any): void;
deserialize(id: number): any;
serialize(obj: any): number | null | undefined;
}
export declare class ɵangular_packages_platform_webworker_platform_webworker_i extends PlatformLocation {
private _serializer;
private _broker;
private _popStateListeners;
private _hashChangeListeners;
private _location;
private _channelSource;
initialized: Promise<any>;
private initializedResolve;
constructor(brokerFactory: ClientMessageBrokerFactory, bus: MessageBus, _serializer: ɵangular_packages_platform_webworker_platform_webworker_a);
getBaseHrefFromDOM(): string;
onPopState(fn: LocationChangeListener): void;
onHashChange(fn: LocationChangeListener): void;
get href(): string;
get hostname(): string;
get port(): string;
get protocol(): string;
get search(): string;
get hash(): string;
set pathname(newPath: string);
pushState(state: any, title: string, url: string): void;
replaceState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
getState(): unknown;
}
export declare class ɵangular_packages_platform_webworker_platform_webworker_j implements RendererFactory2 {
private _serializer;
renderStore: ɵangular_packages_platform_webworker_platform_webworker_h;
globalEvents: NamedEventEmitter;
private _messageBroker;
constructor(messageBrokerFactory: ClientMessageBrokerFactory, bus: MessageBus, _serializer: ɵangular_packages_platform_webworker_platform_webworker_a, renderStore: ɵangular_packages_platform_webworker_platform_webworker_h);
createRenderer(element: any, type: RendererType2 | null): Renderer2;
begin(): void;
end(): void;
callUI(fnName: string, fnArgs: FnArg[]): void;
allocateNode(): WebWorkerRenderNode;
freeNode(node: any): void;
allocateId(): number;
private _dispatchEvent;
}
export declare const ɵangular_packages_platform_webworker_platform_webworker_k: InjectionToken<boolean>;
export { }