瀏覽代碼

EventWindow is no longer restricted to window object events only.

dev-tmpl
Bryan Miller 6 年之前
父節點
當前提交
38bf95034b
共有 1 個檔案被更改,包括 7 行新增8 行删除
  1. +7
    -8
      app/js/ui/EventWindow.js

+ 7
- 8
app/js/ui/EventWindow.js 查看文件

@@ -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…
取消
儲存