insertBefore (xml), and prevent bug for addProperty-listener

This commit is contained in:
Kevin Jahns
2014-09-29 09:58:44 +02:00
parent 98b1a8f660
commit 03d652f70b
66 changed files with 32695 additions and 382 deletions

View File

@@ -42,7 +42,26 @@ it will be instantly shared with all the other collaborators.
```js
yatta = new Y.JsonFramework(user_id, Connector);
yatta.val('w','w');
console.log(yatta.getUserId());
function show(o){
if (o.type === "JsonType"){
return JSON.stringify(o.toJson());
} else if (o.type === "WordType") {
return o.val();
} else if (o.constructor === {}.constructor) { // It's an Object
return JSON.stringify(o);
} else { // It's a primitive data type (E.g. string, int)
return o;
}
}
function addProperty(event_name, property_name, op){
// op is the operation that changed the objects value. In addProperty it is most likely to be a 'Replaceable' (see doc).
console.log("Property '" + property_name + "' was created by '"+op.creator+"'!");
console.log("Value: " + show(this.val(property_name))); // 'this' is the object on which the property was created.
};
yatta.on('addProperty', addProperty);
});
```