Pārlūkot izejas kodu

EventWindow is no longer restricted to window object events only.

dev-tmpl
Bryan Miller pirms 6 gadiem
vecāks
revīzija
38bf95034b
1 mainītis faili ar 7 papildinājumiem un 8 dzēšanām
  1. +7
    -8
      app/js/ui/EventWindow.js

+ 7
- 8
app/js/ui/EventWindow.js Parādīt failu

@@ -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;

Notiek ielāde…
Atcelt
Saglabāt