var Worker = require("webworker-threads").Worker;
require("http")
.createServer(function(req, res) {
var fibo = new Worker(function() {
console.log('var', unknownvar)
function fibo(n) {
console.log('n', n)
return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1;
}
this.onmessage = function(event) {
postMessage(fibo(event.data));
};
});
fibo.onerror = function(error) {
console.log('error', error)
}
fibo.onmessage = function(event) {
res.end("fib result" + event.data);
};
fibo.postMessage(10);
})
.listen(8001);
I am trying to access some unknown variable with this
>console.log('var', unknownvar)
and this code is not responding anything , its not working also. It becomes difficult to debug what is going on without any response.