Skip to content

Instantly share code, notes, and snippets.

@svenwin
Created May 10, 2010 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenwin/396407 to your computer and use it in GitHub Desktop.
Save svenwin/396407 to your computer and use it in GitHub Desktop.
// Chrome specialities
x.name = uki.newProperty('_name'); // assings a closure to name
// Uki model code:
addFields: function(target, names) {
for (var i=0; i < names.length; i++) {
target[names[i]] = uki.data.model._newProp(names[i]);
console.log(i, target[names[i]], names[i]);
}
// do not break prototypes
target._fields = names.concat(target._fields || []);
},
/* produces
0 function (value) {
if (value === undefined) return this[field];
if (setter) { setter.call(this, value); } else { this[field] = value; };
return this;
} "id"
client.cjs:76741 "" "name"
client.cjs:76742 function (value) {
if (value === undefined) return this[field];
if (setter) { setter.call(this, value); } else { this[field] = value; };
return this;
} "usage_count"
name seems to be a reserved word in chrome...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment