2014-02-13 37 views
0

好的,我试图在Google开发人员指南https://developers.google.com/drive/realtime/build-model#registering_and_creating_custom_objects之后的Google Realtime API中创建协作自定义对象。但是,目前它运行良好,但是,当我尝试在模型中创建一个对象(将initializeModel函数中的两行取消注释)时,出现错误“log:Net状态从BUSY更改为CLIENT_ERROR” 。在JavaScript中不会出现错误。我不知道我哪里错了,任何帮助表示赞赏。谢谢,在Google Drive实时API中创建自定义对象时出现错误

 Project = function() {}; 
    registerTypes = function() { 
     var custom = gapi.drive.realtime.custom; 
     custom.registerType(Project, 'Project');        
     Project.prototype.title = gapi.drive.realtime.custom.collaborativeField('title'); 
     Project.prototype.date = gapi.drive.realtime.custom.collaborativeField('date'); 
     Project.prototype.content = gapi.drive.realtime.custom.collaborativeField('content'); 
} 
/** 
* Set up the model - when creating a new file or loading an existing one. 
*/ 

// the model for the messages in the chat 
var messages = undefined; 
// the name of the authenticated user - once authentication has succeeded 
var username = "unkown"; 
var realtimeLoader = undefined; 

/** 
* Set up the model - when creating a new file or loading an existing one.*/ 
var initializeModel = function(model) { 
    var messages = model.createList(); 
    var dealines2 = model.createList(); 
    /*var project1 = model.create("Project");*/ 
    model.getRoot().set('messages', messages); 
    /*model.getRoot().set('project1', project1);*/ 
    model.getRoot().set('dealines2', dealines2); 
    console.log(model.getRoot()); 
} 

回答

0

你曾经调用过registerTypes吗?加载文档之前需要注册类型。

相关问题