[英]How do run reload() and open() in Atom-Shell
1) Is this javascript call not supported on Atom-shell? 1) Atom-shell 不支持这个 javascript 调用吗? window.open('#/openpage','_self',false) window.open('#/openpage','_self',false)
2) In NodeJS-Webkit, I could either reload the HTML with win.reload() without the toolbar and buttons. 2) 在 NodeJS-Webkit 中,我可以使用 win.reload() 重新加载 HTML,而无需工具栏和按钮。 Is Atom-shell support this API as well? Atom-shell 是否也支持这个 API?
3) In the app.js that is program to index.html into the Atom-shell 3) 在 app.js 中将 index.html 写入 Atom-shell
var BrowserWindow = require('browser-window');
and index.html tried to execute a reload command and failed that BrowserWindow is not defined.并且 index.html 尝试执行重新加载命令,但未定义 BrowserWindow 失败。
BrowserWindow.reload()
browser-window
only works in the Browser process (ie the one your app starts in). browser-window
仅适用于 Browser 进程(即您的应用程序启动的那个进程)。 Try this:尝试这个:
var remote = require('remote');
remote.getCurrentWindow().reload();
For Reload :对于重新加载:
const { BrowserWindow } = require('electron').remote
BrowserWindow.getCurrentWindow().reload();
For Close:对于关闭:
BrowserWindow.getCurrentWindow().on('close', () => {
// window was closed...
})
Documentation : https://www.electronjs.org/docs/api/remote文档: https : //www.electronjs.org/docs/api/remote
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.