0
これは、電子(ドキュメントから)でウィンドウを作成するための標準的な方法です。ブラウザウィンドウでjavascriptを読み込む方法は?
let win;
function createWindow(){
// Create the browser window.
win = new BrowserWindow({width: 680, height: 420, frame: false, transparent: true, show: false});
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'test.html'),
protocol: 'file:',
slashes: true
}));
win.once('ready-to-show', function() {
win.show();
});
// Open the DevTools.
// win.webContents.openDevTools()
// Emitted when the window is closed.
win.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
})
}
が正常に動作しますが、どのように私はtest.htmlという中で<script>
タグを使用せずにウィンドウのコンテキストでは、などのjQueryのように、JavaScriptファイルの束をロードすることができますか?
スクリプトタグを使用したくない理由は、多数の.jsファイルと.htmlファイルを持つことができ、何か変更があるたびにhtmlを更新したくないからです。私はむしろウィンドウを作成する関数でそれらを持っています。