one event baton in practice, but keyboard is complicated...

This commit is contained in:
Peter Cottle 2013-01-01 14:14:57 -08:00
parent 0779bdeadb
commit 8e8eb4f4a9
5 changed files with 53 additions and 59 deletions

View file

@ -19,15 +19,14 @@ EventBaton.prototype.stealBaton = function(name, func, context) {
};
EventBaton.prototype.trigger = function(name) {
// arguments is weird and doesnt do slice right
var argsToApply = [];
for (var i = 1; i < arguments.length; i++) {
argsToApply.push(arguments[i]);
}
// get the last one
var listeners = this.eventMap[name];
if (!listeners) {
console.warn('no listeners for that event', name);
return;
}
// call the top most listener with context and such