@@ -92,15 +92,15 @@ function NWWindow(cWindow) {
92
92
self . cWindow . height = w . height ;
93
93
94
94
if ( oldState != 'minimized' && w . state == 'minimized' ) {
95
- dispatchEventIfExists ( self , 'onMinimized' ) ;
95
+ dispatchEventIfExists ( self , 'onMinimized' , [ w . id ] ) ;
96
96
} else if ( oldState != 'maximized' && w . state == 'maximized' ) {
97
- dispatchEventIfExists ( self , 'onMaximized' ) ;
97
+ dispatchEventIfExists ( self , 'onMaximized' , [ w . id ] ) ;
98
98
} else if ( oldState != 'fullscreen' && w . state == 'fullscreen' ) {
99
- dispatchEventIfExists ( self , 'onFullscreen' ) ;
99
+ dispatchEventIfExists ( self , 'onFullscreen' , [ w . id ] ) ;
100
100
} else if ( oldState != 'normal' && w . state == 'normal' ) {
101
- dispatchEventIfExists ( self , 'onRestore' ) ;
101
+ dispatchEventIfExists ( self , 'onRestore' , [ w . id ] ) ;
102
102
} else if ( oldWidth != w . width || oldHeight != w . height ) {
103
- dispatchEventIfExists ( self , 'onResized' , [ w . width , w . height ] ) ;
103
+ dispatchEventIfExists ( self , 'onResized' , [ w . id , w . width , w . height ] ) ;
104
104
}
105
105
}
106
106
privates ( this ) . menu = null ;
@@ -254,7 +254,12 @@ NWWindow.prototype.on = function (event, callback, record) {
254
254
break ;
255
255
}
256
256
if ( nwWinEventsMap . hasOwnProperty ( event ) ) {
257
- this [ nwWinEventsMap [ event ] ] . addListener ( wrap ( ) ) ;
257
+ let cb = wrap ( function ( id , ...args ) {
258
+ if ( id != self . cWindow . id )
259
+ return ;
260
+ callback . call ( self , ...args ) ;
261
+ } ) ;
262
+ this [ nwWinEventsMap [ event ] ] . addListener ( cb ) ;
258
263
return this ;
259
264
}
260
265
return this ;
0 commit comments