最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

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()

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()
Share Improve this question edited Jun 2, 2015 at 10:58 Daniel A. White 191k49 gold badges379 silver badges463 bronze badges asked Jan 6, 2015 at 0:15 James LeiJames Lei 3362 gold badges5 silver badges15 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 18

browser-window only works in the Browser process (i.e. 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

发布评论

评论列表(0)

  1. 暂无评论