@interncom/diplomatic 0.0.55 → 0.0.57
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 +4 -4
- package/dist/index.mjs +19 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useClientState, useSyncOnResume } from "./react/useClient";
|
|
2
|
-
import {
|
|
1
|
+
import { useClientState, useClientXferState, useSyncOnResume } from "./react/useClient";
|
|
2
|
+
import { opMapApplier, StateManager } from "./state";
|
|
3
3
|
import { localStorageStore } from "./localStorageStore";
|
|
4
4
|
import { idbStore } from "./idbStore";
|
|
5
5
|
import type { IDiplomaticClientState } from "./types";
|
|
@@ -11,5 +11,5 @@ import useStateWatcher from "./react/useStateWatcher";
|
|
|
11
11
|
import InitSeedView from "./react/initSeedView";
|
|
12
12
|
import ClientStatusBar from "./react/statusBar";
|
|
13
13
|
import * as EntityDB from "./entityDB";
|
|
14
|
-
export {
|
|
15
|
-
export type { IOp, IUpsertOp
|
|
14
|
+
export { btoh, ClientStatusBar, DiplomaticClient, EntityDB, htob, idbStore, InitSeedView, libsodiumCrypto, localStorageStore, opMapApplier, StateManager, useClientState, useClientXferState, useStateWatcher, useSyncOnResume, Verb, };
|
|
15
|
+
export type { IDiplomaticClientState, IOp, IUpsertOp };
|
package/dist/index.mjs
CHANGED
|
@@ -2496,6 +2496,21 @@ function useClientState(client) {
|
|
|
2496
2496
|
}, [client]);
|
|
2497
2497
|
return state;
|
|
2498
2498
|
}
|
|
2499
|
+
function useClientXferState(client) {
|
|
2500
|
+
const [state, setState] = useState();
|
|
2501
|
+
useEffect(() => {
|
|
2502
|
+
async function updateState() {
|
|
2503
|
+
const state2 = await client.getXferState();
|
|
2504
|
+
setState(state2);
|
|
2505
|
+
}
|
|
2506
|
+
client.xferListener = updateState;
|
|
2507
|
+
updateState();
|
|
2508
|
+
return () => {
|
|
2509
|
+
client.xferListener = void 0;
|
|
2510
|
+
};
|
|
2511
|
+
}, [client]);
|
|
2512
|
+
return state;
|
|
2513
|
+
}
|
|
2499
2514
|
function useSyncOnResume(client) {
|
|
2500
2515
|
useEffect(() => {
|
|
2501
2516
|
async function handleOnline() {
|
|
@@ -11424,6 +11439,7 @@ var DiplomaticClient = class {
|
|
|
11424
11439
|
await this.store.setSeed(bytes);
|
|
11425
11440
|
}
|
|
11426
11441
|
await this.loadSeed();
|
|
11442
|
+
this.emitUpdate();
|
|
11427
11443
|
if (params.hostID && params.hostURL) {
|
|
11428
11444
|
await this.store.setHostID(params.hostID);
|
|
11429
11445
|
await this.store.setHostURL(params.hostURL);
|
|
@@ -11432,11 +11448,12 @@ var DiplomaticClient = class {
|
|
|
11432
11448
|
} else {
|
|
11433
11449
|
await this.loadHost();
|
|
11434
11450
|
}
|
|
11451
|
+
this.emitUpdate();
|
|
11435
11452
|
if (this.hostURL) {
|
|
11436
11453
|
await this.connect(this.hostURL);
|
|
11454
|
+
this.emitUpdate();
|
|
11437
11455
|
}
|
|
11438
11456
|
await this.sync();
|
|
11439
|
-
this.emitUpdate();
|
|
11440
11457
|
this.emitXferUpdate();
|
|
11441
11458
|
}
|
|
11442
11459
|
async loadSeed() {
|
|
@@ -11829,6 +11846,7 @@ export {
|
|
|
11829
11846
|
localStorageStore,
|
|
11830
11847
|
opMapApplier,
|
|
11831
11848
|
useClientState,
|
|
11849
|
+
useClientXferState,
|
|
11832
11850
|
useStateWatcher,
|
|
11833
11851
|
useSyncOnResume
|
|
11834
11852
|
};
|