All Downloads are FREE. Search and download functionalities are using the official Maven repository.

altime.realtime-api.0.3.0.source-code.protocol Maven / Gradle / Ivy

snapshot
[
[7,"gde23jpazhfqiy50e",1],			//	CollaborativeList
[7,"root",0],
[7,"gdeohwe75hfgyjlp6",2],			//	CollaborativeString
[7,"gde6p4dfvhfip5ozq","DemoMovie"],
[7,"gdegspwishfkqk981",0],			//	CollaborativeMap
[7,"gdey3qrl5hga4jx7g",4],			//	IndexReference

[5,"gde23jpazhfqiy50e",0,			
	[0,
		[21,"Cat"],[21,"Dog"],[21,"Sheep"],[21,"Chicken"],[2,"gde23jpazhfqiy50e"]
	]
],
[5,"gdeohwe75hfgyjlp6",0,
	[1,"Edit Me!"]
],

[8,"root","demo_map",
	[2,"gdegspwishfkqk981"]
],
[8,"root","demo_custom",
	[2,"gde6p4dfvhfip5ozq"]
],
[8,"root","demo_list",
	[2,"gde23jpazhfqiy50e"]
],
[8,"root","demo_string",
	[2,"gdeohwe75hfgyjlp6"]
],

[8,"gde6p4dfvhfip5ozq","name",[21,"Kung Fu Hustle"]],
[8,"gde6p4dfvhfip5ozq","rating",[21,""]],
[8,"gde6p4dfvhfip5ozq","notes",[21,""]],
[8,"gde6p4dfvhfip5ozq","director",[21,"Stephen Chow"]],

[8,"gdegspwishfkqk981","Key 3",[21,{"k":"v"}]],
[8,"gdegspwishfkqk981","Key 4",[2,"gdegspwishfkqk981"]],
[8,"gdegspwishfkqk981","Key 1",[21,"Value 1"]],
[8,"gdegspwishfkqk981","Key 2",[21,"Value 2"]]
[25,"gdey3qrl5hga4jx7g","gde3x7bjuhgcwf4bo",2,true,2]
]

str.insertString(3, 'cool')
[[4,[0,
	[4,[0,
		[5,"gdeohwe75hfgyjlp6",3,[1,"cool"]]
	]]
]]]
mod.beginCompoundOperation('CompoundOperation');str.insertString(1, 'abc');str.removeRange(1,4);mod.endCompoundOperation();
[[4,[0,
	[4,[0,
		[5,"gdea8kojqhgf8w8no",1,[1,"abc"]]]],
	[4,[0,
		[6,"gdea8kojqhgf8w8no",1,3]
	]]
],"CompoundOperation"]]
str.removeRange(3, 4)
[[4,[0,
	[4,[0,
		[6,"gdeohwe75hfgyjlp6",3,1]
	]]
]]]
mod.createString()
[[4,[0,
	[7,"gdehjsjv0hfsq03gw",2]
],"initialize"]]
mod.createString('abcde')
[[4,[0,
	[7,"gdevdazwshfnxswym",2],[5,"gdevdazwshfnxswym",0,[1,"abcde"]]
],"initialize"]]
str.registerReference(2, true)
[[4,[0,
	[7,"gdey3qrl5hga4jx7g",4],[25,"gdey3qrl5hga4jx7g","gde3x7bjuhgcwf4bo",2,true,-1]
],"initialize"]]

map.delete('Key 4')
[[4,[0,
	[8,"gdegspwishfkqk981","Key 4"]
]]]
map.set('Key 4', [null])
[[4,[0,
	[8,"gdegspwishfkqk981","Key 4",[21,[null]]]
]]]
map.set('Key 4', list)
[[4,[0,
	[8,"gdegspwishfkqk981","Key 4",[2,"gde23jpazhfqiy50e"]]]
]]
mod.createMap()
[[4,[0,
	[7,"gdeyyzcrahfo9uykv",0]
],"initialize"]]

list.removeRange(4, 7)
0110
[[4,[0,
	[6,"gde23jpazhfqiy50e",4,3]
]]]
list.push(null)
[[4,[0,
	[5,"gde23jpazhfqiy50e",4,[0,null]]
]]]
list.insertAll(4, [true, string])
0101
[[4,[0,
	[5,"gde23jpazhfqiy50e",4,[0,[21,true],[2,"gdeohwe75hfgyjlp6"]]]
]]]
list.set(4, 'abc')
1011
[[4,[0,
	[11,"gde23jpazhfqiy50e",4,[0,[21,"abc"]]]
]]]
list.replaceRange(2, [null,4])

[[4,[0,
	[11,"gdem91atjhfhgs9wt",2,[0,null,[21,4]]]
]]]
list.length = 3
[[4,[0,[6,"gdem91atjhfhgs9wt",3,2]]]]
mod.createList()
[[4,[0,
	[7,"gdel70pe9hfho6s6n",1]
],"initialize"]]


doc = rtpg.realtimeDoc;
mod = doc.getModel();
root = mod.getRoot();
map = root.get('demo_map');
list = root.get('demo_list');
str = root.get('demo_string');
displayObjectChangedEvent = function (evt) {
  window.e = evt;
  events = evt.events;
  var eventCount = evt.events.length;
  console.log('start: '+ eventCount);
  for (var i = 0; i < eventCount; i++) {
    console.log('Event type: '  + events[i].type);
    console.log('Local event: ' + events[i].isLocal);
    console.log('User ID: '     + events[i].userId);
    console.log('Session ID: '  + events[i].sessionId);
  }
  console.log('end');
}
displayReferenceShiftedEvent = function (evt) {
  console.log('displayReferenceShiftedEvent isLocal:' + evt.isLocal + ' oldIndex:' + evt.oldIndex + ' newIndex:' + evt.newIndex);
}
displayStringEvent = function(evt){
  console.log('type='+evt.type+',index='+evt.index+',text='+evt.text);
}
valuesSetListener = function(evt){
  console.log('type='+evt.type+',index='+evt.index+',oldValues='+evt.oldValues+',newValues='+evt.newValues);
}
root.addEventListener(gapi.drive.realtime.EventType.OBJECT_CHANGED, displayObjectChangedEvent)
root.removeEventListener(gapi.drive.realtime.EventType.OBJECT_CHANGED,displayObjectChangedEvent)
r.addEventListener(gapi.drive.realtime.EventType.REFERENCE_SHIFTED, displayReferenceShiftedEvent)


onFileLoaded = function(doc){
  window.doc2 = doc;
  console.log('onFileLoaded');
  mod = doc.getModel();
  console.log(mod.a.a.getAllObjects().toString());
  console.log(mod.getRoot().toString());
}
initializeModel = function(mod){
  console.log('initializeModel');
  console.log(mod.a.a.getAllObjects().toString());
  console.log(mod.getRoot().toString());
}

displayObjectChangedEvent = function (evt) {
  window.e = evt;
  events = evt.events;
  var eventCount = evt.events.length;
  console.log('start: '+ eventCount);
  for (var i = 0; i < eventCount; i++) {
    console.log('Event type: '  + events[i].type);
    console.log('Local event: ' + events[i].isLocal);
    console.log('User ID: '     + events[i].userId);
    console.log('Session ID: '  + events[i].sessionId);
  }
  console.log('end');
}
gdr.load('', function(doc){window.doc = doc;});
mod = doc.getModel();
root = mod.getRoot();
str = mod.createString('ab');
str.addObjectChangedListener(displayObjectChangedEvent);
str.append('d');

{"revision":92,"requestNumber":0,"changes":[[4,[0,[4,[0,[5,"gdelfgrhjhfwnhdrl",8,[1,"!"]]]]]]]}:
[4,[0,1367894092595,[[
	[[4,[0,[4,[0,[5,"gdelfgrhjhfwnhdrl",28,[1,"x"]]]]]]],1367894137096,"101854939286968683254",70,"1f67d8b67d4fc552",0
]]]]

mod.beginCompoundOperation('xxoo');str.insertString(1, '123');str.insertString(4,'456');str.removeRange(1,3);str.removeRange(1,3);mod.endCompoundOperation()
send
[133,"3",[0,[4,
[0,
	[4,[0,[5,"gder0ljfshjqw1lqs",1,[1,"123"]]],null,null,true,true],
	[4,[0,[5,"gder0ljfshjqw1lqs",4,[1,"456"]]],null,null,true,true],
	[4,[0,[6,"gder0ljfshjqw1lqs",1,2]],null,null,true,true],
	[4,[0,[6,"gder0ljfshjqw1lqs",1,2]],null,null,true,true]
],"xxoo",null,true,true]]]:
receive
370
[[12,[3,1376643469454,[3,[0,[26,134,"140865ab510","101854939286968683254","2632ee3a7fa13a30",[4,
[0,
	[4,[0,[5,"gder0ljfshjqw1lqs",1,[1,"123"]]],null,null,true,true],
	[4,[0,[5,"gder0ljfshjqw1lqs",4,[1,"456"]]],null,null,true,true],
	[4,[0,[6,"gder0ljfshjqw1lqs",1,2]],null,null,true,true],
	[4,[0,[6,"gder0ljfshjqw1lqs",1,2]],null,null,true,true]
],"xxoo",null,true,true]]]]]]


386
[[0,["c","FD5E7E8508F9D931",,8]
]
,[1,[5,1367819747155,{"color":"#58B442","displayName":"田传武","isActive":true,"isAnonymous":false,"isMe":true,"isNew":true,"photoUrl":"https:\/\/lh3.googleusercontent.com\/-XdUIqdMkCWA\/AAAAAAAAAAI\/AAAAAAAAAAA\/4252rscbv5M\/s128\/photo.jpg","profileId":"101854939286968683254","sid":"4d429c7c12a09ef8","userId":"101854939286968683254","userType":0}]]
]
353
[[6,[5,1367819747158,{"color":"#58B442","displayName":"田传武","isActive":true,"isAnonymous":false,"isMe":false,"isNew":true,"photoUrl":"https:\/\/lh3.googleusercontent.com\/-XdUIqdMkCWA\/AAAAAAAAAAI\/AAAAAAAAAAA\/4252rscbv5M\/s128\/photo.jpg","profileId":"101854939286968683254","sid":"1671c89b321f8f4c","userId":"101854939286968683254","userType":0}]]
]

738
[[0,["c","DA3646F3CF193628",,8]
]
,[1,[5,1367819747157,{"color":"#58B442","displayName":"田传武","isActive":true,"isAnonymous":false,"isMe":true,"isNew":true,"photoUrl":"https:\/\/lh3.googleusercontent.com\/-XdUIqdMkCWA\/AAAAAAAAAAI\/AAAAAAAAAAA\/4252rscbv5M\/s128\/photo.jpg","profileId":"101854939286968683254","sid":"1671c89b321f8f4c","userId":"101854939286968683254","userType":0}]]
,[2,[5,1367819747159,{"color":"#58B442","displayName":"田传武","isActive":true,"isAnonymous":false,"isMe":false,"isNew":false,"photoUrl":"https:\/\/lh3.googleusercontent.com\/-XdUIqdMkCWA\/AAAAAAAAAAI\/AAAAAAAAAAA\/4252rscbv5M\/s128\/photo.jpg","profileId":"101854939286968683254","sid":"4d429c7c12a09ef8","userId":"101854939286968683254","userType":0}]]
]

sessionStorage.setItem('__gwtDevModeHook:realtime', 'http://localhost:9876/realtime/realtime.nocache.js')




© 2015 - 2024 Weber Informatics LLC | Privacy Policy