Skip to content

Instantly share code, notes, and snippets.

@arackaf
Created January 20, 2019 01:08
Show Gist options
  • 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