UNPKG

wdio-electron-service

Version:

WebdriverIO service to enable Electron testing

22 lines (20 loc) 779 B
import electron, { app, ipcMain } from 'electron'; import copy from 'fast-copy'; import { a as Channel } from './constants-hw-pQOyp.js'; // TODO: This file should be remove at V9 globalThis.originalApi = {}; // store electron API app.whenReady().then(() => { for (const api in electron) { const apiName = api; globalThis.originalApi[apiName] = {}; for (const apiElement in electron[apiName]) { const apiElementName = apiElement; globalThis.originalApi[apiName][apiElementName] = copy(electron[apiName][apiElementName]); } } }); ipcMain.handle(Channel.Execute, (_event, script, args) => { return new Function(`return (${script}).apply(this, arguments)`)(electron, ...args); }); //# sourceMappingURL=main.js.map