Skip to content
Snippets Groups Projects
Commit 059f72ff authored by Kevin Jahns's avatar Kevin Jahns
Browse files

fix init problems with v12, update examples to be synchronous

parent d2d74a64
No related branches found
No related tags found
No related merge requests found
Subproject commit 4726c71dd0e95db9200b92c4434729954539edd9
Subproject commit 15615024f38b93198775bd71f26c5096ffc95a0a
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment