Brett's Blog
Edit     New

Saturday, February 21, 2009

Further Relator enhancements

Here are two other useful Relator methods:


constructor : function (that) {
this.set(that);
return this.get(that); // Assign to var _ = __.constructor(this);
},
method : function (that) { // Alias for get()
return this.get(that); // Assign to var _ = __.method(this);
},


Now we can just do this to get our private variables:

var Constructor = function () {var __ = Relator.$(); // We use two underscores here (doing it for brevity, as we may use this often)
function Constructor (doc) {var _ = __.constructor(this); // Set up and gets private access
// ...
}
Constructor.prototype = {
constructor : Constructor,
someMethod : function () {var _ = __.method(this); // Gets private access
// ...
}
};
return Constructor;
})();

0 Comments:

Post a Comment

<< Home


Google
 
Brett's Blog Web