UNPKG

@ledgerhq/live-common

Version:
24 lines 732 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useGlobalSyncState = void 0; 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; } exports.useGlobalSyncState = useGlobalSyncState; //# sourceMappingURL=useGlobalSyncState.js.map