basic get&set of Map properties works

This commit is contained in:
Kevin Jahns
2015-06-29 13:20:19 +02:00
parent 8f63147dbc
commit bffbb6ca27
14 changed files with 146 additions and 56 deletions

View File

@@ -1,11 +1,25 @@
/* @flow */
const GeneratorFunction = (function*(){}).constructor;
class Y { //eslint-disable-line no-unused-vars
constructor (opts) {
this.connector = new Y[opts.connector.name](opts.connector);
this.db = new Y[opts.db.name](this, opts.db);
this.connector = new Y[opts.connector.name](this, opts.connector);
var y = this;
this.db.requestTransaction(function*(){
yield* this.addOperation({
id: ["_", 0],
struct: "Map",
map: {}
});
y.root = new Y.Map.Create(["_", 0]);
});
}
transact (generator) {
if (generator.constructor !== GeneratorFunction) {
throw new Error("y.transact requires a Generator function! E.g. function*(){/*..*/}");
}
this.db.requestTransaction(generator);
}
destroy () {