From 377520e47d6ae7ea7de61d9ace0d25456700ef1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Wed, 4 Sep 2024 18:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildProfile.ets | 4 ++-- Index.ets | 4 ++++ src/main/ets/ContextConfig.ets | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/main/ets/ContextConfig.ets diff --git a/BuildProfile.ets b/BuildProfile.ets index e11789b..dd6e96c 100644 --- a/BuildProfile.ets +++ b/BuildProfile.ets @@ -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'; /** diff --git a/Index.ets b/Index.ets index 629f66d..bfda226 100644 --- a/Index.ets +++ b/Index.ets @@ -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' diff --git a/src/main/ets/ContextConfig.ets b/src/main/ets/ContextConfig.ets new file mode 100644 index 0000000..922646a --- /dev/null +++ b/src/main/ets/ContextConfig.ets @@ -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; + } +} +