@interncom/diplomatic 0.0.21 → 0.0.23

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/client.d.ts CHANGED
@@ -18,7 +18,7 @@ export default class DiplomaticClient {
18
18
  hostKeyPair?: KeyPair;
19
19
  lastFetchedAt?: string;
20
20
  constructor(params: IDiplomaticClientParams);
21
- wipe(): Promise<void>;
21
+ wipe: () => Promise<void>;
22
22
  websocket?: WebSocket;
23
23
  connect: (hostURL: URL) => Promise<void>;
24
24
  init(params: IDiplomaticClientParams): Promise<void>;
package/dist/index.mjs CHANGED
@@ -8788,7 +8788,7 @@ var DiplomaticClient = class {
8788
8788
  this.applier = params.stateManager.apply;
8789
8789
  this.init(params);
8790
8790
  }
8791
- async wipe() {
8791
+ wipe = async () => {
8792
8792
  this.seed = void 0;
8793
8793
  this.encKey = void 0;
8794
8794
  this.hostURL = void 0;
@@ -8798,7 +8798,7 @@ var DiplomaticClient = class {
8798
8798
  this.websocket = void 0;
8799
8799
  await this.store.wipe();
8800
8800
  this.emitUpdate();
8801
- }
8801
+ };
8802
8802
  websocket;
8803
8803
  connect = async (hostURL) => {
8804
8804
  if (!this.hostKeyPair) {
@@ -8819,8 +8819,10 @@ var DiplomaticClient = class {
8819
8819
  };
8820
8820
  this.websocket.onclose = (e) => {
8821
8821
  console.log("DISCONNECTED");
8822
- this.connect(hostURL);
8823
- this.emitUpdate();
8822
+ if (navigator.onLine) {
8823
+ this.connect(hostURL);
8824
+ this.emitUpdate();
8825
+ }
8824
8826
  };
8825
8827
  this.websocket.onmessage = (e) => {
8826
8828
  console.log(`RECEIVED: ${e.data}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",