Skip to content

Commit 1054dd9

Browse files
TheJaredWilcurtrogerwang
authored andcommitted
Documentation: Window Closed Event
Slight tweaks to the description to make it sound more natural. Fixed indentation in code example.
1 parent c8597b3 commit 1054dd9

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

docs/References/Window.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -483,29 +483,29 @@ See example code of [`win.close(true)` above](#wincloseforce) for the usage of `
483483

484484
## Event: closed
485485

486-
The `closed` event is emitted after corresponding window is closed. Normally you'll not be able to get this event since after the window is closed all js objects will be released. But it's useful if you're listening this window's events in another window, whose objects will not be released.
486+
The `closed` event is emitted after the corresponding window is closed. Normally you will not be able to get this event since after the window is closed all js objects will be released. But it is useful when listening to the window's events in another window, whose objects will not be released.
487487

488488
```javascript
489489
// Open a new window.
490-
nw.Window.open('popup.html', {}, function(win) {
491-
// Release the 'win' object here after the new window is closed.
492-
win.on('closed', function() {
493-
win = null;
494-
});
495-
496-
// Listen to main window's close event
497-
nw.Window.get().on('close', function() {
498-
// Hide the window to give user the feeling of closing immediately
499-
this.hide();
490+
nw.Window.open('popup.html', {}, function (win) {
491+
// Release the 'win' object here after the new window is closed.
492+
win.on('closed', function () {
493+
win = null;
494+
});
500495

501-
// If the new window is still open then close it.
502-
if (win != null)
503-
win.close(true);
504-
505-
// After closing the new window, close the main window.
506-
this.close(true);
507-
});
496+
// Listen to main window's close event
497+
nw.Window.get().on('close', function () {
498+
// Hide the window to give user the feeling of closing immediately
499+
this.hide();
508500

501+
// If the new window is still open then close it.
502+
if (win !== null) {
503+
win.close(true);
504+
}
505+
506+
// After closing the new window, close the main window.
507+
this.close(true);
508+
});
509509
});
510510

511511
```

0 commit comments

Comments
 (0)