simple-asyncify:[已弃用]将同步功能转换为Node.js样式的异步功能

时间:2024-06-03 09:57:14
【文件属性】:

文件名称:simple-asyncify:[已弃用]将同步功能转换为Node.js样式的异步功能

文件大小:4KB

文件格式:ZIP

更新时间:2024-06-03 09:57:14

JavaScript

概述 将同步功能转换为Node.js风格的异步功能。 受启发。 var asyncify = require ( "simple-asyncify" ) function addSync ( a , b ) { if ( typeof a !== "number" || typeof b !== "number" ) { throw new TypeError ( "add requires two numbers" ) } return a + b } var add = asyncify ( addSync ) add ( 1 , 2 , function ( error , sum ) { console . log ( "The sum is: " + sum ) } ) add ( 1 , function ( error , sum ) { c


【文件预览】:
simple-asyncify-master
----.jshintrc(596B)
----.gitignore(13B)
----package.json(454B)
----.travis.yml(49B)
----changelog.md(169B)
----LICENSE(1KB)
----index.js(474B)
----readme.md(1KB)
----test()
--------index.js(1KB)

网友评论