mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
💄
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user