cjsengine
v0.1.3
Published
cjs engine for webserver's module hot reload, etc.
Downloads
2
Readme
cjsengine
cjs engine for webserver's module hot reload, etc.
usage
const cjs = require('cjsengine');
const engine = cjs.createEngine({
base: __dirname,
path_libs: [
__dirname + '/lib/'
],
// path_lib: '',
params: 'ctx' // req, res, urls, server
});
async function xxxx() {
const ret = await engine.invoke('./test.cjs', [engine, "abc", 123, true]);
console.log(ret); // true
}
xxxx();
// test.cjs
module.exports = function(engine, a, b, c) {
console.log(a, b, c);
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, 2000);
});
};