Google Realtime未记录的功能:' toJson&#39 ;? [英] Google Realtime undocumented feature: 'toJson'?

查看:47
本文介绍了Google Realtime未记录的功能:' toJson&#39 ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Realtime模型对象上有一个方法"toJson",由Document.getModel()返回

There is a method 'toJson' on the Google Realtime model object, as returned from Document.getModel()

doc.getModel().toJson()

似乎有两个参数,但是没有Google开发人员或其他地方提供的文档.应该如何使用?

Seems to take two parameters, but there is no documentation available from Google developers or elsewhere. How should it be used?

推荐答案

因此,您的最后一条评论让我记忆犹新.虽然没有记录,但我认为这实际上是以下Drive API调用的终点: https://developers.google.com/drive/v2/reference/realtime/get .这有点奇怪,因为它不在Realtime API下,而是在Drive API下记录,但是您既可以导出为JSON,也可以导入JSON结构.大概是toJson函数会吐出兼容的JSON以用于这些函数,但我尚未对此进行测试.

So your last comment jogged my memory. While undocumented, I think this is actually the end point for the following Drive API calls: https://developers.google.com/drive/v2/reference/realtime/get. It's a bit weird because its not under the Realtime API and instead documented under the Drive API, but you can both export as JSON as well as import a JSON structure. Presumably the toJson function will spit out compliant JSON to be used with these functions, but I have not tested this.

另外-看起来他们还有更多有趣的未记录功能,与之紧密相关.特别是,可以使用gapi.drive.realtime.loadFromJson,这大概是toJson的实际加载副本.还公开了gapi.drive.realtime.newInMemoryDocument fn,这很可能是内部函数,用于初始化从"loadFromJson"加载的文档.此外,还有一个"Document.isinGoogleDrive",它很可能确定您使用的是内存中文档还是驱动器支持的文档.好玩的东西:).

Also - it looks like they have more fun undocumented features that go hand-in-hand with this. In particular gapi.drive.realtime.loadFromJson is available, which presumably is the actual loading counterpart to toJson. There is also the gapi.drive.realtime.newInMemoryDocument fn that is exposed which is likely an internal function to initialize the document loaded from 'loadFromJson'. Additionally there is 'Document.isinGoogleDrive' which very likely determines if you are using an in-memory document vs a Drive backed one. Fun stuff :).

这篇关于Google Realtime未记录的功能:' toJson&#39 ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆