dOrgTech/DAOcreator

`initStateStore` - Don't Assume LocalStorage

オープン

#243 opened on 2019/11/17

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (18 件のフォーク)auto 404
Libcode improvementgood first issuemed pri

Repository metrics

Stars
 (34 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Currently we've hard-coded our state persistence into the UI layer and are using the localStorage of the browser. We should instead be making API calls into the Lib layer, and using an interface the implementer of the library supplies upon initialization.

For example:

import { initStateStore } from "lib/state";

// localStorage in browser, file in CLI
setStateStore({
  getItem: (key: string) => { ... },
  setItem: (key: string, value: string) => { ... },
  clearItem: (key: string) => { ... }
});

// later in the application
getSavedDAO();
saveDAO(dao);

コントリビューターガイド