@spoosh/plugin-polling 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +2 -5
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -16,10 +16,7 @@ npm install @spoosh/plugin-polling
16
16
  import { Spoosh } from "@spoosh/core";
17
17
  import { pollingPlugin } from "@spoosh/plugin-polling";
18
18
 
19
- const client = new Spoosh<ApiSchema, Error>("/api")
20
- .use([
21
- pollingPlugin(),
22
- ]);
19
+ const client = new Spoosh<ApiSchema, Error>("/api").use([pollingPlugin()]);
23
20
 
24
21
  // Static polling interval (5 seconds)
25
22
  useRead((api) => api.posts.$get(), { pollingInterval: 5000 });
@@ -28,7 +25,7 @@ useRead((api) => api.posts.$get(), { pollingInterval: 5000 });
28
25
  useRead((api) => api.posts.$get(), { pollingInterval: false });
29
26
 
30
27
  // Dynamic polling interval based on data/error
31
- useRead((api) => api.booking[123].$get(), {
28
+ useRead((api) => api.booking(123).$get(), {
32
29
  pollingInterval: (data, error) => {
33
30
  if (error) return 10000; // Slower polling on error
34
31
  if (data?.status === "pending") return 1000; // Fast polling for pending
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-polling",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Automatic polling/refetching plugin for Spoosh",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/nxnom/spoosh/issues"
13
13
  },
14
- "homepage": "https://spoosh.dev/docs/plugins/polling",
14
+ "homepage": "https://spoosh.dev/react/docs/plugins/polling",
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
@@ -34,11 +34,11 @@
34
34
  }
35
35
  },
36
36
  "peerDependencies": {
37
- "@spoosh/core": ">=0.3.0"
37
+ "@spoosh/core": ">=0.4.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@spoosh/core": "0.3.0",
41
- "@spoosh/test-utils": "0.1.3"
40
+ "@spoosh/core": "0.4.2",
41
+ "@spoosh/test-utils": "0.1.5"
42
42
  },
43
43
  "scripts": {
44
44
  "dev": "tsup --watch",