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
|
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Service Workers Nightly (https://w3c.github.io/ServiceWorker/)
[SecureContext, Exposed=(Window,Worker)]
interface ServiceWorker : EventTarget {
readonly attribute USVString scriptURL;
readonly attribute ServiceWorkerState state;
undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
// event
attribute EventHandler onstatechange;
};
ServiceWorker includes AbstractWorker;
enum ServiceWorkerState {
"parsed",
"installing",
"installed",
"activating",
"activated",
"redundant"
};
[SecureContext, Exposed=(Window,Worker)]
interface ServiceWorkerRegistration : EventTarget {
readonly attribute ServiceWorker? installing;
readonly attribute ServiceWorker? waiting;
readonly attribute ServiceWorker? active;
[SameObject] readonly attribute NavigationPreloadManager navigationPreload;
readonly attribute USVString scope;
readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
[NewObject] Promise<ServiceWorkerRegistration> update();
[NewObject] Promise<boolean> unregister();
// event
attribute EventHandler onupdatefound;
};
enum ServiceWorkerUpdateViaCache {
"imports",
"all",
"none"
};
partial interface Navigator {
[SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
};
partial interface WorkerNavigator {
[SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
};
[SecureContext, Exposed=(Window,Worker)]
interface ServiceWorkerContainer : EventTarget {
readonly attribute ServiceWorker? controller;
readonly attribute Promise<ServiceWorkerRegistration> ready;
[NewObject] Promise<ServiceWorkerRegistration> register((TrustedScriptURL or USVString) scriptURL, optional RegistrationOptions options = {});
[NewObject] Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString clientURL = "");
[NewObject] Promise<FrozenArray<ServiceWorkerRegistration>> getRegistrations();
undefined startMessages();
// events
attribute EventHandler oncontrollerchange;
attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
attribute EventHandler onmessageerror;
};
dictionary RegistrationOptions {
USVString scope;
WorkerType type = "classic";
ServiceWorkerUpdateViaCache updateViaCache = "imports";
};
[SecureContext, Exposed=(Window,Worker)]
interface NavigationPreloadManager {
Promise<undefined> enable();
Promise<undefined> disable();
Promise<undefined> setHeaderValue(ByteString value);
Promise<NavigationPreloadState> getState();
};
dictionary NavigationPreloadState {
boolean enabled = false;
ByteString headerValue;
};
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker, SecureContext]
interface ServiceWorkerGlobalScope : WorkerGlobalScope {
[SameObject] readonly attribute Clients clients;
[SameObject] readonly attribute ServiceWorkerRegistration registration;
[SameObject] readonly attribute ServiceWorker serviceWorker;
[NewObject] Promise<undefined> skipWaiting();
attribute EventHandler oninstall;
attribute EventHandler onactivate;
attribute EventHandler onfetch;
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};
[Exposed=ServiceWorker]
interface Client {
readonly attribute USVString url;
readonly attribute FrameType frameType;
readonly attribute DOMString id;
readonly attribute ClientType type;
undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
};
[Exposed=ServiceWorker]
interface WindowClient : Client {
readonly attribute DocumentVisibilityState visibilityState;
readonly attribute boolean focused;
[SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins;
[NewObject] Promise<WindowClient> focus();
[NewObject] Promise<WindowClient?> navigate(USVString url);
};
enum FrameType {
"auxiliary",
"top-level",
"nested",
"none"
};
[Exposed=ServiceWorker]
interface Clients {
// The objects returned will be new instances every time
[NewObject] Promise<(Client or undefined)> get(DOMString id);
[NewObject] Promise<FrozenArray<Client>> matchAll(optional ClientQueryOptions options = {});
[NewObject] Promise<WindowClient?> openWindow(USVString url);
[NewObject] Promise<undefined> claim();
};
dictionary ClientQueryOptions {
boolean includeUncontrolled = false;
ClientType type = "window";
};
enum ClientType {
"window",
"worker",
"sharedworker",
"all"
};
[Exposed=ServiceWorker]
interface ExtendableEvent : Event {
constructor(DOMString type, optional ExtendableEventInit eventInitDict = {});
undefined waitUntil(Promise<any> f);
};
dictionary ExtendableEventInit : EventInit {
// Defined for the forward compatibility across the derived events
};
[Exposed=ServiceWorker]
interface InstallEvent : ExtendableEvent {
constructor(DOMString type, optional ExtendableEventInit eventInitDict = {});
Promise<undefined> addRoutes((RouterRule or sequence<RouterRule>) rules);
};
dictionary RouterRule {
required RouterCondition condition;
required RouterSource source;
};
dictionary RouterCondition {
URLPatternCompatible urlPattern;
ByteString requestMethod;
RequestMode requestMode;
RequestDestination requestDestination;
RunningStatus runningStatus;
sequence<RouterCondition> _or;
RouterCondition not;
};
typedef (RouterSourceDict or RouterSourceEnum) RouterSource;
dictionary RouterSourceDict {
DOMString cacheName;
};
enum RunningStatus { "running", "not-running" };
enum RouterSourceEnum {
"cache",
"fetch-event",
"network",
"race-network-and-fetch-handler"
};
[Exposed=ServiceWorker]
interface FetchEvent : ExtendableEvent {
constructor(DOMString type, FetchEventInit eventInitDict);
[SameObject] readonly attribute Request request;
readonly attribute Promise<any> preloadResponse;
readonly attribute DOMString clientId;
readonly attribute DOMString resultingClientId;
readonly attribute DOMString replacesClientId;
readonly attribute Promise<undefined> handled;
undefined respondWith(Promise<Response> r);
};
dictionary FetchEventInit : ExtendableEventInit {
required Request request;
Promise<any> preloadResponse;
DOMString clientId = "";
DOMString resultingClientId = "";
DOMString replacesClientId = "";
Promise<undefined> handled;
};
[Exposed=ServiceWorker]
interface ExtendableMessageEvent : ExtendableEvent {
constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {});
readonly attribute any data;
readonly attribute USVString origin;
readonly attribute DOMString lastEventId;
[SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
readonly attribute FrozenArray<MessagePort> ports;
};
dictionary ExtendableMessageEventInit : ExtendableEventInit {
any data = null;
USVString origin = "";
DOMString lastEventId = "";
(Client or ServiceWorker or MessagePort)? source = null;
sequence<MessagePort> ports = [];
};
partial interface mixin WindowOrWorkerGlobalScope {
[SecureContext, SameObject] readonly attribute CacheStorage caches;
};
[SecureContext, Exposed=(Window,Worker)]
interface Cache {
[NewObject] Promise<(Response or undefined)> match(RequestInfo request, optional CacheQueryOptions options = {});
[NewObject] Promise<FrozenArray<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options = {});
[NewObject] Promise<undefined> add(RequestInfo request);
[NewObject] Promise<undefined> addAll(sequence<RequestInfo> requests);
[NewObject] Promise<undefined> put(RequestInfo request, Response response);
[NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options = {});
[NewObject] Promise<FrozenArray<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options = {});
};
dictionary CacheQueryOptions {
boolean ignoreSearch = false;
boolean ignoreMethod = false;
boolean ignoreVary = false;
};
[SecureContext, Exposed=(Window,Worker)]
interface CacheStorage {
[NewObject] Promise<(Response or undefined)> match(RequestInfo request, optional MultiCacheQueryOptions options = {});
[NewObject] Promise<boolean> has(DOMString cacheName);
[NewObject] Promise<Cache> open(DOMString cacheName);
[NewObject] Promise<boolean> delete(DOMString cacheName);
[NewObject] Promise<sequence<DOMString>> keys();
};
dictionary MultiCacheQueryOptions : CacheQueryOptions {
DOMString cacheName;
};
|