2023-10-19 05:44:17 +02:00
|
|
|
import Store from 'electron-store'
|
2023-10-25 12:17:19 +02:00
|
|
|
import { isEqual } from 'lodash-es'
|
2023-10-19 05:44:17 +02:00
|
|
|
import { createProxy } from './index.js'
|
|
|
|
|
|
|
|
const appStore = new Store()
|
|
|
|
|
2023-10-25 12:17:19 +02:00
|
|
|
// 如果没有数据则手动设置值,以保证配置文件生成成功
|
|
|
|
if (isEqual(appStore.store, {})) {
|
|
|
|
appStore.store = {}
|
|
|
|
}
|
2023-10-19 05:44:17 +02:00
|
|
|
|
|
|
|
export default {
|
2024-09-12 13:11:46 +02:00
|
|
|
...appStore,
|
2023-10-19 05:44:17 +02:00
|
|
|
...createProxy(appStore, [
|
|
|
|
'set',
|
|
|
|
'get',
|
|
|
|
'delete',
|
|
|
|
'clear',
|
|
|
|
'reset',
|
|
|
|
'has',
|
|
|
|
'onDidChange',
|
|
|
|
'onDidAnyChange',
|
|
|
|
'openInEditor',
|
|
|
|
]),
|
|
|
|
getAll: () => appStore.store,
|
|
|
|
setAll: value => (appStore.store = value),
|
|
|
|
}
|