testServices
补充信息
- 使用进程:渲染进程(webview)。
import { testServices } from '@modern-js/runtime/electron-webview';
testServices(services)
参数
- services:
{ [key: string]: unknown }
,需要被测试的服务。
返回值
{ [key: string]: unknown }
,返回传入的services
。
被 testServices
所包裹的函数,则可被测试框架所测试与使用。
示例
electron/preload/webview/index.ts
import { testServices } from '@modern-js/runtime/electron-test/webview';
...
export const apis = testServices({
...browserWindowPreloadApis,
openWindow: (winName: string) => callMain('openWindow', winName),
});
exposeInMainWorld(apis);