从Drive打开文件时未调用Onfileuploaded事件

时间:2013-12-05 09:07:13

标签: javascript google-drive-api google-drive-realtime-api

我正在尝试在我的Google实时应用程序创建的Google云端硬盘中打开一个文件。尽管URL正确打开,但在afterAuth事件之后不会触发onfileloaded事件。当我的应用程序创建的文件是从Google云端硬盘打开时,我是否应该期待并处理其中的不同事件。在另一个窗口中复制URL会触发onfileload事件。

OnfileLoaded:

function onFileLoaded(doc) {
  Util.log.console("Doc:");
  Util.log.console(doc);
  data = doc.getModel().getRoot().get('data');
}

我也尝试过处理onLoad(of model)事件。也没有帮助。

1 个答案:

答案 0 :(得分:1)

/**
 * Parses the hash parameters to this page and returns them as an object.
 * @function
 */
rtclient.getParams = function() {
  var params = {};
  // The following statement was changed from window.location.hash
  // to window.location.search.  There was no hash in the URL.  So
  // .hash was returning an empty string.
  var hashFragment = window.location.search;
  if (hashFragment) {
    // split up the query string and store in an object
    var paramStrs = hashFragment.slice(1).split("&");
    for (var i = 0; i < paramStrs.length; i++) {
      var paramStr = paramStrs[i].split("=");
      params[paramStr[0]] = unescape(paramStr[1]);
    }
  }
  return params;
}

在realtime-client-utils.js中修复了它