PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

34 lines
798B

  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. })();