dOrgTech/DAOcreator

`initStateStore` - Don't Assume LocalStorage

開放

#243 建立於 2019年11月17日

 (0 則留言) (0 個反應) (0 位負責人)TypeScript (18 個分叉)auto 404
Libcode improvementgood first issuemed pri

倉庫指標

星標
 (34 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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);

貢獻者指南