Created
August 3, 2011 21:45
-
-
Save borismus/1123866 to your computer and use it in GitHub Desktop.
shared client/server javascript for node.js
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
load in node: | |
require('../common/module.js'); | |
load in browser: | |
<script src="../common/module.js"></script> | |
module.js: | |
(function(exports) { | |
var MyClass = function() { /* ... */ }; | |
var myObject = {}; | |
exports.MyClass = MyClass; | |
exports.myObject = MyObject; | |
})(typeof global === "undefined" ? window : exports); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment