可以gapi.client.load云终端返回一个承诺? [英] Can gapi.client.load for cloud endpoints return a promise?

查看:389
本文介绍了可以gapi.client.load云终端返回一个承诺?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个谷歌gapi.client.load了一个谷歌的API可以返回一个承诺所讨论的此处。但是,如果你想使用JavaScript客户端为自己的应用程序引擎组件使用云的终端,gapi.client.load有不同的方法签名,如本角后:

A google gapi.client.load for a google api can return a promise as discussed here. However, if you wish to use the javascript client for your own app engine component using cloud endpoints, the gapi.client.load has a different method signature, as shown in this angular post:

  gapi.client.load('guestbook', 'v1', function() {
    $scope.is_backend_ready = true;
    $scope.list();
  }, '/_ah/api');

下面,有一个第四个参数,这是不是成功的功能。所以,我不知道一个承诺如何都可以使用。

Here, there is a fourth parameter and it is not the success function. So I'm not sure how a promise can be used.

推荐答案

调查这进一步,似乎如果你发送未定义作为第三praameter,那么你可以使用这个调用作为一个承诺,如:

Investigating this further, it seems that if you send "undefined" as the 3rd praameter, then you can use this call as a promise, like:

  gapi.client.load('guestbook', 'v1', undefined, '/_ah/api').then(function() {
    $scope.is_backend_ready = true;
    $scope.list();
  });

我还没有见过这样的谷歌文档。请让我知道如果存在的话。

I haven't seen any google documentation of this. Please let me know if this exists.

这篇关于可以gapi.client.load云终端返回一个承诺?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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