@interncom/diplomatic 0.0.17 → 0.0.19

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
@@ -26,6 +26,7 @@ export default class DiplomaticClient {
26
26
  setSeed(seed: Uint8Array): Promise<void>;
27
27
  loadHost(): Promise<void>;
28
28
  register(hostURL: string): Promise<void>;
29
+ registerAndConnect(hostURL: string): Promise<void>;
29
30
  emitUpdate(): Promise<void>;
30
31
  getState(): Promise<IDiplomaticClientState>;
31
32
  processOps(): Promise<void>;
package/dist/index.mjs CHANGED
@@ -16,17 +16,12 @@ function useClientState(client) {
16
16
  const [state, setState] = useState();
17
17
  useEffect(() => {
18
18
  async function updateState() {
19
- console.log("updating");
20
19
  const state2 = await client.getState();
21
- console.log("updated", state2);
22
20
  setState(state2);
23
- console.log("updated and set state");
24
21
  }
25
- console.log("hooking");
26
22
  client.listener = updateState;
27
23
  updateState();
28
24
  return () => {
29
- console.log("unhooking");
30
25
  client.listener = void 0;
31
26
  };
32
27
  }, [client]);
@@ -8894,6 +8889,11 @@ var DiplomaticClient = class {
8894
8889
  await this.store.setHostID(hostID);
8895
8890
  this.emitUpdate();
8896
8891
  }
8892
+ async registerAndConnect(hostURL) {
8893
+ await this.register(hostURL);
8894
+ await this.connect(new URL(hostURL));
8895
+ await this.sync();
8896
+ }
8897
8897
  async emitUpdate() {
8898
8898
  const state = await this.getState();
8899
8899
  this.listener?.(state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",