You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
23 KiB
JavaScript

9 months ago
"use strict";
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
exports.id = "vendor-chunks/idb-keyval";
exports.ids = ["vendor-chunks/idb-keyval"];
exports.modules = {
/***/ "(ssr)/./node_modules/idb-keyval/dist/index.js":
/*!***********************************************!*\
!*** ./node_modules/idb-keyval/dist/index.js ***!
\***********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clear: () => (/* binding */ clear),\n/* harmony export */ createStore: () => (/* binding */ createStore),\n/* harmony export */ del: () => (/* binding */ del),\n/* harmony export */ delMany: () => (/* binding */ delMany),\n/* harmony export */ entries: () => (/* binding */ entries),\n/* harmony export */ get: () => (/* binding */ get),\n/* harmony export */ getMany: () => (/* binding */ getMany),\n/* harmony export */ keys: () => (/* binding */ keys),\n/* harmony export */ promisifyRequest: () => (/* binding */ promisifyRequest),\n/* harmony export */ set: () => (/* binding */ set),\n/* harmony export */ setMany: () => (/* binding */ setMany),\n/* harmony export */ update: () => (/* binding */ update),\n/* harmony export */ values: () => (/* binding */ values)\n/* harmony export */ });\nfunction promisifyRequest(request) {\n return new Promise((resolve, reject)=>{\n // @ts-ignore - file size hacks\n request.oncomplete = request.onsuccess = ()=>resolve(request.result);\n // @ts-ignore - file size hacks\n request.onabort = request.onerror = ()=>reject(request.error);\n });\n}\nfunction createStore(dbName, storeName) {\n const request = indexedDB.open(dbName);\n request.onupgradeneeded = ()=>request.result.createObjectStore(storeName);\n const dbp = promisifyRequest(request);\n return (txMode, callback)=>dbp.then((db)=>callback(db.transaction(storeName, txMode).objectStore(storeName)));\n}\nlet defaultGetStoreFunc;\nfunction defaultGetStore() {\n if (!defaultGetStoreFunc) {\n defaultGetStoreFunc = createStore(\"keyval-store\", \"keyval\");\n }\n return defaultGetStoreFunc;\n}\n/**\n * Get a value by its key.\n *\n * @param key\n * @param customStore Method to get a custom store. Use with caution (see the docs).\n */ function get(key, customStore = defaultGetStore()) {\n return customStore(\"readonly\", (store)=>promisifyRequest(store.get(key)));\n}\n/**\n * Set a value with a key.\n *\n * @param key\n * @param value\n * @param customStore Method to get a custom store. Use with caution (see the docs).\n */ function set(key, value, customStore = defaultGetStore()) {\n return customStore(\"readwrite\", (store)=>{\n store.put(value, key);\n return promisifyRequest(store.transaction);\n });\n}\n/**\n * Set multiple values at once. This is faster than calling set() multiple times.\n * It's also atomic if one of the pairs can't be added, none will be added.\n *\n * @param entries Array of entries, where each entry is an array of `[key, value]`.\n * @param customStore Method to get a custom store. Use with caution (see the docs).\n */ function setMany(entries, customStore = defaultGetStore()) {\n return customStore(\"readwrite\", (store)=>{\n entries.forEach((entry)=>store.put(entry[1], entry[0]));\n return promisifyRequest(store.transaction);\n });\n}\n/**\n * Get multiple values by their keys\n *\n * @param keys\n * @param customStore Method to get a custom store. Use with caution (see the docs).\n */ function getMany(keys, customStore = defaultGetStore()) {\n return customStore(\"readonly\", (store)=>Promise.all(keys.map((key)=>promisifyRequest(store.get(key)))));\n}\n/**\n * Update a value. This lets you see the old value and update it as an atomic operation.\n *\n * @param key\n * @param updater A callback that takes the old value and returns a new value.\n * @param customStore Method to get a custom store. Use with caution (see the docs).\n */ function update(key, updater, customStore = defaultGetStore()) {\n return customStore(\"readwrite\", (store)=>// Need to create the promise manually.\n // If I try to chain promises, the transaction closes in browsers\n // that use a promise polyfill (IE10/11).\n new Promise((resolve, reject)=>{\n store.get(key).onsuccess = function() {\n try {\n
/***/ })
};
;