diff options
author | Wu Cheng-Han | 2016-07-30 11:21:38 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-07-30 11:21:38 +0800 |
commit | 2f117a22cd21fa4fb67a3b2d687485795f86d030 (patch) | |
tree | 897902d9d55da45a4f7723f6ea69d6b04f10619b /lib/ot | |
parent | 44fd0a617b3135720079f69dd522f6e25154ec36 (diff) |
Add support of saving authors and authorship
Diffstat (limited to 'lib/ot')
-rwxr-xr-x | lib/ot/editor-socketio-server.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ot/editor-socketio-server.js b/lib/ot/editor-socketio-server.js index 9e4ddf96..45ed5036 100755 --- a/lib/ot/editor-socketio-server.js +++ b/lib/ot/editor-socketio-server.js @@ -10,7 +10,7 @@ var util = require('util'); var LZString = require('lz-string'); var logger = require('../logger'); -function EditorSocketIOServer(document, operations, docId, mayWrite) { +function EditorSocketIOServer(document, operations, docId, mayWrite, operationCallback) { EventEmitter.call(this); Server.call(this, document, operations); this.users = {}; @@ -18,6 +18,7 @@ function EditorSocketIOServer(document, operations, docId, mayWrite) { this.mayWrite = mayWrite || function (_, cb) { cb(true); }; + this.operationCallback = operationCallback; } util.inherits(EditorSocketIOServer, Server); @@ -51,6 +52,8 @@ EditorSocketIOServer.prototype.addClient = function (socket) { } try { self.onOperation(socket, revision, operation, selection); + if (typeof self.operationCallback === 'function') + self.operationCallback(socket, operation); } catch (err) { socket.disconnect(true); } |