mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
🔨 Refactor: remove unused class
This commit is contained in:
parent
835c98cd22
commit
5f1635fb1c
@ -56,7 +56,6 @@ app.config.globalProperties.$builtInPicBed = [
|
||||
'local',
|
||||
'sftpplist'
|
||||
]
|
||||
app.config.unwrapInjectedRef = true
|
||||
|
||||
app.config.globalProperties.$$db = db
|
||||
app.config.globalProperties.$http = axios
|
||||
|
@ -1,19 +0,0 @@
|
||||
class LS {
|
||||
get (name: string) {
|
||||
const item = localStorage.getItem(name)
|
||||
if (item) {
|
||||
try {
|
||||
return JSON.parse(item)
|
||||
} catch (e) {
|
||||
console.error('Failed to parse JSON:', e)
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
set (name: string, value: any): void {
|
||||
localStorage.setItem(name, JSON.stringify(value))
|
||||
}
|
||||
}
|
||||
|
||||
export default new LS()
|
@ -21,7 +21,7 @@ export function saveConfig (config: IObj | string, value?: any) {
|
||||
export function getConfig<T> (key?: string): Promise<T | undefined> {
|
||||
return new Promise((resolve) => {
|
||||
const callbackId = uuid()
|
||||
const callback = (event: IpcRendererEvent, config: T | undefined, returnCallbackId: string) => {
|
||||
const callback = (_event: IpcRendererEvent, config: T | undefined, returnCallbackId: string) => {
|
||||
if (returnCallbackId === callbackId) {
|
||||
resolve(config)
|
||||
ipcRenderer.removeListener(PICGO_GET_CONFIG, callback)
|
||||
@ -39,7 +39,7 @@ export function getConfig<T> (key?: string): Promise<T | undefined> {
|
||||
export function triggerRPC<T> (action: IRPCActionType, ...args: any[]): Promise<T | null> {
|
||||
return new Promise((resolve) => {
|
||||
const callbackId = uuid()
|
||||
const callback = (event: IpcRendererEvent, data: T | null, returnActionType: IRPCActionType, returnCallbackId: string) => {
|
||||
const callback = (_event: IpcRendererEvent, data: T | null, returnActionType: IRPCActionType, returnCallbackId: string) => {
|
||||
if (returnCallbackId === callbackId && returnActionType === action) {
|
||||
resolve(data)
|
||||
ipcRenderer.removeListener(RPC_ACTIONS, callback)
|
||||
@ -61,9 +61,6 @@ export function sendRPC (action: IRPCActionType, ...args: any[]): void {
|
||||
ipcRenderer.send(RPC_ACTIONS, action, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be replaced by sendRPC in the future
|
||||
*/
|
||||
export function sendToMain (channel: string, ...args: any[]) {
|
||||
const data = getRawData(args)
|
||||
ipcRenderer.send(channel, ...data)
|
||||
|
Loading…
Reference in New Issue
Block a user