escrcpy/electron/helpers/index.js
2023-10-16 00:18:24 +08:00

16 lines
281 B
JavaScript

import { contextBridge } from 'electron'
export function exposeContext(key, value) {
if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld(key, value)
}
catch (error) {
console.error(error)
}
}
else {
window[key] = value
}
}