Hi, I think it is convenient to have a API which can get all windows, like this:
windows = require("nw.gui").Window.getAll()
// => windows = [Window1, Window2, ...]
Using that I can track and monitor user behavior, and do some cross window operation properly.
Even though I can record the window handle after calling Window.open, Tracking opened window is a messy job for developer.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Hi, you can iterate from here.. global.__nwWindowsStore
@triplekdev Thanks! Looks like it not in the wiki, maybe not stable?
@halida, No idea :) i think I found that on earliest versions of node-webkit.
@triplekdev I donot know how to use global.__nwWindowsStore,eighter...Though I found it in src/api/window/window.js.
This should be working with latest version now.
In 0.13 we changed to an optimized architecture so more features can be supported, see http://nwjs.io/blog/whats-new-in-0.13/ and it's good for keeping up with Chromium upstream -- we released with Node.js v6.0 and new Chromium versions within 1 day after upstream release.
The new version would fixed many issues reported here and we're scrubbing them. This issue is closed as we believe it should be fixed. Please leave a message if it isn't and we'll reopen it.
@nwjs-bot, I just tryed to update a app to 0.16 now and "global.__nwWindowsStore" didnt works...
I found "__nw_windows" but it's not the same... How get all windows now?
You can use chrome.app.window.getAll to get all AppWindows. If you want to get corresponding nw.Window, use nw.Window.get(appWindow.contentWindow).
@ghostoy, thks very much!
if you are using "new_instance: true" while opening new window then
chrome.app.window.getAll fails
try this
chrome.windows.getAll({populate: true}, function(wins){
console.log("windows", wins)
})
Most helpful comment
You can use
chrome.app.window.getAllto get all AppWindows. If you want to get correspondingnw.Window, usenw.Window.get(appWindow.contentWindow).