mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-31 07:59:42 +08:00
🚧 WIP(custom): v3.0.0 migrate to vite and esm
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { sendRPC, triggerRPC } from '@/utils/common'
|
||||
|
||||
import { IRPCActionType } from '#/types/enum'
|
||||
import { IObj } from '#/types/types'
|
||||
|
||||
export function saveConfig(config: IObj | string, value?: any) {
|
||||
export function saveConfig (config: IObj | string, value?: any) {
|
||||
const configObj = typeof config === 'string' ? { [config]: value } : config
|
||||
sendRPC(IRPCActionType.MANAGE_SAVE_CONFIG, configObj)
|
||||
window.electron.sendRPC(IRPCActionType.MANAGE_SAVE_CONFIG, configObj)
|
||||
}
|
||||
|
||||
export async function getConfig<T>(key?: string): Promise<T | undefined> {
|
||||
return await triggerRPC<T>(IRPCActionType.MANAGE_GET_CONFIG, key)
|
||||
export async function getConfig<T> (key?: string): Promise<T | undefined> {
|
||||
return await window.electron.triggerRPC<T>(IRPCActionType.MANAGE_GET_CONFIG, key)
|
||||
}
|
||||
|
||||
export function removeConfig(key: string, propName: string) {
|
||||
sendRPC(IRPCActionType.MANAGE_REMOVE_CONFIG, key, propName)
|
||||
export function removeConfig (key: string, propName: string) {
|
||||
window.electron.sendRPC(IRPCActionType.MANAGE_REMOVE_CONFIG, key, propName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user