Skip to content

Instantly share code, notes, and snippets.

@viezel
Last active December 10, 2015 23:19
Show Gist options
  • Save viezel/4508849 to your computer and use it in GitHub Desktop.
Save viezel/4508849 to your computer and use it in GitHub Desktop.
CommonJS example
//method 1: minklasse.js
function MinKlasse(args){
function hejsa(){
return 1;
}
return {
hejsa:function(){
return 1;
}
}
}
module.exports = MinKlasse;
//method 2
exports.hejsa = function(){
return 1;
}
//Method 1: index.js
var MinKlasse = require("minklasse");
minKlasse = new MinKlassse(args);
//Method 2: index.js
var MinKlasse = require("minklasse");
MinKlasse.hejsa();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment