Skip to content

Commit

Permalink
Unregister the window when unloaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
slopjong committed Mar 6, 2012
1 parent 5d88d91 commit 0290f4a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions chrome/content/openspace.js
@@ -1,11 +1,10 @@

// TODO: when to unregister this window?

var openspace = {

/**
* Loads some modules and populates the listbox with spaces known
* in the space directory.
* in the space directory. After the initialization this object
* is registered as an observer in the OpenSpace javascript module.
*/
onLoad: function() {

Expand Down Expand Up @@ -45,6 +44,13 @@ var openspace = {
this.initialized = true;
},

/**
* Unregisters this object as an observer in the OpenSpace javascript module.
*/
onUnLoad: function(){
unregisterOpenSpaceObserver(this);
},

/**
* Displays a green, red or a grey dot. The colors have the following meaning:
*
Expand Down Expand Up @@ -147,4 +153,5 @@ var openspace = {
}
};

window.addEventListener("load", function(e) { openspace.onLoad(e); }, false);
window.addEventListener("load", function(e) { openspace.onLoad(e); }, false);
window.addEventListener("unload", function(e){ openspace.onUnLoad(e); }, false);

0 comments on commit 0290f4a

Please sign in to comment.