Skip to content

Instantly share code, notes, and snippets.

@arackaf
Created January 20, 2019 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arackaf/ab3d8ca11c5cec64c1a26f7a1d376558 to your computer and use it in GitHub Desktop.
Save arackaf/ab3d8ca11c5cec64c1a26f7a1d376558 to your computer and use it in GitHub Desktop.
function deleteItem(_id, table) {
let open = indexedDB.open("books", 1);
return new Promise(res => {
open.onsuccess = evt => {
let db = open.result;
let tran = db.transaction(table, "readwrite");
let objStore = tran.objectStore(table);
objStore.delete(_id).onsuccess = res;
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment