🔨 Refactor: remove unused class

This commit is contained in:
萌萌哒赫萝 2023-09-04 06:11:12 -07:00
parent 835c98cd22
commit 5f1635fb1c
3 changed files with 2 additions and 25 deletions

View File

@ -56,7 +56,6 @@ app.config.globalProperties.$builtInPicBed = [
'local',
'sftpplist'
]
app.config.unwrapInjectedRef = true
app.config.globalProperties.$$db = db
app.config.globalProperties.$http = axios

View File

@ -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()

View File

@ -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)