@couch-kit/client 0.15.0 → 0.15.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @couch-kit/client
2
2
 
3
+ ## 0.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#208](https://github.com/faluciano/react-native-couch-kit/pull/208) [`f4b57e3`](https://github.com/faluciano/react-native-couch-kit/commit/f4b57e3fba385d18396781d22a413a1d8afcb909) Thanks [@faluciano](https://github.com/faluciano)! - `usePreload` counts an HTTP error response (a 404, say) as a failed asset. Before, any response that arrived counted as loaded, so a missing sound file came back as `loaded: true` with an empty `failedAssets`.
8
+ - Updated dependencies [[`99598d6`](https://github.com/faluciano/react-native-couch-kit/commit/99598d6796b0bd3042aa9f3fbd3bf44ee891b890)]:
9
+ - @couch-kit/core@0.10.1
10
+
3
11
  ## 0.15.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.js CHANGED
@@ -641,7 +641,11 @@ function usePreload(assets, sendMessage) {
641
641
  };
642
642
  img.src = src;
643
643
  } else {
644
- fetch(src).then(tick).catch(() => {
644
+ fetch(src).then((response) => {
645
+ if (!response.ok)
646
+ failed.push(src);
647
+ tick();
648
+ }).catch(() => {
645
649
  failed.push(src);
646
650
  tick();
647
651
  });
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAcD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EAAE,EAChB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAC9D,aAAa,CAkFf"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAcD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EAAE,EAChB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAC9D,aAAa,CAsFf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couch-kit/client",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -49,7 +49,7 @@
49
49
  "clean": "rm -rf dist lib"
50
50
  },
51
51
  "dependencies": {
52
- "@couch-kit/core": "0.10.0"
52
+ "@couch-kit/core": "0.10.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@happy-dom/global-registrator": "^20.10.6",
package/src/assets.ts CHANGED
@@ -100,7 +100,11 @@ export function usePreload(
100
100
  img.src = src;
101
101
  } else {
102
102
  fetch(src)
103
- .then(tick)
103
+ .then((response) => {
104
+ // fetch resolves on any HTTP response; a 404 is still a failure.
105
+ if (!response.ok) failed.push(src);
106
+ tick();
107
+ })
104
108
  .catch(() => {
105
109
  failed.push(src);
106
110
  tick();