If you want you constructor function to be a singleton, you are going to have to make a few tweaks to your code:
var Mui = (function (window, document, undefined) {
var Mui = function () {
//the cached instance
var instance;
//rewrite the constructor
Mui = function Mui() {
return instance;
};
//carry over the prototype properties
Mui.prototype = this;
//the instance
instance = new Mui();
//reset the constructor pointer
instance.constructor = Mui;
//all the functionality
instance.version = {
Major : '0',
Minor : '1',
Bugfix : '0'
};
return instance;
};
Mui.prototype.sayHi = function () {
alert('hi''Hi');
};
return Mui;
}(window, this.document));
var mui_1 = new Mui();
var mui_2 = new Mui();
alert(mui_1 === mui_2;mui_2); //truetrue
You can see this working here: http://jsfiddle.net/34vCH/3/