feat: 新增包文件

This commit is contained in:
duanshuwen
2025-11-15 22:41:50 +08:00
parent 7b65193e5c
commit 7ada85f175
104 changed files with 11273 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import { contextBridge, ipcRenderer } from 'electron'
import { injectBrowserAction } from '../../src/browser-action'
// This should go without saying, but you should never do this in a production
// app. These bindings are purely for testing convenience.
const apiName = 'electronTest'
const api = {
sendIpc(channel: string, ...args: any[]) {
return ipcRenderer.send(channel, ...args)
},
invokeIpc(channel: string, ...args: any[]) {
return ipcRenderer.invoke(channel, ...args)
},
}
try {
contextBridge.exposeInMainWorld(apiName, api)
} catch {
window[apiName] = api
}
// Inject in all test pages.
injectBrowserAction()