From 2fc3c5b58cb8b073af67d22e2b8153c72ea6df64 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 12 Jan 2012 18:00:16 -0800 Subject: [PATCH] :lipstick: --- src/atom/binding-set.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/atom/binding-set.coffee b/src/atom/binding-set.coffee index 4ccae9b40..a123434be 100644 --- a/src/atom/binding-set.coffee +++ b/src/atom/binding-set.coffee @@ -16,10 +16,13 @@ class BindingSet constructor: (@selector, mapOrFunction) -> @specificity = Specificity(@selector) + @commandForEvent = @buildEventHandler(mapOrFunction) + + buildEventHandler: (mapOrFunction) -> if _.isFunction(mapOrFunction) - @commandForEvent = mapOrFunction + mapOrFunction else - @commandForEvent = (event) => + (event) => for pattern, command of mapOrFunction return command if @eventMatchesPattern(event, pattern) null