UNPKG

@sanpjs/runtime

Version:

San Pro Runtime

43 lines (42 loc) 1.07 kB
/** * @file san store 类的基本封装 * store 没有初始化数据,会导致多写一写代码。。 */ import { Store as SanStore } from 'san-store'; interface SanStoreConfig { name?: string; initData?: { [k: string]: any; }; actions?: { [k: string]: Function; }; log?: boolean; } declare class Store extends SanStore { constructor(options: SanStoreConfig); /** * 初始化数据 * @param {Object} data 初始化数据 */ initData(data: { [k: string]: any; }): this; /** * 批量添加action */ addActions(actions: { [k: string]: Function; }): this; } export declare const keyZipObject: (keyList: string[]) => {}; declare const connectComponent: <T>(store: typeof SanStore, component: T) => T; declare const _default: Store; /** * 默认的全局 Store 实例 * 通常我们认为在一个应用应该具有一个全局唯一的 store,管理整个应用状态 * * @type {Store} */ export default _default; export { Store, connectComponent };