broke the dammn thing

This commit is contained in:
DadaMonad
2015-02-19 15:55:05 +00:00
parent 792440a71d
commit 860934de06
17 changed files with 1098 additions and 1016 deletions

View File

@@ -0,0 +1,80 @@
var YObject;
YObject = (function() {
function YObject(_at__object) {
var name, val, _ref;
this._object = _at__object != null ? _at__object : {};
if (this._object.constructor === Object) {
_ref = this._object;
for (name in _ref) {
val = _ref[name];
if (val.constructor === Object) {
this._object[name] = new YObject(val);
}
}
} else {
throw new Error("Y.Object accepts Json Objects only");
}
}
YObject.prototype._name = "Object";
YObject.prototype._getModel = function(types, ops) {
var n, o, _ref;
if (this._model == null) {
this._model = new ops.MapManager(this).execute();
_ref = this._object;
for (n in _ref) {
o = _ref[n];
this._model.val(n, o);
}
}
delete this._object;
return this._model;
};
YObject.prototype._setModel = function(_at__model) {
this._model = _at__model;
return delete this._object;
};
YObject.prototype.observe = function(f) {
return this._model.observe(f);
};
YObject.prototype.val = function(name, content) {
var n, res, v, _ref;
if (this._model != null) {
return this._model.val.apply(this._model, arguments);
} else {
if (content != null) {
return this._object[name] = content;
} else if (name != null) {
return this._object[name];
} else {
res = {};
_ref = this._object;
for (n in _ref) {
v = _ref[n];
res[n] = v;
}
return res;
}
}
};
return YObject;
})();
if (typeof window !== "undefined" && window !== null) {
if (window.Y != null) {
window.Y.Object = YObject;
} else {
throw new Error("You must first import Y!");
}
}
if (typeof module !== "undefined" && module !== null) {
module.exports = YObject;
}