您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233
  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. function clear() {
  21. // TOOD: use setTimeout to limit the rate of changes?
  22. if (localStorage) {
  23. localStorage.removeItem("audio_library_guitool");
  24. //console.log("localStorage write");
  25. }
  26. }
  27. return {
  28. update: update,
  29. load: load,
  30. clear: clear
  31. }
  32. })();