basic get&set of Map properties works
This commit is contained in:
16
src/y.js
16
src/y.js
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user