Last active
May 23, 2017 10:27
-
-
Save dan-cooke/2878c5bd77fdeef794d37973623fdaf0 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/dabebax
This file contains 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
//module test | |
'use strict'; | |
//the namespace that will be exported | |
var myModule = {}; | |
//wrapper function to export all as one namespace | |
(function wrapper(exports) { | |
(function existsModule(exports) { | |
var api = { | |
moduleExists: function moduleExists() { | |
return true; | |
} | |
}; | |
Object.assign(exports, api); | |
})(typeof exports === 'undefined' ? window : exports); | |
})(myModule); | |
console.log(myModule.moduleExists); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module Pattern