mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
function to bind events to object methods given a string value list of event/handler pairs (e.g. on "click:clickMe;focus:focusMe")
This commit is contained in:
@@ -48,6 +48,18 @@ license that can be found in the LICENSE file.
|
||||
}, this);
|
||||
};
|
||||
|
||||
var bindEvents = function(inEvents) {
|
||||
inEvents.forEach(function(e) {
|
||||
// event name: handler name pairs
|
||||
var pair = e.split(":");
|
||||
var event = pair[0].trim();
|
||||
var handler = pair[1].trim();
|
||||
if (this[handler]) {
|
||||
this.addEventListener(event, this[handler].bind(this));
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
var deref = function(inNode) {
|
||||
return inNode.baby || inNode;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user