全局context

这个提交包含在:
徐勤民 2024-09-04 18:19:18 +08:00
父节点 e290ee7547
当前提交 377520e47d
共有 3 个文件被更改,包括 26 次插入2 次删除

查看文件

@ -2,8 +2,8 @@
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.1';
export const BUILD_MODE_NAME = 'release';
export const DEBUG = false;
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const TARGET_NAME = 'default';
/**

查看文件

@ -43,3 +43,7 @@ export { WindowHelper } from './src/main/ets/utils/WindowHelper'
* 自定义view
*/
export { LoadingView } from './src/main/ets/view/LoadingView'
/**
* 自定义view
*/
export { GlobalContext } from './src/main/ets/ContextConfig'

查看文件

@ -0,0 +1,20 @@
/*
* 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;
};
export class GlobalContext {
static getContext(): common.UIAbilityContext {
return globalThis._brushEngineContext;
}
static setContext(context: common.UIAbilityContext): void {
globalThis._brushEngineContext = context;
}
}