import { useMemo } from "react";
import { isFunction } from "lodash";
import { useApp } from "./index.mjs";
const useGlobalVariable = (key)=>{
    const app = useApp();
    const variable = useMemo(()=>app.getGlobalVar(key), [
        app,
        key
    ]);
    if (isFunction(variable)) try {
        return variable();
    } catch (error) {
        console.error("Error calling global variable function for key: ".concat(key), error);
        return;
    }
    return variable;
};
export { useGlobalVariable };
