mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add more debug log lines
This commit is contained in:
parent
fec3266726
commit
36c8c197e1
2 changed files with 12 additions and 0 deletions
|
@ -6,7 +6,10 @@ define [
|
|||
@getDocument: (ide, doc_id) ->
|
||||
@openDocs ||= {}
|
||||
if !@openDocs[doc_id]?
|
||||
sl_console.log "[getDocument] Creating new document instance for #{doc_id}"
|
||||
@openDocs[doc_id] = new Document(ide, doc_id)
|
||||
else
|
||||
sl_console.log "[getDocument] Returning existing document instance for #{doc_id}"
|
||||
return @openDocs[doc_id]
|
||||
|
||||
@hasUnsavedChanges: () ->
|
||||
|
@ -107,11 +110,14 @@ define [
|
|||
@wantToBeJoined = false
|
||||
@_cancelJoin()
|
||||
if (@doc? and @doc.hasBufferedOps())
|
||||
sl_console.log "[leave] Doc has buffered ops, pushing callback for later"
|
||||
@_leaveCallbacks ||= []
|
||||
@_leaveCallbacks.push callback
|
||||
else if !@connected
|
||||
sl_console.log "[leave] Not connected, returning now"
|
||||
callback()
|
||||
else
|
||||
sl_console.log "[leave] Leaving now"
|
||||
@_leaveDoc(callback)
|
||||
|
||||
flush: () ->
|
||||
|
@ -202,6 +208,7 @@ define [
|
|||
|
||||
@connected = true
|
||||
if @wantToBeJoined or @doc?.hasBufferedOps()
|
||||
sl_console.log "[onReconnect] Rejoining (wantToBeJoined: #{@wantToBeJoined} OR hasBufferedOps: #{@doc?.hasBufferedOps()})"
|
||||
@_joinDoc (error) =>
|
||||
return @_onError(error) if error?
|
||||
@doc.updateConnectionState "ok"
|
||||
|
@ -229,10 +236,12 @@ define [
|
|||
callback()
|
||||
|
||||
_leaveDoc: (callback = (error) ->) ->
|
||||
sl_console.log '[_leaveDoc] Sending leaveDoc request'
|
||||
@ide.socket.emit 'leaveDoc', @doc_id, (error) =>
|
||||
return callback(error) if error?
|
||||
@joined = false
|
||||
for callback in @_leaveCallbacks or []
|
||||
sl_console.log '[_leaveDoc] Calling buffered callback', callback
|
||||
callback(error)
|
||||
delete @_leaveCallbacks
|
||||
callback(error)
|
||||
|
|
|
@ -41,6 +41,7 @@ define [
|
|||
@openDoc(doc)
|
||||
|
||||
openDoc: (doc, options = {}) ->
|
||||
sl_console.log "[openDoc] Opening #{doc.id}"
|
||||
@$scope.ui.view = "editor"
|
||||
|
||||
done = () =>
|
||||
|
@ -74,8 +75,10 @@ define [
|
|||
done()
|
||||
|
||||
_openNewDocument: (doc, callback = (error, sharejs_doc) ->) ->
|
||||
sl_console.log "[_openNewDocument] Opening..."
|
||||
current_sharejs_doc = @$scope.editor.sharejs_doc
|
||||
if current_sharejs_doc?
|
||||
sl_console.log "[_openNewDocument] Leaving existing open doc..."
|
||||
current_sharejs_doc.leaveAndCleanUp()
|
||||
@_unbindFromDocumentEvents(current_sharejs_doc)
|
||||
|
||||
|
|
Loading…
Reference in a new issue