【文件属性】:
文件名称:before-after-hook:使用beforeafter钩子包装方法
文件大小:91KB
文件格式:ZIP
更新时间:2021-04-29 16:33:08
api hooks events async asynchronous
挂机前
内部功能的异步钩子
用法
单钩
// instantiate singular hook API
const hook = new Hook . Singular ( ) ;
// Create a hook
function getData ( options ) {
return hook ( fetchFromDatabase , options )
. then ( handleData )
. catch ( handleGetError ) ;
}
// register before/error/after hooks.
// The methods can be async or return a promise
hook . before ( beforeHook ) ;
hook . error ( errorHook ) ;
hook .
【文件预览】:
before-after-hook-master
----.gitignore(27B)
----package.json(2KB)
----package-lock.json(293KB)
----.travis.yml(616B)
----CODE_OF_CONDUCT.md(3KB)
----LICENSE(11KB)
----index.js(2KB)
----examples()
--------authentication-example.md(2KB)
--------test-mock-example.md(1KB)
--------store-example.md(3KB)
----README.md(15KB)
----lib()
--------remove.js(331B)
--------add.js(1004B)
--------register.js(678B)
----test()
--------integration()
--------unit()
--------index.js(45B)
--------typescript-validate.ts(1KB)
----index.d.ts(4KB)