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.

26 line
584B

  1. /* public domain
  2. * vim: set ts=4:
  3. */
  4. RED.storage = (function() {
  5. function update() {
  6. // TOOD: use setTimeout to limit the rate of changes?
  7. if (localStorage) {
  8. var nns = RED.nodes.createCompleteNodeSet();
  9. localStorage.setItem("audio_library_guitool", JSON.stringify(nns));
  10. //console.log("localStorage write");
  11. }
  12. }
  13. function load() {
  14. if (localStorage) {
  15. var data = localStorage.getItem("audio_library_guitool");
  16. //console.log("localStorage read: " + data);
  17. if (data) RED.nodes.import(data, false);
  18. }
  19. }
  20. return {
  21. update: update,
  22. load: load
  23. }
  24. })();