Register windows by name

This commit is contained in:
Jordan Eldredge 2015-01-20 18:58:51 -08:00
parent 2425b7aec8
commit ea060500cf
2 changed files with 7 additions and 3 deletions

View file

@ -51,8 +51,8 @@ Winamp = {
_registerListeners: function() {
var self = this;
this.windowManager.registerWindow(this.mainWindow);
this.windowManager.registerWindow(this.playlistWindow);
this.windowManager.registerWindow('main', this.mainWindow);
this.windowManager.registerWindow('playlist', this.playlistWindow);
this.media.addEventListener('timeupdate', function() {
window.dispatchEvent(self.events.timeUpdated);

View file

@ -1,9 +1,13 @@
WindowManager = {
registerWindow: function(win) {
windows: {},
registerWindow: function(name, win) {
var self = this;
var body = win.body;
var handle = win.handle;
var resizeHandle = win.resizeHandle;
this.windows[name] = body;
// Make window dragable
handle.addEventListener('mousedown',function(e){
if(e.target.classList.contains('ui')) {