diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-01 02:22:00 -0400 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-05-01 02:22:00 -0400 |
commit | 5d1a60b3df65b801de504c3d7b08d6a1fc9ef03b (patch) | |
tree | 012b04720e546af3196ccdb984bef1147ba34183 /src/client/DocServer.ts | |
parent | 976a4d835840e08f3dfd114757d7cddda5614b83 (diff) |
Added collaboration functionality
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r-- | src/client/DocServer.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index 31a50adbd..1d73abd1f 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -81,6 +81,9 @@ export namespace DocServer { } export function UpdateField(id: string, diff: any) { + if (id === updatingId) { + return; + } Utils.Emit(_socket, MessageStore.UpdateField, { id, diff }); } @@ -91,6 +94,7 @@ export namespace DocServer { Utils.Emit(_socket, MessageStore.CreateField, initialState); } + let updatingId: string | undefined; function respondToUpdate(diff: any) { const id = diff.id; if (id === undefined) { @@ -103,7 +107,9 @@ export namespace DocServer { } const handler = f[HandleUpdate]; if (handler) { - handler(diff); + updatingId = id; + handler.call(f, diff.diff); + updatingId = undefined; } }; if (field instanceof Promise) { |