Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
merge for backing out of changeset d1b2b899440d, the first of two com…
Browse files Browse the repository at this point in the history
…mits for bug 598980, because it generates test failures per bug 604801 that are 0.9 release blockers
  • Loading branch information
mykmelez committed Oct 18, 2010
2 parents 77bcd55 + 3adde1e commit 2767fde
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 222 deletions.
19 changes: 14 additions & 5 deletions packages/addon-kit/docs/windows.md
Expand Up @@ -111,26 +111,35 @@ Events of browserWindows
------------------------

Events representing common actions and state changes for windows.

These properties are `collections`. Listeners can be registered by
passing the callback to the properties' `add` method, and can be removed
by passing the callback function to the properties' `remove` method.

Listeners are passed the `window` object that triggered the event.

**open**
<api name="onOpen">
@property {collection}
Called when a new window is opened.
</api>

**close**
<api name="onClose">
@property {collection}
Called when a window is closed.
</api>

**Examples**

var windows = require("windows").browserWindows;

// listen for window openings via property assignment
windows.on('open', function(window) {
windows.onOpen.add(function(window) {
myOpenWindows.push(window);
});

// modify the DOM of the page when ready,
// by adding listener to the event collection.
windows.on('close', function(window) {
windows.onClose.add(function(window) {
console.log("A window was closed.");
});

Expand Down Expand Up @@ -178,7 +187,7 @@ A function to be called when the window finishes its closing process.
" tabs.");

// Print the title of all browser windows
for each (var window in windows) {
for (var window in windows) {
console.log(window.title);
}

Expand Down

0 comments on commit 2767fde

Please sign in to comment.