Skip to content

Commit 4aef8c2

Browse files
committed
Fix win.getPrinters undefined under nw2
Ref nwjs#5875
1 parent f416c2c commit 4aef8c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/resources/api_nw_newwin.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ function NWWindow(cWindow) {
105105
chrome.windows.onWindowChanged.addListener(updateWindowAttributes);
106106
}
107107

108-
forEach(currentNWWindowInternal, function(key, value) {
109-
if (!key.endsWith('Internal'))
110-
NWWindow.prototype[key] = value;
111-
});
112-
113108
NWWindow.prototype.onNewWinPolicy = bindingUtil.createCustomEvent("nw.Window.onNewWinPolicy", false, false);
114109
NWWindow.prototype.onNavigation = bindingUtil.createCustomEvent("nw.Window.onNavigation", false, false);
115110
NWWindow.prototype.LoadingStateChanged = bindingUtil.createCustomEvent("nw.Window.LoadingStateChanged", false, false);
@@ -615,6 +610,10 @@ Object.defineProperty(NWWindow.prototype, 'frameId', {
615610
apiBridge.registerCustomHook(function(bindingsAPI) {
616611
var apiFunctions = bindingsAPI.apiFunctions;
617612
currentNWWindowInternal = getInternalApi('nw.currentWindowInternal');
613+
forEach(currentNWWindowInternal, function(key, value) {
614+
if (!key.endsWith('Internal'))
615+
NWWindow.prototype[key] = value;
616+
});
618617
apiFunctions.setHandleRequest('get', function(domWindow) {
619618
if (domWindow)
620619
return try_nw(domWindow.top).nw.Window.get();

0 commit comments

Comments
 (0)