ocoge/preload.js

20 lines
647 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const electron = require("electron")
const path = require('path')
electron.contextBridge.exposeInMainWorld(
"ocogeapi",
{
// Electron固有index.htmlから直接 <script src で呼ばれたJSファイルでのみ利用可
electron_ipcRenderer: electron.ipcRenderer,
electron_shell: electron.shell,
// どこからでも呼び出し可
fs: require('fs'),
path: path,
child_process: require('child_process'),
lgpio: require('@ocogeclub/lgpio'),
bme280: require('@ocogeclub/bme280'),
// グローバル変数
gtest: 'qwerty' // テスト用
}
);