Created
August 17, 2014 13:58
-
-
Save tolu/3b9bb490a8e67b3938dd to your computer and use it in GitHub Desktop.
JS module
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
(function (definition) { | |
// Turn off strict mode for this function so we can assign to global | |
/* jshint strict: false */ | |
// This file will function properly as a <script> tag, or a module | |
// using CommonJS and NodeJS or RequireJS module formats. In | |
// Common/Node/RequireJS, the module exports the API and when | |
// executed as a simple <script>, it creates a global instead. | |
// Montage Require | |
if (typeof bootstrap === "function") { | |
bootstrap("promise", definition); | |
// CommonJS | |
} else if (typeof exports === "object") { | |
module.exports = definition(); | |
// RequireJS | |
} else if (typeof define === "function" && define.amd) { | |
define(definition); | |
// SES (Secure EcmaScript) | |
} else if (typeof ses !== "undefined") { | |
if (!ses.ok()) { | |
return; | |
} else { | |
ses.makeQ = definition; | |
} | |
// <script> | |
} else { | |
myModule = definition(); | |
} | |
})(function () { | |
"use strict"; | |
var module = {}; | |
return module; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment