I'm still not sure if index references are stored with the realtime model. There is no method to retrieve all references registered on a CollaborativeString/-List. How to get rid of index references without modifying the string/list? I don't find a "unregisterReference" or alike. It would be great to get some more information on the references as the documentation is quite limited regarding the lifecycle etc. (or I'm simply too dumb to get it...)
-
Fyi, you should tag your posts with google-drive-sdk since that tag is monitored for questions. – Cheryl Simon Sep 30 '13 at 16:06
1 Answers
An IndexReference is an object at the same level as CollabString/List. You should track them by organizing them in a list/map depending on what you are using them for.
For example, if you are using it to track user cursor positions in a CollabString, you could have a CollaborativeMap of userId -> index reference.
When the user clicks in the text box, set the position of the index reference. Listen for gapi.drive.realtime.EventType.REFERENCE_SHIFTED events to hear about client changes.
You are right, there isn't currently am explicit way to "unregister" a reference, other than if it canBeDeleted and the area it points at is deleted.
I can file some feature requests around listing and unregistering references, but for now your best bet is to track them as I described above, and if you are concerned about the model size, try not to go through too many of them.

- 46,552
- 15
- 93
- 82
-
Thanks for the reply! As my CollabString holds the file contents it is very likely that references will add up over the lifetime of the file. It would be great to be able to list and unregister the references. I'm using them to mark regions of the document dynamically to the canBeDeleted flag does not help in this respect. – dflorey Sep 30 '13 at 20:23