feat(service-worker): expose SwRegistrationOptions
token to allow runtime config (#21842)
Previously, the ServiceWorker registration options should be defined as an object literal (in order for them to be compatible with Ahead-of-Time compilation), thus making it impossible to base the ServiceWorker behavior on runtime conditions. This commit allows specifying the registration options using a regular provider, which means that it can take advantage of the `useFactory` option to determine the config at runtime, while still remaining compatible with AoT compilation. PR Close #21842
This commit is contained in:
@ -1,8 +1,5 @@
|
||||
export declare class ServiceWorkerModule {
|
||||
static register(script: string, opts?: {
|
||||
scope?: string;
|
||||
enabled?: boolean;
|
||||
}): ModuleWithProviders<ServiceWorkerModule>;
|
||||
static register(script: string, opts?: SwRegistrationOptions): ModuleWithProviders<ServiceWorkerModule>;
|
||||
}
|
||||
|
||||
export declare class SwPush {
|
||||
@ -22,6 +19,11 @@ export declare class SwPush {
|
||||
unsubscribe(): Promise<void>;
|
||||
}
|
||||
|
||||
export declare abstract class SwRegistrationOptions {
|
||||
enabled?: boolean;
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
export declare class SwUpdate {
|
||||
readonly activated: Observable<UpdateActivatedEvent>;
|
||||
readonly available: Observable<UpdateAvailableEvent>;
|
||||
|
Reference in New Issue
Block a user