Last active
August 29, 2015 14:04
-
-
Save lski/eb4b721236ed831552e7 to your computer and use it in GitHub Desktop.
A simple empty template for creating a reuseable module in javascript, that either runs as an amd module or as vanilla code
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
/*jslint browser: true, white: true */ | |
/*global define, window */ | |
;(function(factory) { | |
"use strict"; | |
// simply the dependanices required for this module pass in either required module names or the raw objects if amd not found | |
if (typeof define === 'function' && define['amd']) { | |
define([], factory); | |
} | |
else { | |
factory(); | |
// To make the returned object globally accessible | |
// window['mylib'] = factory(); | |
} | |
})(function() { // pass in the dependancies for this module | |
"use strict"; | |
// Enter code to run here | |
return { | |
// module object to return | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment