mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Make variadic options more explicit
This commit is contained in:
parent
790b9ea8ed
commit
3966e2f85b
1 changed files with 12 additions and 7 deletions
|
@ -85,17 +85,22 @@ module.exports = Router =
|
|||
# doc_id, options, callback
|
||||
# doc_id, fromVersion, options, callback
|
||||
client.on "joinDoc", (doc_id, fromVersion, options, callback) ->
|
||||
if typeof fromVersion == "function"
|
||||
fromVersion = -1
|
||||
options = {}
|
||||
if typeof fromVersion == "function" and !options
|
||||
callback = fromVersion
|
||||
else if typeof fromVersion == "object"
|
||||
fromVersion = -1
|
||||
options = fromVersion
|
||||
callback = options
|
||||
if typeof options == "function"
|
||||
options = {}
|
||||
else if typeof fromVersion == "number" and typeof options == "function"
|
||||
callback = options
|
||||
options = {}
|
||||
else if typeof fromVersion == "object" and typeof options == "function"
|
||||
callback = options
|
||||
options = fromVersion
|
||||
fromVersion = -1
|
||||
else if typeof fromVersion == "number" and typeof options == "object"
|
||||
# Called with 4 args, things are as expected
|
||||
else
|
||||
logger.error { arguments: arguments }, "unexpected arguments"
|
||||
return {} # ????
|
||||
|
||||
WebsocketController.joinDoc client, doc_id, options, fromVersion, (err, args...) ->
|
||||
if err?
|
||||
|
|
Loading…
Reference in a new issue