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创建自定义类型的例子?