@smart-code/data-center
v2.0.4
Published
数据中心
Downloads
70
Maintainers
Readme
提供数据代理
🏗 安装
# npm install
$ npm install @smart-code/data-center --save
# yarn install
$ yarn add @smart-code/data-center
# pnpm install
$ pnpm i @smart-code/data-center
🔨 使用
import { createStorePro } from '@smart-code/data-center';
const store = createStorePro<number>(
{
fetch: async function fetch() {
return await Promise.resolve(30);
},
},
);
await store.set('total', 0);
const data = await store.get('total'); // 0
const uptodateData = await store.get('total', { uptodate: true }); // 30
const cacheData = await store.getHistory(); // [0, 30]