尝试创建自定义类型并添加实例时出错

时间:2013-07-27 09:52:28

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

 function initializeModel(model) {

   Book = function() {}
   Book.prototype.title = gapi.drive.realtime.custom.collaborativeField('title');
   Book.prototype.author = gapi.drive.realtime.custom.collaborativeField('author');
   Book.prototype.isbn = gapi.drive.realtime.custom.collaborativeField('isbn');
   Book.prototype.isCheckedOut = gapi.drive.realtime.custom.collaborativeField('isCheckedOut');
   Book.prototype.reviews = gapi.drive.realtime.custom.collaborativeField('reviews');
   gapi.drive.realtime.custom.registerType(this.Book, 'Book'); 


   //Error begin  from  here
   var book = model.create('Book');
   book .title = "hello,waiter"
   model.getRoot().set('book', book);

 }
在Chrome控制台中它提醒我:

  

Drive Realtime API错误:invalid_compound_operation:打开化合物   同步块结束时的操作 - 你忘记打电话了   endCompoundOperation()?

我犯错误的地方?谁能给我一个通过google drive realtime api创建自定义类型的示例?

0 个答案:

没有答案