Skip to content

Instantly share code, notes, and snippets.

@amatiasq
Created April 5, 2013 10:41
Show Gist options
  • Save amatiasq/5318334 to your computer and use it in GitHub Desktop.
Save amatiasq/5318334 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