code refactoring, and documentation

This commit is contained in:
Kevin Jahns
2015-09-29 13:59:38 +02:00
parent 638c575dfc
commit 8745fd64ca
11 changed files with 116 additions and 117 deletions

View File

@@ -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 = []

View File

@@ -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)

View File

@@ -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 = []