let activeCustomView: null | { id: number; params: Record<string, any> } = null;
|
let customViewId = 0;
|
|
function activateCustomViewParams(params: Record<string, any>) {
|
const id = ++customViewId;
|
activeCustomView = { id, params };
|
return id;
|
}
|
|
function clearCustomViewParams(id: number) {
|
if (activeCustomView?.id === id) activeCustomView = null;
|
}
|
|
function getCustomViewParam(paramName: string) {
|
if (!paramName || !activeCustomView) return undefined;
|
return activeCustomView.params[paramName];
|
}
|
|
export { activateCustomViewParams, clearCustomViewParams, getCustomViewParam };
|