I am diving deeper into JavaScript and starting to learn more about prototypes and simulating classes etc. I am used to working with the Module pattern and would like to try and combine this pattern along with working with prototyping into an own little framework (purely for learning purposes).
I have devised a little construct and I was hoping if some of you advanced users could give me some feedback on the particular construct.
What I am trying to achieve is to create a singleton with methods and properties one could access, I would like to extend/build this via the prototype as speed is something I care a lot about. The thing I still have doubts about is whether or not this would be a suitable construct for what I have in mind, whether or not this would be fast etc.
Much appreciated! Here's the code.
var Mui = (function (window, document, undefined) {
Mui = function () {
this.Version = {
Major : '0',
Minor : '1',
Bugfix : '0'
};
};
Mui.prototype = {
sayHi : function () {
alert('hi');
}
};
return new Mui;
}(window, this.document));
Version
property to be hard-coded into theMui
constructor, yes? \$\endgroup\$