fix init problems with v12, update examples to be synchronous
This commit is contained in:
parent
d2d74a64ab
commit
059f72ffe1
2
dist
2
dist
@ -1 +1 @@
|
|||||||
Subproject commit 4726c71dd0e95db9200b92c4434729954539edd9
|
Subproject commit 15615024f38b93198775bd71f26c5096ffc95a0a
|
13
src/y.js
13
src/y.js
@ -140,6 +140,9 @@ class YConfig {
|
|||||||
for (var propertyname in opts.share) {
|
for (var propertyname in opts.share) {
|
||||||
var typeConstructor = opts.share[propertyname].split('(')
|
var typeConstructor = opts.share[propertyname].split('(')
|
||||||
var typeName = typeConstructor.splice(0, 1)
|
var typeName = typeConstructor.splice(0, 1)
|
||||||
|
var type = Y[typeName]
|
||||||
|
var typedef = type.typeDefinition
|
||||||
|
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor]
|
||||||
var args = []
|
var args = []
|
||||||
if (typeConstructor.length === 1) {
|
if (typeConstructor.length === 1) {
|
||||||
try {
|
try {
|
||||||
@ -147,11 +150,13 @@ class YConfig {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('Was not able to parse type definition! (share.' + propertyname + ')')
|
throw new Error('Was not able to parse type definition! (share.' + propertyname + ')')
|
||||||
}
|
}
|
||||||
|
if (type.typeDefinition.parseArguments == null) {
|
||||||
|
throw new Error(typeName + ' does not expect arguments!')
|
||||||
|
} else {
|
||||||
|
args = typedef.parseArguments(args[0])[1]
|
||||||
}
|
}
|
||||||
var type = Y[typeName]
|
}
|
||||||
var typedef = type.typeDefinition
|
share[propertyname] = yield* this.store.initType.call(this, id, args)
|
||||||
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor]
|
|
||||||
share[propertyname] = this.store.createType(type.apply(typedef, args), id)
|
|
||||||
}
|
}
|
||||||
this.store.whenTransactionsFinished()
|
this.store.whenTransactionsFinished()
|
||||||
.then(callback)
|
.then(callback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user