免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年1月23日 星期五

nodejs require() 參數用法


var app = require('./app')(cfg, dirp);

./app/index.js
module.exports = function(configFile, dirpath){ ... }



//=== http://stackoverflow.com/questions/7367850/node-js-require-function-and-parameters

""" ...

// somefile
require("lib.js")(app, param2)
// lib.js
module.exports = function(app, param2) { }
...


module.exports = exports = function() 
{ console.log('arguments: %j\n', arguments); };

> var requires = require('./requires')(0,1,2,3,4,5);
arguments: {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5}


...

first check to see that your object is defined properly 
(and spelled properly when you pass it in), 
then check that you don't have syntax errors.

..."""

沒有留言:

張貼留言