renamed to yjs

This commit is contained in:
DadaMonad
2015-01-26 23:24:50 +00:00
parent d5c7d51dc4
commit 978203d73e
57 changed files with 83 additions and 54177 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -60,8 +60,8 @@ adaptConnector = function(connector, engine, HB, execution_listener) {
return engine.applyOp(op);
}
});
if (connector._whenBoundToYatta != null) {
return connector._whenBoundToYatta();
if (connector._whenBoundToY != null) {
return connector._whenBoundToY();
}
};

View File

@@ -116,7 +116,7 @@ module.exports = function(HB) {
o = type.create.apply(null, args);
return Object.__super__.val.call(this, name, o);
} else {
throw new Error("The " + content.constructor.name + "-type is not (yet) supported in Yatta.");
throw new Error("The " + content.constructor.name + "-type is not (yet) supported in Y.");
}
} else {
return Object.__super__.val.call(this, name, content);

View File

@@ -164,7 +164,7 @@ module.exports = function(HB) {
if ((type != null) && (type.create != null)) {
return type.create(content, options);
} else {
throw new Error("The " + content.constructor.name + "-type is not (yet) supported in Yatta.");
throw new Error("The " + content.constructor.name + "-type is not (yet) supported in Y.");
}
} else {
return content;

View File

@@ -1,92 +0,0 @@
var Yatta, bindToChildren;
Yatta = require('./yatta');
bindToChildren = function(that) {
var attr, i, _i, _ref;
for (i = _i = 0, _ref = that.children.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
attr = that.children.item(i);
if (attr.name != null) {
attr.val = that.val.val(attr.name);
}
}
return that.val.observe(function(events) {
var event, newVal, _j, _len, _results;
_results = [];
for (_j = 0, _len = events.length; _j < _len; _j++) {
event = events[_j];
if (event.name != null) {
_results.push((function() {
var _k, _ref1, _results1;
_results1 = [];
for (i = _k = 0, _ref1 = that.children.length; 0 <= _ref1 ? _k < _ref1 : _k > _ref1; i = 0 <= _ref1 ? ++_k : --_k) {
attr = that.children.item(i);
if ((attr.name != null) && attr.name === event.name) {
newVal = that.val.val(attr.name);
if (attr.val !== newVal) {
_results1.push(attr.val = newVal);
} else {
_results1.push(void 0);
}
} else {
_results1.push(void 0);
}
}
return _results1;
})());
} else {
_results.push(void 0);
}
}
return _results;
});
};
Polymer("yatta-element", {
ready: function() {
if (this.connector != null) {
this.val = new Yatta(this.connector);
return bindToChildren(this);
} else if (this.val != null) {
return bindToChildren(this);
}
},
valChanged: function() {
if ((this.val != null) && this.val.type === "Object") {
return bindToChildren(this);
}
},
connectorChanged: function() {
if (this.val == null) {
this.val = new Yatta(this.connector);
return bindToChildren(this);
}
}
});
Polymer("yatta-property", {
ready: function() {
if ((this.val != null) && (this.name != null)) {
if (this.val.constructor === Object) {
this.val = this.parentElement.val(this.name, this.val).val(this.name);
} else if (typeof this.val === "string") {
this.parentElement.val(this.name, this.val);
}
if (this.val.type === "Object") {
return bindToChildren(this);
}
}
},
valChanged: function() {
var _ref;
if ((this.val != null) && (this.name != null)) {
if (this.val.constructor === Object) {
return this.val = this.parentElement.val.val(this.name, this.val).val(this.name);
} else if (this.val.type === "Object") {
return bindToChildren(this);
} else if ((((_ref = this.parentElement.val) != null ? _ref.val : void 0) != null) && this.val !== this.parentElement.val.val(this.name)) {
return this.parentElement.val.val(this.name, this.val);
}
}
}
});

View File

@@ -1,54 +0,0 @@
var Engine, HistoryBuffer, adaptConnector, createYatta, json_types_uninitialized,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
json_types_uninitialized = require("./Types/JsonTypes");
HistoryBuffer = require("./HistoryBuffer");
Engine = require("./Engine");
adaptConnector = require("./ConnectorAdapter");
createYatta = function(connector) {
var HB, Yatta, type_manager, types, user_id;
user_id = null;
if (connector.id != null) {
user_id = connector.id;
} else {
user_id = "_temp";
connector.whenUserIdSet(function(id) {
user_id = id;
return HB.resetUserId(id);
});
}
HB = new HistoryBuffer(user_id);
type_manager = json_types_uninitialized(HB);
types = type_manager.types;
Yatta = (function(_super) {
__extends(Yatta, _super);
function Yatta() {
this.connector = connector;
this.HB = HB;
this.types = types;
this.engine = new Engine(this.HB, type_manager.types);
adaptConnector(this.connector, this.engine, this.HB, type_manager.execution_listener);
Yatta.__super__.constructor.apply(this, arguments);
}
Yatta.prototype.getConnector = function() {
return this.connector;
};
return Yatta;
})(types.Object);
return new Yatta(HB.getReservedUniqueIdentifier()).execute();
};
module.exports = createYatta;
if ((typeof window !== "undefined" && window !== null) && (window.Yatta == null)) {
window.Yatta = createYatta;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long