Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rlamana committed Feb 6, 2015
1 parent bd7e138 commit 87d2054
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,40 @@ A window manager experiment written in Javascript, HTML5 and CSS3.
x: 0,
y: 0
});

### Listen to events

#### Define handlers in constructor
var window = wm.createWindow({
title: 'A new window',
events: {
open: function() {
console.log('The window was open');
},
closed: function() {
console.log('The window was closed');
},
}
});

#### Using the 'signals' property
var window = wm.createWindow({
title: 'A new window'
});

window.signals.on('open', function() {
console.log('The window was open');
});

### Destroying a window
When a window is closed the content is not destroyed by default. This way windows can be open again keeping the wrapped DOM element. To completely destroy the window, the method 'destroy' needs to be called:

var window = wm.createWindow({
title: 'A new window',
events: {
closed: function() {
this.destroy();
}
}
});

0 comments on commit 87d2054

Please sign in to comment.