1.2.1 • Published 9 months ago

lili-store v1.2.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
9 months ago

ciqtek-store

一个适用于electron 多页项目的store,利用主线程作为数据中转,IPC通信(命名管道)。

NPM version

安装

yarn add ciqtek-store

or

npm i ciqtek-store --save

使用

主线程引用

import { Store } from 'ciqtek-store'

const store = new Store(config)

config:{
  saveConfig: {
    storeName?:string // store名称,如果需要固化,用于本地保存文件名称
    interval?: number // 自动数据本地固化时间间隔
    storeUrl?: string // 自定义本地数据路径
  }
  fieldMap: FieldMap // 字典,用于判断合法字段、默认值、字段类型以及是否需要本地固化
}

渲染进程使用

import { dispatch, regist, getField, persistedStore } from 'ciqtek-store'

data() {
  return {
    localStore:{
      key:value
    }
  }
}

初始化本地数据

async initStore() {
  const { message } = await regist(this.localStore)
}

快速更新

async dispatch (fields, data) {
  return await dispatch(fields, data)
}

获取单个字段数据

async getField (field) {
  return await getField(field)
}

数据固化

async persistedStore () {
  return await persistedStore()
}
1.2.0

11 months ago

1.2.1

9 months ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago