Minor change

This commit is contained in:
Eduard Urbach 2019-11-17 18:19:55 +09:00
parent 62d63740bb
commit 454e8572e3
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -32,10 +32,10 @@
* within. Note that this option is ignored by Cache.match(). * within. Note that this option is ignored by Cache.match().
*/ */
interface CacheOptions { interface CacheOptions {
ignoreSearch?: boolean; ignoreSearch?: boolean;
ignoreMethod?: boolean; ignoreMethod?: boolean;
ignoreVary?: boolean; ignoreVary?: boolean;
cacheName?: string; cacheName?: string;
} }
/** /**
@ -43,65 +43,65 @@ interface CacheOptions {
* part of the ServiceWorker life cycle. * part of the ServiceWorker life cycle.
*/ */
interface Cache { interface Cache {
/** /**
* Returns a Promise that resolves to the response associated with the first * Returns a Promise that resolves to the response associated with the first
* matching request in the Cache object. * matching request in the Cache object.
* *
* @param request The Request you are attempting to find in the Cache. * @param request The Request you are attempting to find in the Cache.
* @param [options] An object that sets options for the match operation. * @param [options] An object that sets options for the match operation.
*/ */
match(request: Request | string, options?: CacheOptions): Promise<Response>; match(request: Request | string, options?: CacheOptions): Promise<Response>;
/** /**
* Returns a Promise that resolves to an array of all matching responses in * Returns a Promise that resolves to an array of all matching responses in
* the Cache object. * the Cache object.
* *
* @param request The Request you are attempting to find in the Cache. * @param request The Request you are attempting to find in the Cache.
* @param [options] An object that sets options for the match operation. * @param [options] An object that sets options for the match operation.
*/ */
matchAll(request: Request | string, options?: CacheOptions): Promise<Response[]>; matchAll(request: Request | string, options?: CacheOptions): Promise<Response[]>;
/** /**
* Returns a Promise that resolves to a new Cache entry whose key * Returns a Promise that resolves to a new Cache entry whose key
* is the request. * is the request.
* *
* @param request The Request you want to add to the cache. * @param request The Request you want to add to the cache.
*/ */
add(request: Request | string): Promise<void>; add(request: Request | string): Promise<void>;
/** /**
* Returns a Promise that resolves to a new array of Cache entries whose * Returns a Promise that resolves to a new array of Cache entries whose
* keys are the requests. * keys are the requests.
* *
* @param request An array of Request objects you want to add to the cache. * @param request An array of Request objects you want to add to the cache.
*/ */
addAll(requests: Array<Request | string>): Promise<void>; addAll(requests: Array<Request | string>): Promise<void>;
/** /**
* Adds additional key/value pairs to the current Cache object. * Adds additional key/value pairs to the current Cache object.
* *
* @param request The Request you want to add to the cache. * @param request The Request you want to add to the cache.
* @param response The response you want to match up to the request. * @param response The response you want to match up to the request.
*/ */
put(request: Request, response: Response): Promise<void>; put(request: Request, response: Response): Promise<void>;
/** /**
* Finds the Cache entry whose key is the request, and if found, deletes the * Finds the Cache entry whose key is the request, and if found, deletes the
* Cache entry and returns a Promise that resolves to true. If no Cache * Cache entry and returns a Promise that resolves to true. If no Cache
* entry is found, it returns false. * entry is found, it returns false.
* *
* @param request The Request you are looking to delete. * @param request The Request you are looking to delete.
* @param [options] An object that sets options for the match operation. * @param [options] An object that sets options for the match operation.
*/ */
delete(request: Request | string, options?: CacheOptions): Promise<boolean>; delete(request: Request | string, options?: CacheOptions): Promise<boolean>;
/** /**
* Returns a Promise that resolves to an array of Cache keys. * Returns a Promise that resolves to an array of Cache keys.
* *
* @param request The Request want to return, if a specific key is desired. * @param request The Request want to return, if a specific key is desired.
* @param [options] An object that sets options for the match operation. * @param [options] An object that sets options for the match operation.
*/ */
keys(request?: Request, options?: CacheOptions): Promise<Request[]>; keys(request?: Request, options?: CacheOptions): Promise<Request[]>;
} }
/** /**
@ -110,49 +110,49 @@ interface Cache {
* of string names to corresponding Cache objects. * of string names to corresponding Cache objects.
*/ */
interface CacheStorage { interface CacheStorage {
/** /**
* Checks if a given Request is a key in any of the Cache objects that the * Checks if a given Request is a key in any of the Cache objects that the
* CacheStorage object tracks and returns a Promise that resolves * CacheStorage object tracks and returns a Promise that resolves
* to that match. * to that match.
* *
* @param request The Request you are looking for a match for in the CacheStorage. * @param request The Request you are looking for a match for in the CacheStorage.
* @param [options] An object that sets options for the match operation. * @param [options] An object that sets options for the match operation.
*/ */
match(request: Request | string, options?: CacheOptions): Promise<Response>; match(request: Request | string, options?: CacheOptions): Promise<Response>;
/** /**
* Returns a Promise that resolves to true if a Cache object matching * Returns a Promise that resolves to true if a Cache object matching
* the cacheName exists. * the cacheName exists.
* *
* @param cacheName The Request you are looking for a match for in the * @param cacheName The Request you are looking for a match for in the
* CacheStorage. * CacheStorage.
*/ */
has(cacheName: string): Promise<boolean>; has(cacheName: string): Promise<boolean>;
/** /**
* Returns a Promise that resolves to the Cache object matching * Returns a Promise that resolves to the Cache object matching
* the cacheName. * the cacheName.
* *
* @param cacheName The name of the cache you want to open. * @param cacheName The name of the cache you want to open.
*/ */
open(cacheName: string): Promise<Cache>; open(cacheName: string): Promise<Cache>;
/** /**
* Finds the Cache object matching the cacheName, and if found, deletes the * Finds the Cache object matching the cacheName, and if found, deletes the
* Cache object and returns a Promise that resolves to true. If no * Cache object and returns a Promise that resolves to true. If no
* Cache object is found, it returns false. * Cache object is found, it returns false.
* *
* @param cacheName The name of the cache you want to delete. * @param cacheName The name of the cache you want to delete.
*/ */
delete(cacheName: string): Promise<boolean>; delete(cacheName: string): Promise<boolean>;
/** /**
* Returns a Promise that will resolve with an array containing strings * Returns a Promise that will resolve with an array containing strings
* corresponding to all of the named Cache objects tracked by the * corresponding to all of the named Cache objects tracked by the
* CacheStorage. Use this method to iterate over a list of all the * CacheStorage. Use this method to iterate over a list of all the
* Cache objects. * Cache objects.
*/ */
keys(): Promise<string[]>; keys(): Promise<string[]>;
} }
/** /**
@ -161,53 +161,53 @@ interface CacheStorage {
* by an active worker. * by an active worker.
*/ */
interface ServiceWorkerClient { interface ServiceWorkerClient {
/** /**
* Allows a service worker client to send a message to a ServiceWorker. * Allows a service worker client to send a message to a ServiceWorker.
* *
* @param message The message to send to the service worker. * @param message The message to send to the service worker.
* @param [transfer] A transferable object such as, for example, a reference * @param [transfer] A transferable object such as, for example, a reference
* to a port. * to a port.
*/ */
postMessage(message: any, transfer?: any): void; postMessage(message: any, transfer?: any): void;
/** /**
* Indicates the type of browsing context of the current client. * Indicates the type of browsing context of the current client.
* This value can be one of auxiliary, top-level, nested, or none. * This value can be one of auxiliary, top-level, nested, or none.
*/ */
readonly frameType: string; readonly frameType: string;
/** /**
* Returns the id of the Client object. * Returns the id of the Client object.
*/ */
readonly id: string; readonly id: string;
/** /**
* The URL of the current service worker client. * The URL of the current service worker client.
*/ */
readonly url: string; readonly url: string;
} }
interface WindowClient extends ServiceWorkerClient { interface WindowClient extends ServiceWorkerClient {
/** /**
* Gives user input focus to the current client. * Gives user input focus to the current client.
*/ */
focus(): Promise<WindowClient>; focus(): Promise<WindowClient>;
/** /**
* A boolean that indicates whether the current client has focus. * A boolean that indicates whether the current client has focus.
*/ */
readonly focused: boolean; readonly focused: boolean;
/** /**
* Indicates the visibility of the current client. This value can be one of * Indicates the visibility of the current client. This value can be one of
* hidden, visible, prerender, or unloaded. * hidden, visible, prerender, or unloaded.
*/ */
readonly visibilityState: string; readonly visibilityState: string;
} }
interface ServiceWorkerClientsMatchOptions { interface ServiceWorkerClientsMatchOptions {
includeUncontrolled?: boolean; includeUncontrolled?: boolean;
type?: string; type?: string;
} }
/** /**
@ -215,36 +215,36 @@ interface ServiceWorkerClientsMatchOptions {
* the active service worker clients at the current origin. * the active service worker clients at the current origin.
*/ */
interface ServiceWorkerClients { interface ServiceWorkerClients {
/** /**
* Gets a service worker client matching a given id and returns it in a Promise. * Gets a service worker client matching a given id and returns it in a Promise.
* @param clientId The ID of the client you want to get. * @param clientId The ID of the client you want to get.
*/ */
get(clientId: string): Promise<ServiceWorkerClient>; get(clientId: string): Promise<ServiceWorkerClient>;
/** /**
* Gets a list of service worker clients and returns them in a Promise. * Gets a list of service worker clients and returns them in a Promise.
* Include the options parameter to return all service worker clients whose * Include the options parameter to return all service worker clients whose
* origin is the same as the associated service worker's origin. If options * origin is the same as the associated service worker's origin. If options
* are not included, the method returns only the service worker clients * are not included, the method returns only the service worker clients
* controlled by the service worker. * controlled by the service worker.
* *
* @param [options] An options object allowing you to set options for the matching operation. * @param [options] An options object allowing you to set options for the matching operation.
*/ */
matchAll(options?: ServiceWorkerClientsMatchOptions): Promise<ServiceWorkerClient[]>; matchAll(options?: ServiceWorkerClientsMatchOptions): Promise<ServiceWorkerClient[]>;
/** /**
* Opens a service worker Client in a new browser window. * Opens a service worker Client in a new browser window.
* *
* @param url A string representing the URL of the client you want to open * @param url A string representing the URL of the client you want to open
* in the window. * in the window.
*/ */
openWindow(url: string): Promise<WindowClient>; openWindow(url: string): Promise<WindowClient>;
/** /**
* Allows an active Service Worker to set itself as the active worker for a * Allows an active Service Worker to set itself as the active worker for a
* client page when the worker and the page are in the same scope. * client page when the worker and the page are in the same scope.
*/ */
claim(): Promise<void>; claim(): Promise<void>;
} }
/** /**
@ -252,12 +252,12 @@ interface ServiceWorkerClients {
* etc.) can be associated with the same ServiceWorker object. * etc.) can be associated with the same ServiceWorker object.
*/ */
interface ServiceWorker extends Worker { interface ServiceWorker extends Worker {
/** /**
* Returns the ServiceWorker serialized script URL defined as part of * Returns the ServiceWorker serialized script URL defined as part of
* ServiceWorkerRegistration. The URL must be on the same origin as the * ServiceWorkerRegistration. The URL must be on the same origin as the
* document that registers the ServiceWorker. * document that registers the ServiceWorker.
*/ */
readonly scriptURL: string; readonly scriptURL: string;
} }
/** /**
@ -265,26 +265,26 @@ interface ServiceWorker extends Worker {
* methods which let you retrieve the push data sent by a server in various formats. * methods which let you retrieve the push data sent by a server in various formats.
*/ */
interface PushMessageData { interface PushMessageData {
/** /**
* Extracts the data as an ArrayBuffer object. * Extracts the data as an ArrayBuffer object.
*/ */
arrayBuffer(): ArrayBuffer; arrayBuffer(): ArrayBuffer;
/** /**
* Extracts the data as a Blob object. * Extracts the data as a Blob object.
*/ */
blob(): Blob; blob(): Blob;
/** /**
* Extracts the data as a JSON object. * Extracts the data as a JSON object.
*/ */
json(): any; json(): any;
json<T>(): T; json<T>(): T;
/** /**
* Extracts the data as a plain text string. * Extracts the data as a plain text string.
*/ */
text(): string; text(): string;
} }
/** /**
@ -292,26 +292,26 @@ interface PushMessageData {
* subscription ID. * subscription ID.
*/ */
interface PushSubscription { interface PushSubscription {
/** /**
* The endpoint associated with the push subscription. * The endpoint associated with the push subscription.
*/ */
readonly endpoint: string; readonly endpoint: string;
/** /**
* The subscription ID associated with the push subscription. * The subscription ID associated with the push subscription.
*/ */
readonly subscriptionId: any; readonly subscriptionId: any;
} }
/** /**
* Object containing optional subscribe parameters. * Object containing optional subscribe parameters.
*/ */
interface PushSubscriptionOptions { interface PushSubscriptionOptions {
/** /**
* A boolean indicating that the returned push subscription will only be used for * A boolean indicating that the returned push subscription will only be used for
* messages whose effect is made visible to the user. * messages whose effect is made visible to the user.
*/ */
readonly userVisibleOnly: boolean; readonly userVisibleOnly: boolean;
} }
/** /**
@ -321,25 +321,25 @@ interface PushSubscriptionOptions {
* PushRegistrationManager. * PushRegistrationManager.
*/ */
interface PushManager { interface PushManager {
/** /**
* Returns a promise that resolves to a PushSubscription with details of a * Returns a promise that resolves to a PushSubscription with details of a
* new push subscription. * new push subscription.
* *
* @param [options] An object containing optional configuration parameters. * @param [options] An object containing optional configuration parameters.
*/ */
subscribe(options?: PushSubscriptionOptions): Promise<PushSubscription>; subscribe(options?: PushSubscriptionOptions): Promise<PushSubscription>;
/** /**
* Returns a promise that resolves to a PushSubscription details of * Returns a promise that resolves to a PushSubscription details of
* the retrieved push subscription. * the retrieved push subscription.
*/ */
getSubscription(): Promise<PushSubscription>; getSubscription(): Promise<PushSubscription>;
/** /**
* Returns a promise that resolves to the PushPermissionStatus of the * Returns a promise that resolves to the PushPermissionStatus of the
* requesting webapp, which will be one of granted, denied, or default. * requesting webapp, which will be one of granted, denied, or default.
*/ */
hasPermission(): Promise<any>; hasPermission(): Promise<any>;
} }
/////// Service Worker Events /////// /////// Service Worker Events ///////
@ -352,14 +352,14 @@ interface PushManager {
* entries, etc. * entries, etc.
*/ */
interface ExtendableEvent extends Event { interface ExtendableEvent extends Event {
/** /**
* Extends the lifetime of the event. * Extends the lifetime of the event.
* It is intended to be called in the install EventHandler for the * It is intended to be called in the install EventHandler for the
* installing worker and on the active EventHandler for the active worker. * installing worker and on the active EventHandler for the active worker.
* *
* @param promise * @param promise
*/ */
waitUntil(promise: Promise<any>): void; waitUntil(promise: Promise<any>): void;
} }
/** /**
@ -371,29 +371,29 @@ interface ExtendableEvent extends Event {
* controlled page. * controlled page.
*/ */
interface FetchEvent extends Event { interface FetchEvent extends Event {
/** /**
* Returns a Boolean that is true if the event was dispatched with the * Returns a Boolean that is true if the event was dispatched with the
* user's intention for the page to reload, and false otherwise. Typically, * user's intention for the page to reload, and false otherwise. Typically,
* pressing the refresh button in a browser is a reload, while clicking a * pressing the refresh button in a browser is a reload, while clicking a
* link and pressing the back button is not. * link and pressing the back button is not.
*/ */
readonly isReload: boolean; readonly isReload: boolean;
/** /**
* Returns the Request that triggered the event handler. * Returns the Request that triggered the event handler.
*/ */
readonly request: Request; readonly request: Request;
/** /**
* Returns the id of the client that the current service worker is controlling. * Returns the id of the client that the current service worker is controlling.
*/ */
readonly clientId: string; readonly clientId: string;
/** /**
* Resolves by returning a Response or a network error to Fetch. * Resolves by returning a Response or a network error to Fetch.
* *
* @param all Any custom response-generating code. * @param all Any custom response-generating code.
*/ */
respondWith(all: any): any; respondWith(all: any): any;
waitUntil(promise: Promise<any>): void; waitUntil(promise: Promise<any>): void;
@ -407,31 +407,31 @@ interface FetchEvent extends Event {
* extends the lifetime of such events. * extends the lifetime of such events.
*/ */
interface ExtendableMessageEvent extends ExtendableEvent { interface ExtendableMessageEvent extends ExtendableEvent {
/** /**
* Returns the event's data. It can be any data type. * Returns the event's data. It can be any data type.
*/ */
readonly data: any; readonly data: any;
/** /**
* Returns the origin of the ServiceWorkerClient that sent the message * Returns the origin of the ServiceWorkerClient that sent the message
*/ */
readonly origin: string; readonly origin: string;
/** /**
* Represents, in server-sent events, the last event ID of the event source. * Represents, in server-sent events, the last event ID of the event source.
*/ */
readonly lastEventId: string; readonly lastEventId: string;
/** /**
* Returns a reference to the service worker that sent the message. * Returns a reference to the service worker that sent the message.
*/ */
readonly source: ServiceWorkerClient; readonly source: ServiceWorkerClient;
/** /**
* Returns the array containing the MessagePort objects * Returns the array containing the MessagePort objects
* representing the ports of the associated message channel. * representing the ports of the associated message channel.
*/ */
readonly ports: MessagePort[]; readonly ports: MessagePort[];
} }
/** /**
@ -442,10 +442,10 @@ interface ExtendableMessageEvent extends ExtendableEvent {
* during installation. * during installation.
*/ */
interface InstallEvent extends ExtendableEvent { interface InstallEvent extends ExtendableEvent {
/** /**
* Returns the ServiceWorker that is currently actively controlling the page. * Returns the ServiceWorker that is currently actively controlling the page.
*/ */
readonly activeWorker: ServiceWorker; readonly activeWorker: ServiceWorker;
} }
/** /**
@ -455,19 +455,19 @@ interface InstallEvent extends ExtendableEvent {
* the ServiceWorkerGlobalScope of a ServiceWorker. * the ServiceWorkerGlobalScope of a ServiceWorker.
*/ */
interface NotificationEvent extends ExtendableEvent { interface NotificationEvent extends ExtendableEvent {
/** /**
* Returns a Notification object representing * Returns a Notification object representing
* the notification that was clicked to fire the event. * the notification that was clicked to fire the event.
*/ */
notification: any; // need to be replaced with `Notification` when possible notification: any; // need to be replaced with `Notification` when possible
/** /**
* Returns the string ID of the notification button the user clicked. * Returns the string ID of the notification button the user clicked.
* This value returns undefined if the user clicked * This value returns undefined if the user clicked
* the notification somewhere other than an action button, * the notification somewhere other than an action button,
* or the notification does not have a button. * or the notification does not have a button.
*/ */
action: string; action: string;
} }
/** /**
@ -477,27 +477,27 @@ interface NotificationEvent extends ExtendableEvent {
* It contains the information sent from an application server to a PushSubscription. * It contains the information sent from an application server to a PushSubscription.
*/ */
interface PushEvent extends ExtendableEvent { interface PushEvent extends ExtendableEvent {
/** /**
* Returns a reference to a PushMessageData object containing * Returns a reference to a PushMessageData object containing
* data sent to the PushSubscription. * data sent to the PushSubscription.
*/ */
readonly data: PushMessageData; readonly data: PushMessageData;
} }
interface ServiceWorkerContainerEventMap { interface ServiceWorkerContainerEventMap {
"error": ErrorEvent; "error": ErrorEvent;
"controllerchange": Event; "controllerchange": Event;
} }
interface ServiceWorkerEventMap { interface ServiceWorkerEventMap {
"activate": ExtendableEvent; "activate": ExtendableEvent;
"fetch": FetchEvent; "fetch": FetchEvent;
"install": InstallEvent; "install": InstallEvent;
// "message": ExtendableMessageEvent; // "message": ExtendableMessageEvent;
"message": MessageEvent; "message": MessageEvent;
"notificationclick": NotificationEvent; "notificationclick": NotificationEvent;
"push": PushEvent; "push": PushEvent;
"pushsubscriptionchang": PushEvent; "pushsubscriptionchang": PushEvent;
} }
/** /**
@ -506,7 +506,7 @@ interface ServiceWorkerEventMap {
* URLs a service worker can control. This is usually a relative URL, and it defaults to '/' when not specified. * URLs a service worker can control. This is usually a relative URL, and it defaults to '/' when not specified.
*/ */
interface ServiceWorkerRegisterOptions { interface ServiceWorkerRegisterOptions {
scope: string; scope: string;
} }
/** /**
@ -516,9 +516,9 @@ interface ServiceWorkerRegisterOptions {
* @param [icon] A USVString containg the URL of an icon to display with the action. * @param [icon] A USVString containg the URL of an icon to display with the action.
*/ */
interface NotificationAction { // TODO: Maybe need to moved if NotificationApi types are defined interface NotificationAction { // TODO: Maybe need to moved if NotificationApi types are defined
action: string; action: string;
title: string; title: string;
icon?: string; icon?: string;
} }
/** /**
@ -547,17 +547,17 @@ interface NotificationAction { // TODO: Maybe need to moved if NotificationApi t
* @param [data] Arbitrary data that you want associated with the notification. This can be of any data type. * @param [data] Arbitrary data that you want associated with the notification. This can be of any data type.
*/ */
interface ServiceWorkerNotificationOptions { interface ServiceWorkerNotificationOptions {
actions?: NotificationAction[]; actions?: NotificationAction[];
badge?: string; badge?: string;
body?: string; body?: string;
dir?: 'auto' | 'ltr' | 'rtl'; dir?: 'auto' | 'ltr' | 'rtl';
icon?: string; icon?: string;
lang?: string; lang?: string;
renotify?: boolean; renotify?: boolean;
requireInteraction?: boolean; requireInteraction?: boolean;
tag?: string; tag?: string;
vibrate?: number[]; vibrate?: number[];
data?: any; data?: any;
} }
/** /**
@ -566,90 +566,90 @@ interface ServiceWorkerNotificationOptions {
* will be returned. * will be returned.
*/ */
interface ServiceWorkerGetNotificationOptions { interface ServiceWorkerGetNotificationOptions {
tag: string; tag: string;
} }
interface ServiceWorkerGlobalScope extends EventTarget { interface ServiceWorkerGlobalScope extends EventTarget {
/** /**
* Contains the CacheStorage object associated with the service worker. * Contains the CacheStorage object associated with the service worker.
*/ */
readonly caches: CacheStorage; readonly caches: CacheStorage;
/** /**
* Contains the Clients object associated with the service worker. * Contains the Clients object associated with the service worker.
*/ */
readonly clients: ServiceWorkerClients; readonly clients: ServiceWorkerClients;
/** /**
* Contains the ServiceWorkerRegistration object that represents the * Contains the ServiceWorkerRegistration object that represents the
* service worker's registration. * service worker's registration.
*/ */
readonly registration: ServiceWorkerRegistration; readonly registration: ServiceWorkerRegistration;
/** /**
* An event handler fired whenever an activate event occurs when a * An event handler fired whenever an activate event occurs when a
* ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.active * ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.active
* worker. * worker.
*/ */
onactivate: (activateevent: ExtendableEvent) => void; onactivate: (activateevent: ExtendableEvent) => void;
/** /**
* An event handler fired whenever a fetch event occurs when a fetch() * An event handler fired whenever a fetch event occurs when a fetch()
* is called. * is called.
*/ */
onfetch: (fetchevent: FetchEvent) => void; onfetch: (fetchevent: FetchEvent) => void;
/** /**
* An event handler fired whenever an install event occurs when a * An event handler fired whenever an install event occurs when a
* ServiceWorkerRegistration acquires a new * ServiceWorkerRegistration acquires a new
* ServiceWorkerRegistration.installing worker. * ServiceWorkerRegistration.installing worker.
*/ */
oninstall: (installevent: InstallEvent) => void; oninstall: (installevent: InstallEvent) => void;
/** /**
* An event handler fired whenever a message event occurs when incoming * An event handler fired whenever a message event occurs when incoming
* messages are received. Controlled pages can use the * messages are received. Controlled pages can use the
* MessagePort.postMessage() method to send messages to service workers. * MessagePort.postMessage() method to send messages to service workers.
* The service worker can optionally send a response back via the * The service worker can optionally send a response back via the
* MessagePort exposed in event.data.port, corresponding to the controlled * MessagePort exposed in event.data.port, corresponding to the controlled
* page. * page.
* *
* `onmessage` is actually fired with `ExtendableMessageEvent`, but * `onmessage` is actually fired with `ExtendableMessageEvent`, but
* since we are merging the interface into `Window`, we should * since we are merging the interface into `Window`, we should
* make sure it's compatible with `window.onmessage` * make sure it's compatible with `window.onmessage`
*/ */
// onmessage: (messageevent: ExtendableMessageEvent) => void; // onmessage: (messageevent: ExtendableMessageEvent) => void;
//onmessage: (messageevent: MessageEvent) => void; //onmessage: (messageevent: MessageEvent) => void;
/** /**
* An event handler fired whenever a notificationclick event occurs when * An event handler fired whenever a notificationclick event occurs when
* a user clicks on a displayed notification. * a user clicks on a displayed notification.
*/ */
onnotificationclick: (notificationclickevent: NotificationEvent) => void; onnotificationclick: (notificationclickevent: NotificationEvent) => void;
/** /**
* An event handler fired whenever a push event occurs when a server * An event handler fired whenever a push event occurs when a server
* push notification is received. * push notification is received.
*/ */
onpush: (onpushevent: PushEvent) => void; onpush: (onpushevent: PushEvent) => void;
/** /**
* An event handler fired whenever a pushsubscriptionchange event occurs * An event handler fired whenever a pushsubscriptionchange event occurs
* when a push subscription has been invalidated, or is about to be * when a push subscription has been invalidated, or is about to be
* invalidated (e.g. when a push service sets an expiration time). * invalidated (e.g. when a push service sets an expiration time).
*/ */
onpushsubscriptionchange: (pushsubscriptionchangeevent: PushEvent) => void; onpushsubscriptionchange: (pushsubscriptionchangeevent: PushEvent) => void;
/** /**
* Allows the current service worker registration to progress from waiting * Allows the current service worker registration to progress from waiting
* to active state while service worker clients are using it. * to active state while service worker clients are using it.
*/ */
skipWaiting(): Promise<void>; skipWaiting(): Promise<void>;
addEventListener<K extends keyof ServiceWorkerEventMap>( addEventListener<K extends keyof ServiceWorkerEventMap>(
type: K, type: K,
listener: (event: ServiceWorkerEventMap[K]) => any, listener: (event: ServiceWorkerEventMap[K]) => any,
useCapture?: boolean useCapture?: boolean
): void; ): void;
} }
interface NotificationOptions { interface NotificationOptions {