Skip to content

Instantly share code, notes, and snippets.

View cindywu's full-sized avatar
🍍
i do not want to turn into dust, but into ashes instead

Cindy Wu cindywu

🍍
i do not want to turn into dust, but into ashes instead
View GitHub Profile
@cindywu
cindywu / IndexedDB101.js
Created July 13, 2021 03:18 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});