restoreState() {
      if (!_StateManager.isStorageAvailable()) {
        console.warn("localStorage is not available");
        return null;
      }
      try {
        const savedState = localStorage.getItem(this.options.id);
        if (savedState) {
          const parsed = JSON.parse(savedState);
          Object.assign(this.store.state, parsed.data);
          this.emit("restoreState", parsed);
          return parsed;
        }
      } catch (error) {
        this.emit("restoreStateError", error);
      }
    }
Restores the state from localStorage.
@returns {any|null}