Is there a way to know if the real-time document has changed in any way? I.E. I don't want to install event handlers on each collaborative string, list, map, and custom object. Instead I want to install one event handler to be called if ANY collaborative object in my real-time document has changed.
The only way I know so far is to periodically check serverVersion to see if that has incremented. But sometimes it increments even if nothing changes.
An ObjectChangedEvent listener added to the root will be informed whenever any change is made in any part of the model.
The ObjectChangedEvent is a bubbling event that is additionally emitted for every change. The ObjectChangedEvent is sent to the object that changed and all of its ancestors. One ObjectChangedEvent is emitted for every object that changed within a compound operation. The specific changes are described in the events field.
See also: https://developers.google.com/drive/realtime/handle-events