question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nw.js 0.13.0-rc1 - Window.open(url, [options], [callback]) - window in callback undefined

See original GitHub issue

System: Windows 8.1 x64 nw.js: 0.13.0-rc1 x64 sdk build

When calling Window.open(url, [options], [callback]), the window instance put into the callback is often undefined. Example:

var local = {};
local.gui = require('nw.gui');

local.gui.Window.open('https://www.github.com', {
                    position: 'center',
                    width: 1410,
                    height: 700,                 
                    show: true
                }, function (_window) {
                    if (_window) {
                        console.log('OK. new window instance is there');
                    } else {
                        console.log('ERROR. new window instance is NOT there!');                  
                        console.log(typeof _window)
                    }
   });

It happens very often that _window is “undefined” in the callback. The window seems to be created but not shown and the instance is not given into the callback function. This does not happen every time but very often.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rogerwangcommented, May 9, 2016

This was fixed in 0.14.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window
Get all windows with a callback function whose parameter is an array of nw.Window object. This function is supported since 0.42.6. Window.open(url, [options],...
Read more >
Window - NW.js Documentation - Read the Docs
Close the devtools window. win.getPrinters(callback). Enumerate the printers in the system. The callback function will receive an array of JSON objects for the ......
Read more >
NW.js open a new window and close it on event
Coming back to this, I resolved it by saving the reference inside de callback : "notificationWin = new_notification;" and then just calling ...
Read more >
express | Yarn - Package Manager
readme. Express Logo. Fast, unopinionated, minimalist web framework for Node.js. NPM Version NPM Install Size ...
Read more >
Search Results - CVE
An attacker can potentially exploit Javascript window.open functionality in ... callback parameter modifying the URL that precedes the callback parameter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found