UNPKG

509 BJavaScriptView Raw
1var hello = require('./othermodule.js'); // require a second ("child") mondule
2// micro-module to test functionality
3(function() {
4 'use strict';
5
6 var runcount = false;
7 console.log("Hello module says: " + hello()); // super useful module ;-)
8
9 var get = function () {
10 return runcount;
11 }
12
13 var set = function () {
14 runcount = runcount + 1;
15 return runcount;
16 }
17
18 module.exports = {
19 get: get,
20 set: set
21 };
22
23}()); // benalman.com/news/2010/11/immediately-invoked-function-expression