@spoosh/plugin-prefetch 0.1.0-beta.0 → 0.1.2

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 CHANGED
@@ -13,11 +13,18 @@ npm install @spoosh/plugin-prefetch
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
+ import { Spoosh } from "@spoosh/core";
17
+ import { createReactSpoosh } from "@spoosh/react";
16
18
  import { prefetchPlugin } from "@spoosh/plugin-prefetch";
19
+ import { cachePlugin } from "@spoosh/plugin-cache";
20
+ import { retryPlugin } from "@spoosh/plugin-retry";
17
21
 
18
22
  // Setup - prefetch is returned from createReactSpoosh
19
- const plugins = [prefetchPlugin(), cachePlugin(), retryPlugin()];
20
- const spoosh = createSpoosh<ApiSchema, Error, typeof plugins>({ baseUrl: "/api", plugins });
23
+ const spoosh = new Spoosh<ApiSchema, Error>("/api").use([
24
+ prefetchPlugin(),
25
+ cachePlugin(),
26
+ retryPlugin(),
27
+ ]);
21
28
  const { useRead, useWrite, prefetch } = createReactSpoosh(spoosh);
22
29
 
23
30
  // Basic prefetch
package/dist/index.d.mts CHANGED
@@ -39,9 +39,17 @@ declare module "@spoosh/core" {
39
39
  *
40
40
  * @example
41
41
  * ```ts
42
- * // Setup
43
- * const plugins = [prefetchPlugin(), cachePlugin(), retryPlugin()];
44
- * const { prefetch } = createReactSpoosh(spoosh);
42
+ * import { Spoosh } from "@spoosh/core";
43
+ *
44
+ * const client = new Spoosh<ApiSchema, Error>("/api")
45
+ * .use([
46
+ * // ... other plugins
47
+ * prefetchPlugin(),
48
+ * cachePlugin(),
49
+ * retryPlugin(),
50
+ * ]);
51
+ *
52
+ * const { prefetch } = createReactSpoosh(client);
45
53
  *
46
54
  * // Basic prefetch
47
55
  * await prefetch((api) => api.posts.$get());
package/dist/index.d.ts CHANGED
@@ -39,9 +39,17 @@ declare module "@spoosh/core" {
39
39
  *
40
40
  * @example
41
41
  * ```ts
42
- * // Setup
43
- * const plugins = [prefetchPlugin(), cachePlugin(), retryPlugin()];
44
- * const { prefetch } = createReactSpoosh(spoosh);
42
+ * import { Spoosh } from "@spoosh/core";
43
+ *
44
+ * const client = new Spoosh<ApiSchema, Error>("/api")
45
+ * .use([
46
+ * // ... other plugins
47
+ * prefetchPlugin(),
48
+ * cachePlugin(),
49
+ * retryPlugin(),
50
+ * ]);
51
+ *
52
+ * const { prefetch } = createReactSpoosh(client);
45
53
  *
46
54
  * // Basic prefetch
47
55
  * await prefetch((api) => api.posts.$get());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-prefetch",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.2",
4
4
  "description": "Prefetch plugin for Spoosh - preload data before it's needed",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@spoosh/core": ">=0.1.0"
36
+ "@spoosh/core": ">=0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.1.0-beta.0",
40
- "@spoosh/test-utils": "0.1.0-beta.0"
39
+ "@spoosh/core": "0.3.0",
40
+ "@spoosh/test-utils": "0.1.3"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",