When I start developing a javascript plugin need a proper structure at the time I found a solution to make a better way for the plugin. It's a better way to handle public and private functions. use this way to make a Javascript module
var PluginName = (function () {
'use strict';
var Constructor = function (config) {
var globalvar = {};
globalvar.config = config;
//public function
globalvar.customfunction = function (url) {
//stuff code
return;
}
//private function
function Test(){
//stuff code
return;
}
return globalvar;
};
return Constructor;
})(
/**********
*************************************************************************
************* JAVASCRIPT MODULE SAMPLE DONE BY KATHEESKUMAR ************
*************************************************************************
***************************** Version: 1.0 ******************************
*************************************************************************
**********/
);