类似过程
处理资源和事件以正常退出
const like = require ( 'like-process' ) ;
setTimeout ( ( ) => this_var_not_exists , 2000 ) ;
let intervalId = setInterval ( ( ) => {
console . log ( 'count' ) ;
} , 500 ) ;
like . on ( 'cleanup' , ( ) => {
console . log ( 'cleanup' ) ;
clearInterval ( intervalId ) ;
} ) ;
like . handle ( 'uncaughtException' , ( evt , err ) => {
console . error ( err ) ;
} ) ;
安装
npm i li
评论0
最新资源