我有一个NW应用程序,它以启动画面开始,然后在新窗口中打开主应用程序。代码大致如下:
var appWin = gui.Window.open("https://localhost:8080/", {
"icon": "app_icon.png",
"frame": true,
"width": 1200,
"height": 800,
"position": "center",
"resizable": true,
"min_width": 400,
"min_height": 200
})
appWin.on('loaded', function() {
// hide the splash screen
})
但是,appWin
始终undefined
,即使新窗口打开并显示正确的内容也是如此。
我使用的是 0.13.4 nw-builder
版本,但我也尝试了各种版本的 0.14.x、0.15.x 和 0.16.x,但也有同样的问题。
任何可行的变通办法的建议也是可以接受的。
// Open a new window.
nw.Window.open("https://localhost:8080/", {
"icon": "app_icon.png",
"frame": true,
"width": 1200,
"height": 800,
"position": "center",
"resizable": true,
"min_width": 400,
"min_height": 200
}, function(win) {
console.log('window opened'. win);
win.on('loaded', function() {
console.log('window created');
}
});