Sfoglia il codice sorgente

EventWindow is no longer restricted to window object events only.

dev-tmpl
Bryan Miller 6 anni fa
parent
commit
38bf95034b
1 ha cambiato i file con 7 aggiunte e 8 eliminazioni
  1. +7
    -8
      app/js/ui/EventWindow.js

+ 7
- 8
app/js/ui/EventWindow.js Vedi File

@@ -20,16 +20,15 @@ class EventWindow extends EventCaller{
window[eventName] = (function(event){
this.emit(eventName, event);
}).bind(this);
}
super.listen(eventName, callback, owner, once);
return this;
}
}
throw new ValueError("Window object has no event named '" + eventName +"'.");
super.listen(eventName, callback, owner, once);
return this;
}

unlisten(eventName, callback, owner=null){
unlisten(eventName, callback, owner=null){
super.unlisten(eventName, callback, owner);
if (window.hasOwnProperty(eventName)){
super.unlisten(eventName, callback, owner);
if (super.event_listener_count(eventName) == 0){
window[eventName] = undefined;
}
@@ -37,9 +36,9 @@ class EventWindow extends EventCaller{
return this;
}

unlisten_event(eventName){
unlisten_event(eventName){
super.unlisten_event(eventName);
if (window.hasOwnProperty(eventName)){
super.unlisten_event(eventName);
window[eventName] = undefined;
}
return this;

Loading…
Annulla
Salva