NS.test = function() {
NS.test.prototype.doSomething = function()
{
...
};
};
NS.test2 = new function() {
this.doSomething = function() {
...
};
};
(function() {
var test3 = function() {};
test3.prototype = {
doSomething : function()
{
...
}
};
NS.test3.doSomethingStatic = function() {
...
}
NS.test3 = test3;
})();var test1 = new NS.test();
test1.doSomething();NS.test2.doSomething();
var test3 = new NS.test3();
test3.doSomething();
NS.test3.doSomethingStatic();
Friday, September 5, 2008
Javascript object instance methods
Some other styles i've seen in the creation of instance methods on Javascript objects are as follows:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment