fix init problems with v12, update examples to be synchronous

This commit is contained in:
Kevin Jahns 2016-08-30 18:10:19 +02:00
parent d2d74a64ab
commit 059f72ffe1
2 changed files with 10 additions and 5 deletions

2
dist

@ -1 +1 @@
Subproject commit 4726c71dd0e95db9200b92c4434729954539edd9
Subproject commit 15615024f38b93198775bd71f26c5096ffc95a0a

View File

@ -140,6 +140,9 @@ class YConfig {
for (var propertyname in opts.share) {
var typeConstructor = opts.share[propertyname].split('(')
var typeName = typeConstructor.splice(0, 1)
var type = Y[typeName]
var typedef = type.typeDefinition
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor]
var args = []
if (typeConstructor.length === 1) {
try {
@ -147,11 +150,13 @@ class YConfig {
} catch (e) {
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
var id = ['_', typedef.struct + '_' + typeName + '_' + propertyname + '_' + typeConstructor]
share[propertyname] = this.store.createType(type.apply(typedef, args), id)
share[propertyname] = yield* this.store.initType.call(this, id, args)
}
this.store.whenTransactionsFinished()
.then(callback)