@automerge/automerge-repo-network-broadcastchannel 1.0.1 → 1.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/dist/index.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * A `NetworkAdapter` which uses [BroadcastChannel](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel)
4
+ * to communicate with other peers in the same browser tab. This is a bit of a
5
+ * hack because `NetworkAdapter`s are supposed to be used as point to
6
+ * point communication channels. To get around this the {@link BroadcastChannelNetworkAdapter}
7
+ * broadcasts messages to all peers and then filters out messages not intended
8
+ * for the current peer. This is quite inefficient as messages get duplicated
9
+ * for every peer in the tab, but as it's all local communication anyway
10
+ * it's not too bad. If efficiency is becoming an issue you can switch to
11
+ * `automerge-repo-network-messagechannel`.
12
+ *
13
+ * @module
14
+ *
15
+ */
1
16
  import { NetworkAdapter, PeerId, Message } from "@automerge/automerge-repo";
2
17
  export type BroadcastChannelNetworkAdapterOptions = {
3
18
  channelName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,MAAM,EACN,OAAO,EACR,MAAM,2BAA2B,CAAA;AAElC,MAAM,MAAM,qCAAqC,GAAG;IAClD,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,qBAAa,8BAA+B,SAAQ,cAAc;;gBAKpD,OAAO,CAAC,EAAE,qCAAqC;IAK3D,OAAO,CAAC,MAAM,EAAE,MAAM;IAoDtB,IAAI,CAAC,OAAO,EAAE,OAAO;IAcrB,UAAU;CAIX"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,cAAc,EACd,MAAM,EACN,OAAO,EACR,MAAM,2BAA2B,CAAA;AAGlC,MAAM,MAAM,qCAAqC,GAAG;IAClD,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,qBAAa,8BAA+B,SAAQ,cAAc;;gBAKpD,OAAO,CAAC,EAAE,qCAAqC;IAK3D,OAAO,CAAC,MAAM,EAAE,MAAM;IAoDtB,IAAI,CAAC,OAAO,EAAE,OAAO;IAcrB,UAAU;CAIX"}
package/dist/index.js CHANGED
@@ -1,3 +1,18 @@
1
+ /**
2
+ *
3
+ * A `NetworkAdapter` which uses [BroadcastChannel](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel)
4
+ * to communicate with other peers in the same browser tab. This is a bit of a
5
+ * hack because `NetworkAdapter`s are supposed to be used as point to
6
+ * point communication channels. To get around this the {@link BroadcastChannelNetworkAdapter}
7
+ * broadcasts messages to all peers and then filters out messages not intended
8
+ * for the current peer. This is quite inefficient as messages get duplicated
9
+ * for every peer in the tab, but as it's all local communication anyway
10
+ * it's not too bad. If efficiency is becoming an issue you can switch to
11
+ * `automerge-repo-network-messagechannel`.
12
+ *
13
+ * @module
14
+ *
15
+ */
1
16
  import { NetworkAdapter, } from "@automerge/automerge-repo";
2
17
  export class BroadcastChannelNetworkAdapter extends NetworkAdapter {
3
18
  #broadcastChannel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automerge/automerge-repo-network-broadcastchannel",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "BroadcastChannel network adapter for Automerge Repo",
5
5
  "repository": "https://github.com/automerge/automerge-repo",
6
6
  "author": "Peter van Hardenberg <pvh@pvh.ca>",
@@ -17,7 +17,7 @@
17
17
  "@automerge/automerge": "^2.1.0"
18
18
  },
19
19
  "dependencies": {
20
- "@automerge/automerge-repo": "^1.0.1"
20
+ "@automerge/automerge-repo": "^1.0.3"
21
21
  },
22
22
  "watch": {
23
23
  "build": {
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "9c1eb5fb161eac78a71a6e866b30879994278d22"
33
+ "gitHead": "4f3391cd33cd0cabfebde48dbd56749ddb6922da"
34
34
  }
package/src/index.ts CHANGED
@@ -1,3 +1,19 @@
1
+ /**
2
+ *
3
+ * A `NetworkAdapter` which uses [BroadcastChannel](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel)
4
+ * to communicate with other peers in the same browser tab. This is a bit of a
5
+ * hack because `NetworkAdapter`s are supposed to be used as point to
6
+ * point communication channels. To get around this the {@link BroadcastChannelNetworkAdapter}
7
+ * broadcasts messages to all peers and then filters out messages not intended
8
+ * for the current peer. This is quite inefficient as messages get duplicated
9
+ * for every peer in the tab, but as it's all local communication anyway
10
+ * it's not too bad. If efficiency is becoming an issue you can switch to
11
+ * `automerge-repo-network-messagechannel`.
12
+ *
13
+ * @module
14
+ *
15
+ */
16
+
1
17
  import {
2
18
  NetworkAdapterMessage,
3
19
  NetworkAdapter,
@@ -5,6 +21,7 @@ import {
5
21
  Message,
6
22
  } from "@automerge/automerge-repo"
7
23
 
24
+
8
25
  export type BroadcastChannelNetworkAdapterOptions = {
9
26
  channelName: string
10
27
  }
package/typedoc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../typedoc.base.json",
3
+ "entryPoints": ["src/index.ts"],
4
+ "readme": "none"
5
+ }