Catch both string and object targets

This commit is contained in:
Ivan Zuzak 2015-06-22 18:47:41 +02:00
parent d47737718b
commit 9aa78606b3

View File

@ -92,10 +92,10 @@ class CommandRegistry
disposable.add @add(target, commandName, callback)
return disposable
if typeof target is 'string'
if typeof callback isnt 'function'
throw new Error("Can't register a command with non-function callback.")
if typeof callback isnt 'function'
throw new Error("Can't register a command with non-function callback.")
if typeof target is 'string'
validateSelector(target)
@addSelectorBasedListener(target, commandName, callback)
else