Don’t think there is anything in the JS API for that. Much of the JS API hasn’t been updated to support the new cloud functionality. Anywho, you might be able to setup a while loop after the cloud document is opened to check and see if the document has changed or something? I’m not entirely familiar with what changes once a cloud document is fully downloaded and opened.
Also, the objectID I can get from the context of OpenDocument, like context.actionContext.document.documentData().objectID() is not the same as the objectID returned later from getSelectedDocument().id.
This is a very common mistake here on the forum. The action API is pretty old and was written before the JS API. Thus these action context’s don’t return wrapped JS objects but rather native Sketch objects. The
id returned on a JS API object doesn’t necessarily have the same meaning as what returns from the
objectID() method on the
Another way to phrase it is that
getSelectedDocument() returns a wrapped JS API object. This is different than
context.actionContext.document.documentData(). However, if we look at something like this:
let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let nativeDoc = context.actionContext.document
let wrappedDoc = sketch.fromNative(nativeDoc)
doc are likely the same thing. You can also look at the JS documentation to see all the exposed properities and methods are for a JS Document.