How to use the @freesewing/utils/storage.set function in @freesewing/utils

To help you get started, we’ve selected a few @freesewing/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freesewing / freesewing / packages / components / src / withGist / index.js View on Github external
setGist(gist) {
      this.setState({ gist });
      if (settings.store) storage.set(this.state.gist.name || "gist", gist);
    }
github freesewing / freesewing / packages / components / src / withGist / index.js View on Github external
updateGist(value, l1 = false, l2 = false, l3 = false) {
      if (!l1) return;
      let gist = this.state.gist;

      if (l2 && typeof gist[l1] === "undefined") gist[l1] = {};
      if (l3 && typeof gist[l1][l2] === "undefined") gist[l1][l2] = {};

      if (l3) gist[l1][l2][l3] = value;
      else if (l2) gist[l1][l2] = value;
      else gist[l1] = value;
      this.setState({ gist });
      if (settings.store) storage.set(this.state.gist.name || "gist", gist);
    }
github freesewing / freesewing / packages / components / src / withStorage / index.js View on Github external
updateStorageData(value, l1 = false, l2 = false, l3 = false) {
      if (!l1) return;
      let data = this.state.data;

      if (l2 && typeof data[l1] === "undefined") data[l1] = {};
      if (l3 && typeof data[l1][l2] === "undefined") data[l1][l2] = {};

      if (l3) data[l1][l2][l3] = value;
      else if (l2) data[l1][l2] = value;
      else data[l1] = value;
      this.setState({ data });
      storage.set(name, data);
    }