mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Catch both string and object targets
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user