@openshift-console/dynamic-plugin-sdk
Version:
Provides core APIs, types and utilities used by dynamic plugins at runtime.
24 lines (23 loc) • 586 B
JavaScript
let config;
/**
* Set the {@link UtilsConfig} reference.
*
* This must be done before using any of the Kubernetes utilities.
*/
export const setUtilsConfig = (c) => {
if (config !== undefined) {
throw new Error('setUtilsConfig has already been called');
}
config = Object.freeze({ ...c });
};
/**
* Get the {@link UtilsConfig} reference.
*
* Throws an error if the reference isn't already set.
*/
export const getUtilsConfig = () => {
if (config === undefined) {
throw new Error('setUtilsConfig has not been called');
}
return config;
};