JSFiddle - React, Tailwind, and code Playground
by András Parditka
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/iife/index-min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/eu81273/jsfiddle-console/console.js"></script>
JavaScript
main()
async function main() {
try {
const db = await idb.openDB('test-db', 1, {
upgrade: async (db, oldVersion, newVersion, t) => {
t.db.createObjectStore('settings-store')
}
})
const t = db.transaction('settings-store', 'readwrite')
const settingsStore = t.objectStore('settings-store')
await settingsStore.put('foo', 'bar')
await settingsStore.put('baz', 'quux')
console.log(await settingsStore.get('bar'))
console.log(await settingsStore.get('quux'))
await t.done
console.log('Done!')
} catch (e) {
console.error(e)
}
}