HarmonyOSBaseLibs/src/main/ets/ContextConfig.ets
徐勤民 dbca937b2d refactor(app): 重构应用初始化和窗口处理逻辑
-调整 AppAbility 中的窗口创建和上下文设置逻辑
-优化 WindowHelper 类,增加对 UIContext 的处理
- 重构 ContextConfig 类,简化上下文设置方法
2025-08-26 15:29:45 +08:00

33 行
744 B
Plaintext

/*
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
*/
import type common from '@ohos.app.ability.common';
declare namespace globalThis {
let _brushEngineContext: common.UIAbilityContext;
let _uiUIContext: UIContext;
};
export class GlobalContext {
static getContext(): common.UIAbilityContext {
return globalThis._brushEngineContext;
}
static setContext(context: common.UIAbilityContext): void {
globalThis._brushEngineContext = context;
}
static getUiContext(): UIContext | undefined {
if (globalThis._uiUIContext === undefined) {
return undefined;
}
return globalThis._uiUIContext;
}
static setUiContext(u: UIContext) {
globalThis._uiUIContext = u;
}
}