Last active
August 29, 2015 14:05
-
-
Save hpstuff/cb55233e7097cab0efdd to your computer and use it in GitHub Desktop.
Icomoon local data save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dbrequest = indexedDB.open("IDBWrapper-storage", 1); | |
var db; | |
dbrequest.onsuccess = function(e) { | |
db = e.target.result; | |
}; | |
function getData(){ | |
var trans = db.transaction(["storage"], "readwrite"); | |
var store = trans.objectStore("storage"); | |
var request = store.get('icomoon'); | |
request.onsuccess = function(event){ | |
console.log("Result", request.result); | |
var blob = new Blob([JSON.stringify(request.result)]); | |
window.location.href = window.URL.createObjectURL(blob); | |
}; | |
} | |
function loadData(data){ | |
var trans = db.transaction(["storage"], "readwrite"); | |
var store = trans.objectStore("storage"); | |
var request = store.put(JSON.parse(data)); | |
request.onsuccess = function(event){ | |
console.log("Result", request.result); | |
}; | |
request.onerror = function(){ | |
console.log(event); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment