🚧 WIP(custom): v3.0.0 migrate to vite and esm

This commit is contained in:
Kuingsmile
2025-07-31 17:37:30 +08:00
parent cd76bc7c10
commit 054f4b4cff
597 changed files with 197292 additions and 13329 deletions

View File

@@ -1,14 +1,12 @@
import { IRPCActionType } from 'root/src/universal/types/enum'
import { onMounted, onUnmounted } from 'vue'
import { sendRPC } from '@/utils/common'
import { IRPCActionType } from 'root/src/universal/types/enum'
export function useATagClick() {
export function useATagClick () {
const handleATagClick = (e: MouseEvent) => {
if (e.target instanceof HTMLAnchorElement) {
if (e.target.href) {
e.preventDefault()
sendRPC(IRPCActionType.OPEN_URL, e.target.href)
window.electron.sendRPC(IRPCActionType.OPEN_URL, e.target.href)
}
}
}

View File

@@ -1,30 +0,0 @@
import { ipcRenderer } from 'electron'
import { onUnmounted } from 'vue'
import { IRPCActionType } from '#/types/enum'
export const useIPCOn = (channel: string, listener: IpcRendererListener) => {
ipcRenderer.on(channel, listener)
onUnmounted(() => {
ipcRenderer.removeListener(channel, listener)
})
}
export const useIPCOnce = (channel: string, listener: IpcRendererListener) => {
ipcRenderer.once(channel, listener)
onUnmounted(() => {
ipcRenderer.removeListener(channel, listener)
})
}
/**
* will auto removeListener when component unmounted
*/
export const useIPC = () => {
return {
on: (channel: IRPCActionType, listener: IpcRendererListener) => useIPCOn(channel, listener),
once: (channel: IRPCActionType, listener: IpcRendererListener) => useIPCOnce(channel, listener)
}
}

View File

@@ -1,4 +1,5 @@
import { inject } from 'vue'
import { storeKey } from '@/store'
export const useStore = () => {