hookit

2019-08-16 admin

hookit是什么

什么是hookit,A function for shimming all node.js core IO calls allowing callback wraping.

hookit使用教程帮助文档

hook

Shim all core IO calls and allow callback shimming via wrap function.

###Installation

$ npm install hookit

###Usage:

hookit(function generateShim(callback, fnName) {
  return function() {
    try {
      callback.apply(this, arguments);
    } finally {
      console.log('bummer.')
    }
  }
})

process.nextTick(function() {
  throw new Error('here') // Will log "bummer" before we crash on error
})

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-72635.html

文章标题:hookit

回到顶部