"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const live_env_1 = require("@ledgerhq/live-env");
function useEnv(type) {
    const [env, setEnv] = (0, react_1.useState)(() => (0, live_env_1.getEnv)(type));
    (0, react_1.useEffect)(() => {
        const sub = live_env_1.changes.subscribe(({ name, value }) => {
            if (type === name) {
                setEnv(value);
            }
        });
        return () => sub.unsubscribe();
    }, [type]);
    return env;
}
exports.default = useEnv;
//# sourceMappingURL=useEnv.js.map