1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 00:33:15 +00:00

Add support for widget event listeners to be specified as functions

This commit is contained in:
Jeremy Ruston 2013-10-21 20:13:08 +01:00
parent ce1fb300f8
commit 48dbacc88a

View File

@ -318,6 +318,11 @@ Widget.prototype.addEventListener = function(type,handler) {
this.eventListeners[type] = function(event) { this.eventListeners[type] = function(event) {
return self[handler].call(self,event); return self[handler].call(self,event);
}; };
} else { // The handler is a function
this.eventListeners[type] = function(event) {
return handler.call(self,event);
}
} }
}; };