UNPKG

vuex-state-storage-sync

Version:
48 lines (44 loc) โ€ข 1.9 kB
import { MutationPayload, Store } from 'vuex'; /***************************************************************** * VUEX-STATE-STORAGE-SYNC - Minimal Persist/Synchronize State Plugin for Vuex * (c) 2024-present AGUMON (https://github.com/ljlm0402/vuex-state-storage-sync) * * This source code is licensed under the MIT license. * See the LICENSE file in the project root for more information. * * Made with โค๏ธ by AGUMON ๐Ÿฆ– *****************************************************************/ /** * Storage ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜ * removeItem์€ optional๋กœ ๋‘์–ด ๋‹ค์–‘ํ•œ storage ์—”์ง„์„ ์ง€์› */ interface Storage { getItem: (key: string) => string | null; setItem: (key: string, value: string) => void; removeItem?: (key: string) => void; } type ArrayMergeFn = (storeArr: any[], savedArr: any[]) => any[]; interface Options<State> { key?: string; storage?: Storage; paths?: string[]; overwrite?: boolean; fetchBeforeUse?: boolean; getState?: (key: string, storage: Storage) => any; setState?: (key: string, state: any, storage: Storage) => void; removeState?: (key: string, storage: Storage) => void; reducer?: (state: State, paths?: string[]) => object; filter?: (mutation: MutationPayload) => boolean; merge?: (obj1: object | any[], obj2: object | any[], options: object) => object | any[]; arrayMerge?: ArrayMergeFn; arrayMerger?: ArrayMergeFn; rehydrated?: (store: Store<State>) => void; subscriber?: (store: Store<State>) => (handler: (mutation: any, state: State) => void) => void; assertStorage?: (storage: Storage) => void | Error; } /** * vuex-state-storage-sync ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ฉ”์ธ ํ•จ์ˆ˜ * @param options ์‚ฌ์šฉ์ž ์ง€์ • ์˜ต์…˜ */ declare function export_default<State extends object = any>(options?: Options<State>): (store: Store<State>) => void; export { export_default as default };