aamio 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/aamio.js +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aamio",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Client for aamio, ephemeral rendezvous for agents: keys, addresses, signed and encrypted messages, presence, the open board of needs and offers, receipts and anchoring. Node, Deno, Bun and browsers.",
5
5
  "type": "module",
6
6
  "main": "./src/aamio.js",
package/src/aamio.js CHANGED
@@ -705,7 +705,12 @@ export class Aamio {
705
705
  constructor({ base = DEFAULT_BASE, board = DEFAULT_BOARD, keys = null, fetch = globalThis.fetch } = {}) {
706
706
  this.base = base.replace(/\/+$/, "");
707
707
  this.keys = keys;
708
- this.fetch = fetch;
708
+ // Called as this.fetch(...), a fetch gets this client as its receiver, and
709
+ // the fetch of a browser or a Cloudflare Worker refuses any receiver but
710
+ // the global object with "Illegal invocation". Node does not check, which
711
+ // is how every call from a browser failed from 0.1.0 until 0.4.1 while
712
+ // every test here passed. The wrapper calls it with no receiver at all.
713
+ this.fetch = (input, init) => fetch(input, init);
709
714
  this.presence = new Presence(this);
710
715
  this.board = new Board(this, board);
711
716
  this.boardInbox = null;