Created
December 11, 2016 04:40
-
-
Save shashankduhan/acceca7f49f0d2b0f200e8b0ddfaf6b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mymodule = (function(){ | |
| "use strict"; | |
| //This is sample module for loading a module using require() function in webpack. | |
| return { | |
| init: function(){ | |
| //************************************* | |
| //Initialize some global functions.. | |
| //If you want to load a library, write codes in here. | |
| //************************************* | |
| }, | |
| myfunction: function(){ | |
| alert('Cool'); | |
| }, | |
| myvariable: 123; | |
| } | |
| })(); | |
| //UMD Wrapper (github.com/umdjs/umd/blob/master/returnExports.js | @umdjs + @nason) | |
| (function(root, factory) { | |
| // AMD. | |
| if (typeof define === 'function' && define.amd) | |
| define([], factory); | |
| // Node. | |
| else if (typeof exports === 'object') | |
| module.exports = factory(); | |
| // Browser global. | |
| else | |
| root.mymodule = factory(); | |
| }(this, function() { return mymodule; })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment