@@ -19,7 +19,6 @@ interface CacheQueryOptions {
19
19
}
20
20
21
21
interface ClientQueryOptions {
22
- includeReserved ?: boolean ;
23
22
includeUncontrolled ?: boolean ;
24
23
type ?: ClientTypes ;
25
24
}
@@ -55,14 +54,15 @@ interface ExtendableMessageEventInit extends ExtendableEventInit {
55
54
data ?: any ;
56
55
lastEventId ?: string ;
57
56
origin ?: string ;
58
- ports ?: MessagePort [ ] | null ;
59
- source ?: Client | ServiceWorker | MessagePort | null ;
57
+ ports ?: MessagePort [ ] ;
58
+ source ?: Client | ServiceWorker | MessagePort ;
60
59
}
61
60
62
61
interface FetchEventInit extends ExtendableEventInit {
63
62
clientId ?: string ;
63
+ preloadResponse : Promise < any > ;
64
64
request : Request ;
65
- reservedClientId ?: string ;
65
+ resultingClientId ?: string ;
66
66
targetClientId ?: string ;
67
67
}
68
68
@@ -98,6 +98,11 @@ interface MessageEventInit extends EventInit {
98
98
source ?: object | null ;
99
99
}
100
100
101
+ interface NavigationPreloadState {
102
+ enabled ?: boolean ;
103
+ headerValue ?: string ;
104
+ }
105
+
101
106
interface NotificationAction {
102
107
action : string ;
103
108
icon ?: string ;
@@ -161,6 +166,12 @@ interface PushSubscriptionOptionsInit {
161
166
userVisibleOnly ?: boolean ;
162
167
}
163
168
169
+ interface RegistrationOptions {
170
+ scope ?: string ;
171
+ type ?: WorkerType ;
172
+ updateViaCache ?: ServiceWorkerUpdateViaCache ;
173
+ }
174
+
164
175
interface RequestInit {
165
176
body ?: BodyInit | null ;
166
177
cache ?: RequestCache ;
@@ -248,13 +259,13 @@ interface Body {
248
259
}
249
260
250
261
interface Cache {
251
- add ( request : Request | string ) : Promise < void > ;
252
- addAll ( requests : ( Request | string ) [ ] ) : Promise < void > ;
253
- delete ( request : Request | string , options ?: CacheQueryOptions ) : Promise < boolean > ;
254
- keys ( request ?: Request | string , options ?: CacheQueryOptions ) : Promise < Request [ ] > ;
255
- match ( request : Request | string , options ?: CacheQueryOptions ) : Promise < Response > ;
256
- matchAll ( request ?: Request | string , options ?: CacheQueryOptions ) : Promise < Response [ ] > ;
257
- put ( request : Request | string , response : Response ) : Promise < void > ;
262
+ add ( request : RequestInfo ) : Promise < void > ;
263
+ addAll ( requests : RequestInfo [ ] ) : Promise < void > ;
264
+ delete ( request : RequestInfo , options ?: CacheQueryOptions ) : Promise < boolean > ;
265
+ keys ( request ?: RequestInfo , options ?: CacheQueryOptions ) : Promise < ReadonlyArray < Request > > ;
266
+ match ( request : RequestInfo , options ?: CacheQueryOptions ) : Promise < Response | undefined > ;
267
+ matchAll ( request ?: RequestInfo , options ?: CacheQueryOptions ) : Promise < ReadonlyArray < Response > > ;
268
+ put ( request : RequestInfo , response : Response ) : Promise < void > ;
258
269
}
259
270
260
271
declare var Cache : {
@@ -266,7 +277,7 @@ interface CacheStorage {
266
277
delete ( cacheName : string ) : Promise < boolean > ;
267
278
has ( cacheName : string ) : Promise < boolean > ;
268
279
keys ( ) : Promise < string [ ] > ;
269
- match ( request : Request | string , options ?: CacheQueryOptions ) : Promise < any > ;
280
+ match ( request : RequestInfo , options ?: CacheQueryOptions ) : Promise < Response | undefined > ;
270
281
open ( cacheName : string ) : Promise < Cache > ;
271
282
}
272
283
@@ -277,7 +288,6 @@ declare var CacheStorage: {
277
288
278
289
interface Client {
279
290
readonly id : string ;
280
- readonly reserved : boolean ;
281
291
readonly type : ClientTypes ;
282
292
readonly url : string ;
283
293
postMessage ( message : any , transfer ?: any [ ] ) : void ;
@@ -291,7 +301,7 @@ declare var Client: {
291
301
interface Clients {
292
302
claim ( ) : Promise < void > ;
293
303
get ( id : string ) : Promise < any > ;
294
- matchAll ( options ?: ClientQueryOptions ) : Promise < Client [ ] > ;
304
+ matchAll ( options ?: ClientQueryOptions ) : Promise < ReadonlyArray < Client > > ;
295
305
openWindow ( url : string ) : Promise < WindowClient | null > ;
296
306
}
297
307
@@ -553,7 +563,7 @@ interface ExtendableMessageEvent extends ExtendableEvent {
553
563
readonly data : any ;
554
564
readonly lastEventId : string ;
555
565
readonly origin : string ;
556
- readonly ports : ReadonlyArray < MessagePort > | null ;
566
+ readonly ports : ReadonlyArray < MessagePort > ;
557
567
readonly source : Client | ServiceWorker | MessagePort | null ;
558
568
}
559
569
@@ -564,8 +574,9 @@ declare var ExtendableMessageEvent: {
564
574
565
575
interface FetchEvent extends ExtendableEvent {
566
576
readonly clientId : string ;
577
+ readonly preloadResponse : Promise < any > ;
567
578
readonly request : Request ;
568
- readonly reservedClientId : string ;
579
+ readonly resultingClientId : string ;
569
580
readonly targetClientId : string ;
570
581
respondWith ( r : Promise < Response > ) : void ;
571
582
}
@@ -977,6 +988,18 @@ declare var MessagePort: {
977
988
new ( ) : MessagePort ;
978
989
} ;
979
990
991
+ interface NavigationPreloadManager {
992
+ disable ( ) : Promise < void > ;
993
+ enable ( ) : Promise < void > ;
994
+ getState ( ) : Promise < NavigationPreloadState > ;
995
+ setHeaderValue ( value : string ) : Promise < void > ;
996
+ }
997
+
998
+ declare var NavigationPreloadManager : {
999
+ prototype : NavigationPreloadManager ;
1000
+ new ( ) : NavigationPreloadManager ;
1001
+ } ;
1002
+
980
1003
interface NavigatorBeacon {
981
1004
sendBeacon ( url : string , data ?: Blob | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | FormData | string | null ) : boolean ;
982
1005
}
@@ -1358,6 +1381,33 @@ declare var ServiceWorker: {
1358
1381
new ( ) : ServiceWorker ;
1359
1382
} ;
1360
1383
1384
+ interface ServiceWorkerContainerEventMap {
1385
+ "controllerchange" : Event ;
1386
+ "message" : ExtendableMessageEvent ;
1387
+ "messageerror" : MessageEvent ;
1388
+ }
1389
+
1390
+ interface ServiceWorkerContainer extends EventTarget {
1391
+ readonly controller : ServiceWorker | null ;
1392
+ oncontrollerchange : ( ( this : ServiceWorkerContainer , ev : Event ) => any ) | null ;
1393
+ onmessage : ( ( this : ServiceWorkerContainer , ev : ExtendableMessageEvent ) => any ) | null ;
1394
+ onmessageerror : ( ( this : ServiceWorkerContainer , ev : MessageEvent ) => any ) | null ;
1395
+ readonly ready : Promise < ServiceWorkerRegistration > ;
1396
+ getRegistration ( clientURL ?: string ) : Promise < ServiceWorkerRegistration | undefined > ;
1397
+ getRegistrations ( ) : Promise < ReadonlyArray < ServiceWorkerRegistration > > ;
1398
+ register ( scriptURL : string , options ?: RegistrationOptions ) : Promise < ServiceWorkerRegistration > ;
1399
+ startMessages ( ) : void ;
1400
+ addEventListener < K extends keyof ServiceWorkerContainerEventMap > ( type : K , listener : ( this : ServiceWorkerContainer , ev : ServiceWorkerContainerEventMap [ K ] ) => any , options ?: boolean | AddEventListenerOptions ) : void ;
1401
+ addEventListener ( type : string , listener : EventListenerOrEventListenerObject , options ?: boolean | AddEventListenerOptions ) : void ;
1402
+ removeEventListener < K extends keyof ServiceWorkerContainerEventMap > ( type : K , listener : ( this : ServiceWorkerContainer , ev : ServiceWorkerContainerEventMap [ K ] ) => any , options ?: boolean | EventListenerOptions ) : void ;
1403
+ removeEventListener ( type : string , listener : EventListenerOrEventListenerObject , options ?: boolean | EventListenerOptions ) : void ;
1404
+ }
1405
+
1406
+ declare var ServiceWorkerContainer : {
1407
+ prototype : ServiceWorkerContainer ;
1408
+ new ( ) : ServiceWorkerContainer ;
1409
+ } ;
1410
+
1361
1411
interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
1362
1412
"activate" : ExtendableEvent ;
1363
1413
"fetch" : FetchEvent ;
@@ -1403,10 +1453,12 @@ interface ServiceWorkerRegistrationEventMap {
1403
1453
interface ServiceWorkerRegistration extends EventTarget {
1404
1454
readonly active : ServiceWorker | null ;
1405
1455
readonly installing : ServiceWorker | null ;
1456
+ readonly navigationPreload : NavigationPreloadManager ;
1406
1457
onupdatefound : ( ( this : ServiceWorkerRegistration , ev : Event ) => any ) | null ;
1407
1458
readonly pushManager : PushManager ;
1408
1459
readonly scope : string ;
1409
1460
readonly sync : SyncManager ;
1461
+ readonly updateViaCache : ServiceWorkerUpdateViaCache ;
1410
1462
readonly waiting : ServiceWorker | null ;
1411
1463
getNotifications ( filter ?: GetNotificationOptions ) : Promise < Notification [ ] > ;
1412
1464
showNotification ( title : string , options ?: NotificationOptions ) : Promise < void > ;
@@ -1547,7 +1599,7 @@ interface WindowClient extends Client {
1547
1599
readonly focused : boolean ;
1548
1600
readonly visibilityState : VisibilityState ;
1549
1601
focus ( ) : Promise < WindowClient > ;
1550
- navigate ( url : string ) : Promise < WindowClient > ;
1602
+ navigate ( url : string ) : Promise < WindowClient | null > ;
1551
1603
}
1552
1604
1553
1605
declare var WindowClient : {
@@ -1623,6 +1675,7 @@ declare var WorkerLocation: {
1623
1675
} ;
1624
1676
1625
1677
interface WorkerNavigator extends NavigatorID , NavigatorOnLine , NavigatorBeacon , NavigatorConcurrentHardware {
1678
+ readonly serviceWorker : ServiceWorkerContainer ;
1626
1679
}
1627
1680
1628
1681
declare var WorkerNavigator : {
@@ -1851,5 +1904,7 @@ type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
1851
1904
type RequestRedirect = "follow" | "error" | "manual" ;
1852
1905
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect" ;
1853
1906
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant" ;
1907
+ type ServiceWorkerUpdateViaCache = "imports" | "all" | "none" ;
1854
1908
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded" ;
1909
+ type WorkerType = "classic" | "module" ;
1855
1910
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text" ;
0 commit comments