1

For about 6 months we have been using without fail item instanceof gapi.drive.realtime.CollaborativeList to detect if a property was a CollaborativeList. This started failing last week and we checked gapi.drive.realtime and it does not appear that CollabroativeList or any of the other models described in the documentation are present. https://developers.google.com/drive/realtime/reference/. We are still able to access the standard drive functionality so it does not appear that an authentication issue. And the function that makes that call is wrapped in gapi.load("drive-realtime", function() {}). Does any have any clue why the models are no longer present?

gapi.load("drive-realtime", function() { 
  if("test" instanceof gapi.drive.realtime.CollaborativeList){
    console.log("hi")
  }
})

This function will return Uncaught TypeError: Expecting a function in instanceof check, but got undefined

This is because gapi.drive.realtime.CollaborativeList does not exist in in gapi.drive.realtime

sdolphin
  • 138
  • 1
  • 6

1 Answers1

0

See Brian's answer on this question: Was the Drive Realtime API changed today? There isn't typically a reason to access the constructor, and doing so can cause issues, so access was removed.

Whats the scenario where you don't know if it is a collab list?

Community
  • 1
  • 1
Cheryl Simon
  • 46,552
  • 15
  • 93
  • 82
  • 1
    We have two scenarios that we need to know if it is a list or map specifically. One is when we change a custom object and need to see if the data we have needs to be updated such as item.parent is a CollaborativeField that used to be a string but now is an array. Second is we want to be able to export a custom realtime object out to a raw json object to send to drive to store as a different file. We could make a specific function for each custom realtime object but we made a generic function that took an object recursed through the properties creating a raw json object. – sdolphin Nov 05 '14 at 21:52
  • I see.. as a workaround, you could key on one of the unique, public function names instead? For the export case, you can also consider using the existing import/export functionality instead of rolling your own. Checkout realtime.get and realtime.update in the Drive API. – Cheryl Simon Nov 05 '14 at 22:23
  • I'm also interested in identifying types of collaborative objects for similar reasons. Using a function name is not very robust because we're checking objects contained in documents that could very well have properties with the same name. Sounds like a bug waiting to happen. We could check that every public function exists on the object for higher confidence but I think it would be better if an official method was provided. Even if constructors aren't made public, there could be a function that returned the type (List, Map, EditableString, , or JsonValue) for a given object? – Christopher Best Jan 27 '15 at 22:30