Use of process handle:
Some time When you write program , before end of your program you want to clear some connection , thread, memory . In such case while terminate your process you need to write some code.
In Node.js The process object is a global object and can be accessed from anywhere.
Who will handle method in process.
Node.js runtime process will call handlers assign in process objects.
How to use.
Some time When you write program , before end of your program you want to clear some connection , thread, memory . In such case while terminate your process you need to write some code.
In Node.js The process object is a global object and can be accessed from anywhere.
Who will handle method in process.
Node.js runtime process will call handlers assign in process objects.
How to use.
process.on('exit', function(code) {
console.log("On Exit Start");
setTimeout(function() {
console.log('This will not run');
}, 1000);
console.log('About to exit with code:', code);
});
console.log("Current Time-"+new Date());
var timerId=setTimeout(function(){
console.log("Current Time-"+new Date());
}, 5000);


No comments:
Post a Comment