rxjs-poll 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# RxJS Polling Operator
|
|
2
2
|
|
|
3
3
|
<a href="https://www.npmjs.com/package/rxjs-poll" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Version" src="https://img.shields.io/npm/v/rxjs-poll"></a>
|
|
4
|
-
<a href="https://bundlephobia.com/package/rxjs-poll@latest" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Bundle Size" src="https://img.shields.io/bundlephobia/minzip/rxjs-poll?label=gzip"></a>
|
|
4
|
+
<a href="https://bundlephobia.com/package/rxjs-poll@latest" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Bundle Size" src="https://img.shields.io/bundlephobia/minzip/rxjs-poll/latest?label=gzip"></a>
|
|
5
5
|
<a href="https://github.com/mmustra/rxjs-poll/tree/main/tests" target="_blank" rel="noopener noreferrer nofollow"><img alt="Codecov" src="https://img.shields.io/codecov/c/gh/mmustra/rxjs-poll?token=H9R97BLFQI"></a>
|
|
6
|
-
<a href="https://github.com/mmustra/rxjs-poll/issues" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub Issues
|
|
7
|
-
<a href="https://github.com/mmustra/rxjs-poll/commits/main" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub
|
|
6
|
+
<a href="https://github.com/mmustra/rxjs-poll/issues?q=is%3Aissue%20state%3Aopen%20label%3Alatest" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub Issues" src="https://img.shields.io/github/issues/mmustra/rxjs-poll/latest?label=issues"></a>
|
|
7
|
+
<a href="https://github.com/mmustra/rxjs-poll/commits/main" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub Latest Commits" src="https://img.shields.io/github/last-commit/mmustra/rxjs-poll/main?label=activity"></a>
|
|
8
8
|
|
|
9
9
|
A flexible RxJS operator library that enables polling on any completed observable source with advanced timing and retry strategies.
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ interface PollConfig {
|
|
|
137
137
|
delay?: {
|
|
138
138
|
/**
|
|
139
139
|
* Strategy mode for delay timing. Built-in strategies (except dynamic)
|
|
140
|
-
* calculate time per state's
|
|
140
|
+
* calculate time per state's `pollCount`.
|
|
141
141
|
* @default 'constant'
|
|
142
142
|
*/
|
|
143
143
|
strategy: 'constant' | 'random' | 'dynamic';
|
|
@@ -162,8 +162,8 @@ interface PollConfig {
|
|
|
162
162
|
/**
|
|
163
163
|
* Strategy mode for retry timing. Built-in strategies (except dynamic)
|
|
164
164
|
* calculate time per state:
|
|
165
|
-
* - consecutiveOnly: true → uses
|
|
166
|
-
* - consecutiveOnly: false → uses
|
|
165
|
+
* - consecutiveOnly: true → uses `consecutiveRetryCount`
|
|
166
|
+
* - consecutiveOnly: false → uses `retryCount`
|
|
167
167
|
* @default 'exponential'
|
|
168
168
|
*/
|
|
169
169
|
mode: 'constant' | 'linear' | 'exponential' | 'random' | 'dynamic';
|
|
@@ -183,8 +183,8 @@ interface PollConfig {
|
|
|
183
183
|
| (state: PollState) => number | [min: number, max: number];
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* Maximum number of retry attempts before throwing an error
|
|
187
|
-
* Use Infinity to keep retrying indefinitely
|
|
186
|
+
* Maximum number of retry attempts before throwing an error.
|
|
187
|
+
* Use `Infinity` to keep retrying indefinitely.
|
|
188
188
|
* @default 3
|
|
189
189
|
*/
|
|
190
190
|
limit?: number;
|
|
@@ -225,7 +225,7 @@ interface PollState<T> {
|
|
|
225
225
|
/** Current number of consecutive retry attempts */
|
|
226
226
|
consecutiveRetryCount: number;
|
|
227
227
|
|
|
228
|
-
/** Latest value from the source. For
|
|
228
|
+
/** Latest value from the source. For `interval` polling mode,
|
|
229
229
|
* first emission is undefined. */
|
|
230
230
|
value: T | undefined;
|
|
231
231
|
|
|
@@ -238,9 +238,11 @@ interface PollState<T> {
|
|
|
238
238
|
|
|
239
239
|
## 🚨 Breaking Changes
|
|
240
240
|
|
|
241
|
-
**Version 2** introduces an API focused on strategy-based configuration. The new architecture separates concerns between normal polling behavior and error handling scenarios, with type safety and clear configuration intent. This makes it easier to choose timings from common patterns.
|
|
241
|
+
**Version 2** ([source](https://github.com/mmustra/rxjs-poll)) introduces an API focused on strategy-based configuration. The new architecture separates concerns between normal polling behavior and error handling scenarios, with type safety and clear configuration intent. This makes it easier to choose timings from common patterns.
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
**Version 1** ([source](https://github.com/mmustra/rxjs-poll/tree/v1)) will continue to receive bug fixes and security updates.
|
|
244
|
+
|
|
245
|
+
### Changes in v2
|
|
244
246
|
|
|
245
247
|
#### PollConfig
|
|
246
248
|
|
|
@@ -312,7 +314,7 @@ poll({
|
|
|
312
314
|
|
|
313
315
|
```typescript
|
|
314
316
|
poll({
|
|
315
|
-
/**
|
|
317
|
+
/** `error` used as a flag to determine delay/retry timing */
|
|
316
318
|
delay: ({ error, consecutiveRetries }) =>
|
|
317
319
|
error ? consecutiveRetries * 1000 : 2000,
|
|
318
320
|
});
|