Skip to content

Instantly share code, notes, and snippets.

@ducksoupdev
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save ducksoupdev/c6b7cef870eb3cc1e1f5 to your computer and use it in GitHub Desktop.

Select an option

Save ducksoupdev/c6b7cef870eb3cc1e1f5 to your computer and use it in GitHub Desktop.
Template for isomorphix (server + client) JS
(function (root, factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["b"], function (b) {
return (root.returnExportsGlobal = factory(b));
});
} else if (typeof exports === "object") {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require("b"));
} else {
// Browser globals
root.returnExportsGlobal = factory(root.b);
}
}(this, function (b) {
//use b in some fashion.
// Just return a value to define the module export.
// This example returns an object, but the module
// can return a function as the exported value.
return {};
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment