徐勤民 7 mesiacov pred
rodič
commit
377520e47d
3 zmenil súbory, kde vykonal 26 pridanie a 2 odobranie
  1. 2 2
      BuildProfile.ets
  2. 4 0
      Index.ets
  3. 20 0
      src/main/ets/ContextConfig.ets

+ 2 - 2
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';
 
 /**

+ 4 - 0
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'

+ 20 - 0
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;
+  }
+}
+