ortense
7/16/2014 - 6:18 PM

My JS Constructor/Class template

My JS Constructor/Class template

var Constructor_name = (function(){

	/** CONSTRUCTOR **/

	function Constructor_name (params) {
		// body...
	}

	/** PRIVATE METHODS **/

	var private_method = function (argument) {
		// body...
	}

	/** PUBLIC METHODS **/

	Constructor_name.prototype.public_method = function(argument) {
		// body...
	};
	
	return Constructor_name;
})();

/** INSTANCE **/

var obj = new Constructor_name();