dev.e.loper
dev.e.loper

Reputation: 36044

Google Realtime API - How to view existing collaboration model?

How do I view existing realtime collaboration data model? I call getRoot method:

var collaborative_model = rtpg.realtimeDoc.getModel().getRoot()

When I vew collaborative_model object in debug, I see cryptic properties only. Not sure if or how my model is saved.

Can I do some kind of variable dump of the model?

enter image description here

Upvotes: 2

Views: 116

Answers (2)

Grant Watters
Grant Watters

Reputation: 670

You can use https://gist.github.com/cowsrule/6348393 as a mostly plug-and-play dumper for the realtime API collaborative objects. As this relies on internals of the realtime API it will need to be updated (read: break) the next time they update the API.

To use, include on your webpage and set window.remoteDoc to be your realtime document.

To call, pass in the ID of the CollaborativeObject you are interested in inspecting.

Upvotes: 2

Cheryl Simon
Cheryl Simon

Reputation: 46844

The root is just a CollaborativeMap, so you can use the standard map methods to explore its values.

The relevant methods there for digging into the model are keys() and values().

A lot of these data model classes have obfuscated methods that are a part of the internal implementation. The best way to see what methods are publicly available is to look at the API reference.

Upvotes: 0

Related Questions