callbackify:npm 模块

时间:2021-06-20 00:35:32
【文件属性】:
文件名称:callbackify:npm 模块
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-20 00:35:32
JavaScript 回调 向后兼容你的回调函数,同时将 apis 迁移到 promises 用法 var callbackify = require ( 'callbackify' ) var getUserById = callbackify ( function ( id ) { // in this example, we're using [minq](https://npm.im/minq) return db . users . byId ( id ) . first ( ) } ) // later in your code, we can use a callback getUserById ( 23 , function ( err , user ) { if ( err ) { /* give up */ return } console . log ( 'hello,
【文件预览】:
callbackify-master
----index.js(1KB)
----package.json(545B)
----test()
--------test.js(2KB)
----LICENSE.md(1KB)
----.gitignore(23B)
----README.md(2KB)

网友评论