UNPKG

@embrace-io/react-native

Version:
21 lines (20 loc) 767 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useEmbraceIsStarted = void 0; const react_1 = require("react"); const EmbraceManagerModule_1 = require("../EmbraceManagerModule"); const useEmbraceIsStarted = () => { // `null` signifies we haven't yet queried the SDK to determine if it is started or not const [isStarted, setIsStarted] = (0, react_1.useState)(null); (0, react_1.useEffect)(() => { EmbraceManagerModule_1.EmbraceManagerModule.isStarted() .then((isEmbraceStarted) => { setIsStarted(isEmbraceStarted); }) .catch(() => { setIsStarted(false); }); }, []); return isStarted; }; exports.useEmbraceIsStarted = useEmbraceIsStarted;