简体   繁体   中英

How do run reload() and open() in Atom-Shell

1) Is this javascript call not supported on Atom-shell? window.open('#/openpage','_self',false)

2) In NodeJS-Webkit, I could either reload the HTML with win.reload() without the toolbar and buttons. Is Atom-shell support this API as well?

3) In the app.js that is program to index.html into the Atom-shell

var BrowserWindow = require('browser-window');

and index.html tried to execute a reload command and failed that BrowserWindow is not defined.

BrowserWindow.reload()

browser-window only works in the Browser process (ie the one your app starts in). 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM