retry-until:一个函数,它将持续运行您赋予它的函数,直到它抛出一段时间

时间:2024-06-12 09:59:27
【文件属性】:

文件名称:retry-until:一个函数,它将持续运行您赋予它的函数,直到它抛出一段时间

文件大小:75KB

文件格式:ZIP

更新时间:2024-06-12 09:59:27

JavaScript

重试直到 这是在函数抛出一段时间后一直保持调用状态的一种方法。 如果该函数返回了一个Promise,它将在指定的时间内不断重试Promise,只要它不断抛出即可。 用法 const retryUntil = require ( 'retry-until' ) const retryFor1Second = retryUntil ( 1000 ) // retry for 1 second const retryFor10Seconds = retryUntil ( 10000 ) // retry for 10 seconds // this will busy-loop calling the function as fast as it can for // up to 1s, or until it returns without throwing, whichever come


【文件预览】:
retry-until-master
----.gitignore(282B)
----README.md(1KB)
----test()
--------index.js(786B)
----LICENSE(748B)
----package.json(622B)
----index.js(619B)
----package-lock.json(309KB)

网友评论