code refactoring, and documentation
This commit is contained in:
@@ -167,15 +167,16 @@
|
||||
Y.Array = new Y.utils.CustomType({
|
||||
class: YArray,
|
||||
createType: function * YArrayCreator () {
|
||||
var modelid = this.store.getNextOpId()
|
||||
var model = {
|
||||
struct: 'List',
|
||||
type: 'Array',
|
||||
start: null,
|
||||
end: null,
|
||||
id: this.store.getNextOpId()
|
||||
id: modelid
|
||||
}
|
||||
yield* this.applyCreatedOperations([model])
|
||||
return yield* this.createType(model)
|
||||
return modelid
|
||||
},
|
||||
initType: function * YArrayInitializer (os, model) {
|
||||
var valArray = []
|
||||
|
||||
@@ -134,8 +134,9 @@
|
||||
if (value instanceof Y.utils.CustomType) {
|
||||
// construct a new type
|
||||
this.os.requestTransaction(function *() {
|
||||
var type = yield* value.createType.call(this)
|
||||
insert.opContent = type._model
|
||||
var typeid = yield* value.createType.call(this)
|
||||
var type = yield* this.getType(typeid)
|
||||
insert.opContent = typeid
|
||||
insert.id = this.store.getNextOpId()
|
||||
yield* this.applyCreatedOperations([insert])
|
||||
resolve(type)
|
||||
@@ -212,14 +213,15 @@
|
||||
Y.Map = new Y.utils.CustomType({
|
||||
class: YMap,
|
||||
createType: function * YMapCreator () {
|
||||
var modelid = this.store.getNextOpId()
|
||||
var model = {
|
||||
map: {},
|
||||
struct: 'Map',
|
||||
type: 'Map',
|
||||
id: this.store.getNextOpId()
|
||||
id: modelid
|
||||
}
|
||||
yield* this.applyCreatedOperations([model])
|
||||
return yield* this.createType(model)
|
||||
return modelid
|
||||
},
|
||||
initType: function * YMapInitializer (os, model) { // eslint-disable-line
|
||||
return new YMap(os, model)
|
||||
|
||||
@@ -267,15 +267,16 @@
|
||||
Y.TextBind = new Y.utils.CustomType({
|
||||
class: YTextBind,
|
||||
createType: function * YTextBindCreator () {
|
||||
var modelid = this.store.getNextOpId()
|
||||
var model = {
|
||||
start: null,
|
||||
end: null,
|
||||
struct: 'List',
|
||||
type: 'TextBind',
|
||||
id: this.store.getNextOpId()
|
||||
id: modelid
|
||||
}
|
||||
yield* this.applyCreatedOperations([model])
|
||||
return yield* this.createType(model)
|
||||
return modelid
|
||||
},
|
||||
initType: function * YTextBindInitializer (os, model) {
|
||||
var valArray = []
|
||||
|
||||
Reference in New Issue
Block a user