I am loading a background script in NWJS with the following manifest file:
{
"name": "Testing background process",
"main": "index.js",
"bg-script" : "bg.js"
}
From the background script, I want to access the window, so I'm trying:
let win = nw.Window.get()
console.log(win)
But that gives the following error:
Uncaught cannot get current window; are you in background page/node context?
How can I find the window from a background script? My goal is to listen to events in the current window.
I know it's late, but instead of bg-script use node-main