* @see https://w3c.github.io/ServiceWorker/#dom-cache-keys * @param {any} request * @param {import('../../types/cache').CacheQueryOptions} options * @returns {Promise }
()
| 16077 | webidl.brandCheck(this, _Cache); |
| 16078 | const prefix = "Cache.delete"; |
| 16079 | webidl.argumentLengthCheck(arguments, 1, prefix); |
| 16080 | request = webidl.converters.RequestInfo(request, prefix, "request"); |
| 16081 | options = webidl.converters.CacheQueryOptions(options, prefix, "options"); |
| 16082 | let r = null; |
| 16083 | if (request instanceof Request) { |
| 16084 | r = request[kState]; |
| 16085 | if (r.method !== "GET" && !options.ignoreMethod) { |
| 16086 | return false; |
| 16087 | } |
| 16088 | } else { |
| 16089 | assert(typeof request === "string"); |
| 16090 | r = new Request(request)[kState]; |
| 16091 | } |
| 16092 | const operations = []; |
| 16093 | const operation = { |
| 16094 | type: "delete", |
| 16095 | request: r, |
| 16096 | options |
| 16097 | }; |
| 16098 | operations.push(operation); |
| 16099 | const cacheJobPromise = createDeferredPromise(); |
| 16100 | let errorData = null; |
| 16101 | let requestResponses; |
| 16102 | try { |
| 16103 | requestResponses = __privateMethod(this, _batchCacheOperations, batchCacheOperations_fn).call(this, operations); |
| 16104 | } catch (e) { |
| 16105 | errorData = e; |
| 16106 | } |
| 16107 | queueMicrotask(() => { |
| 16108 | if (errorData === null) { |
| 16109 | cacheJobPromise.resolve(!!(requestResponses == null ? void 0 : requestResponses.length)); |
| 16110 | } else { |
| 16111 | cacheJobPromise.reject(errorData); |
| 16112 | } |
| 16113 | }); |
| 16114 | return cacheJobPromise.promise; |
| 16115 | }); |
| 16116 | } |
| 16117 | /** |
| 16118 | * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys |
| 16119 | * @param {any} request |
| 16120 | * @param {import('../../types/cache').CacheQueryOptions} options |
| 16121 | * @returns {Promise<readonly Request[]>} |
| 16122 | */ |
| 16123 | keys() { |
| 16124 | return __async(this, arguments, function* (request = void 0, options = {}) { |
| 16125 | webidl.brandCheck(this, _Cache); |
| 16126 | const prefix = "Cache.keys"; |
no test coverage detected