Skip to content

foca-js/foca-cookie-storage

Repository files navigation

foca-cookie-storage

Foca 持久化 cookie 引擎,基于 document.cookie API。

GitHub Workflow Status (branch) Codecov License npm

安装

yarn add foca-cookie-storage

使用

import { store } from 'foca';
import { cookieStorage, CookieStorage } from 'foca-cookie-storage';

store.init({
  persist: [
    {
      key: 'my-project',
      version: '1',
      // 默认配置
      engine: cookieStorage,
      models: [],
    },
    {
      key: 'my-project-1',
      version: '1',
      // 自定义配置
      engine: new CookieStorage({
        // ...
      }),
      models: [],
    },
  ],
});