I'm wanting to develop a library following some interesting patterns of jQuery (Builder and Prototype, basically). I tried to read the jQuery source and search for tutorials but did not get anywhere.
My idea is to allow access of this type:
grace(...)
is callable directlygrace.set(...)
can have methodsgrace.fn.get = ...
can set new methods
(function(window, undefined) {
"use strict";
//
var grace = function(options) {
return new grace.fn.init(options);
};
//
grace.fn = grace.prototype = {
//
set: function() {
alert("grace.set() OK");
},
//
init: function() {
alert("grace() OK");
},
};
//
window.grace = grace;
})(window);
It is callable directly, but their methods are not accessible.