docs(service-worker): add UpdateActivated
/AvailableEvent
to the public API (#23138)
PR Close #23138
This commit is contained in:
parent
1c1fd98591
commit
9e5b0794c5
@ -14,6 +14,7 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export {UpdateActivatedEvent, UpdateAvailableEvent} from './low_level';
|
||||||
export {ServiceWorkerModule} from './module';
|
export {ServiceWorkerModule} from './module';
|
||||||
export {SwPush} from './push';
|
export {SwPush} from './push';
|
||||||
export {SwUpdate} from './update';
|
export {SwUpdate} from './update';
|
||||||
|
@ -11,27 +11,26 @@ import {filter, map, publish, switchMap, take, tap} from 'rxjs/operators';
|
|||||||
|
|
||||||
export const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';
|
export const ERR_SW_NOT_SUPPORTED = 'Service workers are disabled or not supported by this browser';
|
||||||
|
|
||||||
export interface Version {
|
|
||||||
hash: string;
|
|
||||||
appData?: Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* An event emitted when a new version of the app is available.
|
||||||
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export interface UpdateAvailableEvent {
|
export interface UpdateAvailableEvent {
|
||||||
type: 'UPDATE_AVAILABLE';
|
type: 'UPDATE_AVAILABLE';
|
||||||
current: Version;
|
current: {hash: string, appData?: Object};
|
||||||
available: Version;
|
available: {hash: string, appData?: Object};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* An event emitted when a new version of the app has been downloaded and activated.
|
||||||
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export interface UpdateActivatedEvent {
|
export interface UpdateActivatedEvent {
|
||||||
type: 'UPDATE_ACTIVATED';
|
type: 'UPDATE_ACTIVATED';
|
||||||
previous?: Version;
|
previous?: {hash: string, appData?: Object};
|
||||||
current: Version;
|
current: {hash: string, appData?: Object};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IncomingEvent = UpdateAvailableEvent | UpdateActivatedEvent;
|
export type IncomingEvent = UpdateAvailableEvent | UpdateActivatedEvent;
|
||||||
@ -52,7 +51,7 @@ function errorObservable(message: string): Observable<any> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export class NgswCommChannel {
|
export class NgswCommChannel {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -27,3 +27,29 @@ export declare class SwUpdate {
|
|||||||
activateUpdate(): Promise<void>;
|
activateUpdate(): Promise<void>;
|
||||||
checkForUpdate(): Promise<void>;
|
checkForUpdate(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @experimental */
|
||||||
|
export interface UpdateActivatedEvent {
|
||||||
|
current: {
|
||||||
|
hash: string;
|
||||||
|
appData?: Object;
|
||||||
|
};
|
||||||
|
previous?: {
|
||||||
|
hash: string;
|
||||||
|
appData?: Object;
|
||||||
|
};
|
||||||
|
type: 'UPDATE_ACTIVATED';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @experimental */
|
||||||
|
export interface UpdateAvailableEvent {
|
||||||
|
available: {
|
||||||
|
hash: string;
|
||||||
|
appData?: Object;
|
||||||
|
};
|
||||||
|
current: {
|
||||||
|
hash: string;
|
||||||
|
appData?: Object;
|
||||||
|
};
|
||||||
|
type: 'UPDATE_AVAILABLE';
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user