Google Realtime未公开的功能:'toJson'? [英] Google Realtime undocumented feature: 'toJson'?

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

问题描述

在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',它很可能会确定您是否在使用内存文档而不是Drive支持的文档。有趣的东西:)。

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'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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