mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-28 19:47:17 +08:00
🔨 Refactor(custom): refactored all imports
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
import { PICLIST_MANAGE_GET_CONFIG, PICLIST_MANAGE_SAVE_CONFIG, PICLIST_MANAGE_REMOVE_CONFIG } from '~/main/manage/events/constants'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
import { getRawData } from '~/renderer/utils/common'
|
||||
|
||||
import { getRawData } from '@/utils/common'
|
||||
|
||||
import { PICLIST_MANAGE_GET_CONFIG, PICLIST_MANAGE_SAVE_CONFIG, PICLIST_MANAGE_REMOVE_CONFIG } from '~/manage/events/constants'
|
||||
|
||||
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 = (_: IpcRendererEvent, config: T | undefined, returnCallbackId: string) => {
|
||||
if (returnCallbackId === callbackId) {
|
||||
resolve(config)
|
||||
ipcRenderer.removeListener(PICLIST_MANAGE_GET_CONFIG, callback)
|
||||
|
||||
Reference in New Issue
Block a user