@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
23 lines • 695 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useGlobalSyncState = useGlobalSyncState;
const react_1 = require("react");
const context_1 = require("./context");
function useGlobalSyncState() {
const syncState = (0, context_1.useBridgeSyncState)();
let pending = false;
let error = null;
for (const k in syncState) {
const s = syncState[k];
if (s.error)
error = s.error;
if (s.pending)
pending = true;
}
const globalState = (0, react_1.useMemo)(() => ({
pending,
error,
}), [pending, error]);
return globalState;
}
//# sourceMappingURL=useGlobalSyncState.js.map