【发布时间】:2020-08-18 19:36:27
【问题描述】:
我目前正在做以下事情:
//main.js
let window = new BrowserWindow (
title: 'app',
webPreferences: {
preload: './preload.js'
},
)
//preload.js
window.teste = "hello"
//renderer.js
console.log(window.teste)
但我总是不确定,好像在预加载中完成的所有内容(需要等),没有全局范围或无法以任何方式访问
【问题讨论】:
-
什么是 renderer.js?你在哪里加载它?
-
renderer.js 只是我在 html 文件中使用的 js 文件
-
加载它我只是使用
-
你的代码没有说明你在哪里加载 index.html
标签: javascript node.js security electron