You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
798 B
33 lines
798 B
/* public domain
|
|
* vim: set ts=4:
|
|
*/
|
|
|
|
RED.storage = (function() {
|
|
function update() {
|
|
// TOOD: use setTimeout to limit the rate of changes?
|
|
if (localStorage) {
|
|
var nns = RED.nodes.createCompleteNodeSet();
|
|
localStorage.setItem("audio_library_guitool", JSON.stringify(nns));
|
|
//console.log("localStorage write");
|
|
}
|
|
}
|
|
function load() {
|
|
if (localStorage) {
|
|
var data = localStorage.getItem("audio_library_guitool");
|
|
//console.log("localStorage read: " + data);
|
|
if (data) RED.nodes.import(data, false);
|
|
}
|
|
}
|
|
function clear() {
|
|
// TOOD: use setTimeout to limit the rate of changes?
|
|
if (localStorage) {
|
|
localStorage.removeItem("audio_library_guitool");
|
|
//console.log("localStorage write");
|
|
}
|
|
}
|
|
return {
|
|
update: update,
|
|
load: load,
|
|
clear: clear
|
|
}
|
|
})();
|
|
|