This commit is contained in:
Nathan Sobo
2012-01-12 18:00:16 -08:00
parent 86d7a91dcd
commit 2fc3c5b58c

View File

@@ -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