刘光辉
10 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 };