code: function persistentStateProvider(publicAPI, model) {
    if (!model.persistentStateImpl) {
      if (localStorageAvailable()) {
        model.persistentStateImpl = {
          getState: (key) => {
            const strVal = window.localStorage[key];
            if (strVal === undefined) {
              return null;
            }
            return JSON.parse(strVal);
          },
          setState: (key, value) => {
            window.localStorage.setItem(key, JSON.stringify(value));
          },
        };
      } else {
        model.persistentStateImpl = {
          state: {},
          getState: (key) => model.persistentStateImpl.state[key],
          setState: (key, value) => {
            model.persistentStateImpl.state[key] = value;
          },
        };
      }
    }
  
    // Provide this method an object that implements getState(key) and setState(key, value)
    publicAPI.setImplementation = (impl) => {
      model.persistentStateImpl = impl;
    };
  
    publicAPI.getPersistentState = (key) =>
      model.persistentStateImpl.getState(key);
  
    publicAPI.setPersistentState = (key, value) => {
      model.persistentStateImpl.setState(key, value);
    };
  }
docs: ---------------------------------------------------------------------------- Persistence Provider ----------------------------------------------------------------------------