Skip to content

Instantly share code, notes, and snippets.

@Najki
Last active February 11, 2024 22:13
Show Gist options
  • Save Najki/3ee96ee2f377d6ec88a27ca40ae71cf6 to your computer and use it in GitHub Desktop.
Save Najki/3ee96ee2f377d6ec88a27ca40ae71cf6 to your computer and use it in GitHub Desktop.
JavaScript AMD Module pattern
/* global $, module, require, window, console, alert, confirm */
var _ = require('underscore');
module.exports = (function () {
'use strict';
/**
* @private
* @type {boolean}
*/
var privateVarExample = false,
/**
* @private
* @type {boolean}
*/
secondPrivateVarExample = true;
/**
* Description
*
* @function
* @private
*/
function privateFunctionExample() {
//
}
return {
/**
* Description
*
* @function
* @public
* @param {Object} params
*/
publicFunctionExample: function (params) {
privateFunctionExample();
},
/**
* Description
*
* @function
* @public
*/
initialize: function () {
this.publicFunctionExample();
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment