Skip to main content
1 of 2
ngr
  • 115
  • 9

Diving deeper in Javascript. Need some advice

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 a own little framework(Purely for learning purposes).

I have devised a little contruct and i whas 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 alot 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));
ngr
  • 115
  • 9