forked from fitzgen/operational-transformation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessages.js
32 lines (25 loc) · 930 Bytes
/
messages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This modules loosely defines the message protocol used to pass operations and
// documents between the client and server. Mostly it is just a common
// abstraction both the client and server can use when creating, manipulating,
// and using messages.
/*jslint onevar: true, undef: true, eqeqeq: true, bitwise: true,
newcap: true, immed: true, nomen: false, white: false, plusplus: false,
laxbreak: true */
/*global define */
define(function () {
function defineGetSet (prop) {
return function (obj, val) {
return arguments.length === 2
? obj[prop] = val
: obj[prop];
};
}
return {
// The 'document' attribute is only defined for server responses to a
// client connect.
document: defineGetSet("doc"),
revision: defineGetSet("rev"),
operation: defineGetSet("op"),
id: defineGetSet("id")
};
});