[RxJS] Simplified retryWhen and repeatWhen
src$.pipe( retryWhen(error$ => error$.pipe( switchMap(getNotifier) )) ) // can just be src$.pipe( retry({ delay: getNotifier }) ) /** * The {@link retry} operator configuration object. `retry` either accepts a `number` * or an object described by this interface. */ export interface RetryConfig { /** * The maximum number of times to retry. If `count` is omitted, `retry` will try to * resubscribe on errors infinite number of times. */ count?: number; /** * The number of milliseconds to delay before retrying, OR a function to * return a notifier for delaying. If a function is given, that function should * return a notifier that, when it emits will retry the source. If the notifier * completes _without_ emitting, the resulting observable will complete without error, * if the notifier errors, the error will be pushed to the result. */ delay?: number | ((error: any, retryCount: number) => ObservableInput<any>); /** * Whether or not to reset the retry counter when the retried subscription * emits its first value. */ resetOnSuccess?: boolean; }
// Before: a simple daly src$.pipe( retryWhen(error$ => error$.pipe( switchMap(() => timer(5000)) )) ) // Now src$.pipe( retry({ delay: 5000 }) )
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2020-03-30 [Javascript] Finding Sibling Elements
2020-03-30 [Javascript] Finding Parent Elements
2019-03-30 [PureScript] Basic Data Constructors in PureScript
2019-03-30 [Algorithm] Check for balanced parentheses using stack
2017-03-30 [CSS] Change the auto-placement behaviour of grid items with grid-auto-flow
2017-03-30 [Typescript] Sorting arrays in TypeScript
2016-03-30 [React] React Router: Redirect