Javascript 在Google Drive实时API中创建自定义对象时出错
好的,我正试图按照谷歌开发者指南,在谷歌实时API中创建一个协作自定义对象。然而,它目前运行良好,然而,当我尝试在模型中创建一个对象时(从注释中去掉initializeModel函数中的两行),我得到了错误“log:Net state changed from BUSY to CLIENT_error”。JavaScript中不会抛出错误。我不知道我哪里出了问题,任何帮助都将不胜感激。谢谢Javascript 在Google Drive实时API中创建自定义对象时出错,javascript,object,google-drive-realtime-api,Javascript,Object,Google Drive Realtime Api,好的,我正试图按照谷歌开发者指南,在谷歌实时API中创建一个协作自定义对象。然而,它目前运行良好,然而,当我尝试在模型中创建一个对象时(从注释中去掉initializeModel函数中的两行),我得到了错误“log:Net state changed from BUSY to CLIENT_error”。JavaScript中不会抛出错误。我不知道我哪里出了问题,任何帮助都将不胜感激。谢谢 Project = function() {}; registerTypes =
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());
}
你有没有叫过注册类型?在加载文档之前,需要注册类型