【文件属性】:
文件名称:promise-once:包装一个承诺构造函数以每次创建和返回相同的承诺
文件大小:2KB
文件格式:ZIP
更新时间:2021-07-14 11:10:45
JavaScript
承诺一次
包装一个承诺构造函数以每次都返回相同的承诺。
这是承诺。
npm install promise-once --save
用法
var i = 0 ;
var incrementOnce = require ( 'promise-once' ) ( increment ) ;
incrementOnce ( )
. then ( incrementOnce )
. then ( incrementOnce )
. then ( incrementOnce )
. then ( incrementOnce )
. then ( incrementOnce )
. then ( console . log )
// `1` is written to the console
function increment ( ) {
i ++ ;
}
默认
【文件预览】:
promise-once-master
----index.js(259B)
----test.js(436B)
----package.json(465B)
----readme.md(1KB)
----LICENSE(758B)