@interncom/diplomatic 0.0.74 → 0.0.75
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 +2 -2
- package/dist/index.mjs +14 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import DiplomaticClient from "./client";
|
|
|
7
7
|
import libsodiumCrypto from "./crypto";
|
|
8
8
|
import { btoh, htob } from "./shared/lib";
|
|
9
9
|
import { type IOp, type IUpsertOp, Verb } from "./shared/types";
|
|
10
|
-
import useStateWatcher from "./react/useStateWatcher";
|
|
10
|
+
import useStateWatcher, { useStateWatcherSuspense } 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 { btoh, ClientStatusBar, DiplomaticClient, EntityDB, htob, idbStore, InitSeedView, libsodiumCrypto, localStorageStore, opMapApplier, StateManager, useClientState, useClientXferState, useStateWatcher, useSyncOnResume, Verb, };
|
|
14
|
+
export { btoh, ClientStatusBar, DiplomaticClient, EntityDB, htob, idbStore, InitSeedView, libsodiumCrypto, localStorageStore, opMapApplier, StateManager, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, Verb, };
|
|
15
15
|
export type { IDiplomaticClientState, IOp, IUpsertOp };
|
package/dist/index.mjs
CHANGED
|
@@ -11751,6 +11751,19 @@ function useStateWatcher(mgr, opType, callback) {
|
|
|
11751
11751
|
}, [mgr, opType, callback]);
|
|
11752
11752
|
return val;
|
|
11753
11753
|
}
|
|
11754
|
+
function useStateWatcherSuspense(mgr, opType, callback) {
|
|
11755
|
+
const promiseRef = useRef(callback());
|
|
11756
|
+
useEffect2(() => {
|
|
11757
|
+
async function update() {
|
|
11758
|
+
promiseRef.current = callback();
|
|
11759
|
+
}
|
|
11760
|
+
mgr.on(opType, update);
|
|
11761
|
+
return () => {
|
|
11762
|
+
mgr.off(opType, update);
|
|
11763
|
+
};
|
|
11764
|
+
}, [mgr, opType, callback]);
|
|
11765
|
+
return use(promiseRef.current);
|
|
11766
|
+
}
|
|
11754
11767
|
|
|
11755
11768
|
// src/react/initSeedView.tsx
|
|
11756
11769
|
import { useState as useState3, useCallback } from "react";
|
|
@@ -11914,6 +11927,7 @@ export {
|
|
|
11914
11927
|
useClientState,
|
|
11915
11928
|
useClientXferState,
|
|
11916
11929
|
useStateWatcher,
|
|
11930
|
+
useStateWatcherSuspense,
|
|
11917
11931
|
useSyncOnResume
|
|
11918
11932
|
};
|
|
11919
11933
|
/*! Bundled license information:
|