Skip to content

Instantly share code, notes, and snippets.

@mikeerickson
Forked from amatiasq/template.js
Created October 25, 2016 03:15
Show Gist options
  • Save mikeerickson/91ddd2283ae624418b845b8ba72028a2 to your computer and use it in GitHub Desktop.
Save mikeerickson/91ddd2283ae624418b845b8ba72028a2 to your computer and use it in GitHub Desktop.
Multiplatform adapter (require, dojo, node.js and vanilla browser)
(function(factory) {
if (typeof define !== 'undefined' && define.amd)
return define(factory);
if (typeof module !== 'undefined' && module.exports === exports)
return module.exports = factory();
window.LIB_NAME = factory();
})(function() {
// Library code here
// sample
function ok(value) {
if (!value)
throw new Error('its not ok!');
}
return {
ok: ok
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment