title: Passing a parameter trough require-module to ES6 class in Nodejs
body: <p>I am learning to use ECMAScript6 -styled classes in NodeJS (7.7.3). I have used this kind of programming style:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//app.js
  var forecastHandler = require('./forecastHandler.js');
  
  //forecastHandler.js
  class ForecastHandler {
    constructor() {}
  }
  
  module.exports = new ForecastHandler()</code></pre>
  </div>
  </div>
  </p>
  
  <p>It has worked well until now, because I have to pass parameters to module.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//app.js
  var forecastHandler = require('./forecastHandler.js')(3600);
  
  //forecastHandler.js
  class ForecastHandler {
    constructor(cacheUpdateDelay) {}
  }
  
  module.exports = new ForecastHandler(cacheUpdateDelay)</code></pre>
  </div>
  </div>
  </p>
  
  <p>I got this error: ReferenceError: cacheUpdateDelay is not defined.
  Can I pass the parameter to ForecastHandler-module using ES6 styled classes and creating an object at module.exports? If I only export the class and create the object in app.js, code works, but it's syntax is ugly.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//app.js
  var forecastHandlerClass = require('./forecastHandler.js');
  var forecastHandler = new forecastHandlerClass(3600);
  
  //forecastHandler.js
  module.exports = ForecastHandler</code></pre>
  </div>
  </div>
  </p>
  
  <p>EDIT: better examples</p>