mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Catch both string and object targets
This commit is contained in:
parent
d47737718b
commit
9aa78606b3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user