Skip to content

Instantly share code, notes, and snippets.

@Breta01
Last active September 3, 2016 18:38
Show Gist options
  • Save Breta01/1f735a892b4ed90263092449fd1b1925 to your computer and use it in GitHub Desktop.
Save Breta01/1f735a892b4ed90263092449fd1b1925 to your computer and use it in GitHub Desktop.
Implementing IndexedDB
/** Delete a stat **/
mkDB.deleteStat = function(id, callback) {
var db = datastore;
var transaction = db.transaction(['stats'], 'readwrite');
var objStore = transaction.objectStore('stats');
//Delete stat by timestamp (id)
var request = objStore.delete(id);
request.onsuccess = function(e) {
callback();
}
request.onerror = function(e) {
console.log(e);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment