From ab7576136defcd00362cbcfaee409030185c8169 Mon Sep 17 00:00:00 2001 From: tang jie Date: Mon, 26 May 2025 11:09:10 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E9=9C=80=E6=B1=82]:=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BB=A3=E7=A0=81=E6=8C=87=E5=8D=97=20Issues:=20https?= =?UTF-8?q?://gitee.com/openharmony/applications=5Fapp=5Fsamples/issues/IC?= =?UTF-8?q?A5YK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tang jie --- .../entry/src/main/ets/pages/Index.ets | 17 +++++++++++++++++ .../ArkTSModule/DynamicImport/har1/Index.ets | 1 + .../har1/src/main/ets/utils/Calc.ets | 1 + .../ArkTSModule/DynamicImport/har2/Index.ets | 1 + .../har2/src/main/ets/utils/Calc.ets | 1 + .../DynamicImport/harlibrary/Index.ets | 1 + .../harlibrary/src/main/ets/utils/Calc.ets | 1 + .../entry/build-profile.json5 | 1 + .../entry/oh-package.json5 | 1 + .../src/main/cpp/types/libentry/index.d.ts | 1 + .../entry/src/main/ets/pages/Index.ets | 2 ++ .../LazyImportChangeExecutionOrder/module.ets | 1 + .../moduleUseGlobalVar.ets | 1 + .../main/ets/pages/ModifyGlobalObject/main.ets | 1 + .../ets/pages/ModifyGlobalObject/module.ets | 1 + .../ModifyGlobalObject/moduleUseGlobalVar.ets | 1 + .../ModifyGlobalObject/sideEffectModule.ets | 1 + .../ModifyTheApplicationLevelArkUI/Index.ets | 1 + .../ModifyTheApplicationLevelArkUI/module.ets | 1 + .../ets/pages/ModifyingGlobalVariables/a.ets | 1 + .../ets/pages/ModifyingGlobalVariables/b.ets | 1 + .../ets/pages/ModifyingGlobalVariables/main.ets | 1 + .../ModifyingGlobalVariables/modifyPrototype.ts | 1 + .../main/ets/pages/TopCodeModification/main.ets | 1 + .../ets/pages/TopCodeModification/module.ets | 1 + 25 files changed, 42 insertions(+) diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Index.ets index 1ba61845df..cb46e0b6ae 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Index.ets @@ -87,6 +87,7 @@ struct Index { calc1[methodName](14, 15); // 调用成员函数instanceAdd() ns[functionName](16, 17); // 调用全局方法addHarlibrary() }) + // [End dynamic_load_har_module_reflect_call] } else if (item === resourceToString($r('app.string.dynamic_import_HAR_name'))) { // [Start const_dynamic_import_har_name] @@ -94,6 +95,7 @@ struct Index { import('myhar').then((ns: ESObject) => { console.info(ns.add(3, 5)); }) + // [End const_dynamic_import_har_name] } else if (item === resourceToString($r('app.string.dynamic_import_HAR_path'))) { // [Start const_dynamic_import_har_path] @@ -101,6 +103,7 @@ struct Index { import('myhar/Index').then((ns: ESObject) => { console.info(ns.add(3, 5)); }); + // [End const_dynamic_import_har_path] } else if (item === resourceToString($r('app.string.dynamic_import_HSP_name'))) { // [Start const_dynamic_import_hsp_name] @@ -122,6 +125,7 @@ struct Index { import('@ohos/crypto-js').then((ns: ESObject) => { console.info('DynamicImport @ohos/crypto-js: ' + ns.CryptoJS.src); }); + // [End const_dynamic_import_crypto] } else if (item === resourceToString($r('app.string.dynamic_import_ohpm'))) { // [Start const_dynamic_import_ohpm] @@ -129,6 +133,7 @@ struct Index { import('@ohos/hypium').then((ns: ESObject) => { console.info('DynamicImport @ohos/hypium: ', ns.TestType.FUNCTION.toString()); }); + // [End const_dynamic_import_ohpm] } else if (item === resourceToString($r('app.string.dynamic_import_file'))) { // [Start hap_const_dynamic_import] @@ -136,6 +141,7 @@ struct Index { import('../Calc').then((ns: ESObject) => { console.info(ns.add(3, 5)); }) + // [End hap_const_dynamic_import] } else if (item === resourceToString($r('app.string.dynamic_import_native'))) { // [Start hap_const_dynamic_import_native_index] @@ -143,6 +149,7 @@ struct Index { import('libentry.so').then((ns: ESObject) => { console.info('DynamicImport libnativeapi.so: ' + ns.default.add(2, 3)); }); + // [End hap_const_dynamic_import_native_index] } else if (item === resourceToString($r('app.string.dynamic_import_system_app'))) { // [Start hap_const_dynamic_import_api] @@ -166,6 +173,7 @@ struct Index { ns.default.info(0x0000, 'testTag', '%{public}s', 'DynamicImport @ohos.hilog.'); hilog.info(0x000, 'testTag', '%{public}s', ns.default.LogLevel.DEBUG); }); + // [End hap_const_dynamic_import_api] } else if (item === resourceToString($r('app.string.dynamic_import_module_myhar'))) { // [Start variable_dynamic_import] @@ -182,6 +190,7 @@ struct Index { import(filePath).then((ns: ESObject) => { console.info(ns.add(3, 5)); }); + // [End variable_dynamic_import] } else if (item === resourceToString($r('app.string.dynamic_import_HAR_name_variable'))) { // [Start hap_variable_dynamic_import_har] @@ -190,6 +199,7 @@ struct Index { import(harPackageName).then((ns: ESObject) => { console.info(ns.add(3, 5)); }); + // [End hap_variable_dynamic_import_har] } else if (item === resourceToString($r('app.string.dynamic_import_HSP_name_variable'))) { // [Start hap_variable_dynamic_import_hsp] @@ -198,6 +208,7 @@ struct Index { import(hspPackageName).then((ns: ESObject) => { console.info(ns.add(3, 5)); }); + // [End hap_variable_dynamic_import_hsp] } else if (item === resourceToString($r('app.string.dynamic_import_remote_HAR_name_variable'))) { // [Start hap_variable_dynamic_import_har_crypto] @@ -206,6 +217,7 @@ struct Index { import(remoteHarPackageName).then((ns: ESObject) => { console.info('DynamicImport @ohos/crypto-js: ' + ns.CryptoJS.src); }); + // [End hap_variable_dynamic_import_har_crypto] } else if (item === resourceToString($r('app.string.dynamic_import_ohpm_variable'))) { // [Start hap_variable_dynamic_import_ohpm] @@ -214,6 +226,7 @@ struct Index { import(ohpmPackageName).then((ns: ESObject) => { console.info('DynamicImport @ohos/hypium: ', ns.TestType.FUNCTION.toString()); }); + // [End hap_variable_dynamic_import_ohpm] } else if (item === resourceToString($r('app.string.dynamic_import_file_variable'))) { // [Start hap_variable_dynamic_import_calc] @@ -222,6 +235,7 @@ struct Index { import(calcFilePath).then((ns: ESObject) => { console.info(ns.add(3, 5)); }); + // [End hap_variable_dynamic_import_calc] } else if (item === resourceToString($r('app.string.dynamic_import_native_variable'))) { // [Start hap_variable_dynamic_import_native] @@ -230,6 +244,7 @@ struct Index { import(soName).then((ns: ESObject) => { console.info('DynamicImport libnativeapi.so: ' + ns.default.add(2, 3)); }); + // [End hap_variable_dynamic_import_native] } else if (item === resourceToString($r('app.string.dynamic_import_system_app_variable'))) { // [Start hap_variable_dynamic_import_api] @@ -256,6 +271,7 @@ struct Index { import(packageName).then((ns: ESObject) => { ns.default.info(0x0000, 'testTag', '%{public}s', 'DynamicImport @ohos.hilog.'); }) + // [End hap_variable_dynamic_import_api] } else if (item === resourceToString($r('app.string.dynamic_import_HAR'))) { // [Start hap_variable_dynamic_import_har1] @@ -263,6 +279,7 @@ struct Index { import(harName).then((ns: ESObject) => { console.info('DynamicImport addHar1 4 + 5 = ' + ns.addHar1(4, 5)); }); + // [End hap_variable_dynamic_import_har1] } }) diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets index e0345cb61d..bcf01c6aa7 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets @@ -17,4 +17,5 @@ export { MainPage } from './src/main/ets/components/MainPage'; // [Start export_add_har1] export { addHar1 } from './src/main/ets/utils/Calc'; + // [End export_add_har1] diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets index 7cc5071259..88fba4e438 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets @@ -24,4 +24,5 @@ export function addHar1(a: number, b: number): number { }); return c; } + // [End function_add_har1] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets index 248cad021d..baa09be019 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets @@ -17,4 +17,5 @@ export { MainPage } from './src/main/ets/components/MainPage'; // [Start export_add_har2] export { addHar2 } from './src/main/ets/utils/Calc' + // [End export_add_har2] diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/src/main/ets/utils/Calc.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/src/main/ets/utils/Calc.ets index 13cc0fe20a..e607390d00 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/src/main/ets/utils/Calc.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/har2/src/main/ets/utils/Calc.ets @@ -19,4 +19,5 @@ export function addHar2(a: number, b: number): number { console.info('DynamicImport I am har2, %d + %d = %d', a, b, c); return c; } + // [End function_add_har2] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/Index.ets index ce8819144b..b289115fc6 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/Index.ets @@ -17,4 +17,5 @@ export { MainPage } from './src/main/ets/components/MainPage' // [Start module_members_export] export { Calc, addHarlibrary } from './src/main/ets/utils/Calc' + // [End module_members_export] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/src/main/ets/utils/Calc.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/src/main/ets/utils/Calc.ets index 022d3ccd82..f3896e4bc4 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/src/main/ets/utils/Calc.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/DynamicImport/harlibrary/src/main/ets/utils/Calc.ets @@ -33,4 +33,5 @@ export function addHarlibrary(a: number, b: number): number { console.info('DynamicImport I am harlibrary in addHarlibrary, %d + %d = %d', a, b, c); return c; } + // [End dynamic_call_add] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/build-profile.json5 b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/build-profile.json5 index 472a926042..f8333da5e2 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/build-profile.json5 +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/build-profile.json5 @@ -37,6 +37,7 @@ }, // [EndExclude hap_load_native_dependence_01] }, + // [End hap_load_native_dependence_01] "buildOptionSet": [ { diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/oh-package.json5 b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/oh-package.json5 index d11c699914..53dac59ce5 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/oh-package.json5 +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/oh-package.json5 @@ -24,5 +24,6 @@ "dependencies": { "libentry.so": "file:./src/main/cpp/types/libentry" }, + // [End hap_load_native_dependence] } \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/cpp/types/libentry/index.d.ts b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/cpp/types/libentry/index.d.ts index 0069b64ba2..39eb6d9fb8 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/cpp/types/libentry/index.d.ts +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/cpp/types/libentry/index.d.ts @@ -15,4 +15,5 @@ // [Start hap_load_native] export const add: (a: number, b: number) => number; + // [End hap_load_native] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/ets/pages/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/ets/pages/Index.ets index 169d519a7c..5b522f8d90 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/JsApisLoadNativeModule/entry/src/main/ets/pages/Index.ets @@ -28,6 +28,7 @@ struct Index { //HAP加载系统库模块 let hilog: ESObject = loadNativeModule('@ohos.hilog'); hilog.info(0, 'testTag', 'loadNativeModule ohos.hilog success'); + // [End hap_load_system_module] this.message = 'loadNativeModule ohos.hilog success' }) @@ -40,6 +41,7 @@ struct Index { //HAP加载Native库 let module: ESObject = loadNativeModule('libentry.so'); let sum: number = module.add(1, 2); + // [End load_native_module_libentry] this.message = 'loadNativeModule libentry.so success result: ' + sum.toString(); }) diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/module.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/module.ets index 77afe81b29..e817c4237b 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/module.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/module.ets @@ -17,4 +17,5 @@ export let data = 'data from module'; globalThis.someGlobalVar = 100; + // [End import_global_module_data] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/moduleUseGlobalVar.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/moduleUseGlobalVar.ets index a3b18a7ad8..f4278f3d0d 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/moduleUseGlobalVar.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/LazyImportChangeExecutionOrder/moduleUseGlobalVar.ets @@ -35,6 +35,7 @@ struct moduleUseGlobalVar { this.message1 = 'SideEffect: ' + globalThis.someGlobalVar; console.log(data); // 使用到module模块的变量,此时module模块执行,someGlobalVar的值变为100 }) + // [EndExclude lazy_import_global_module_data] Divider() .vertical(true) diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets index e000c0c023..58e5c6ce4a 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets @@ -25,6 +25,7 @@ function maybeNotCalledAtAll() { console.log(data1); console.log(data2); } + // [End import_change_global_var] function maybeNotCalledAtAllOptimize() { diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/module.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/module.ets index 78c9caab64..ee4303ddc6 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/module.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/module.ets @@ -17,4 +17,5 @@ export let data1 = 'data from module'; globalThis.someGlobalVar = 100; // 改变了全局状态 + // [End export_change_global_data_100] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets index 91c18c7516..052eb7b9d9 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets @@ -20,4 +20,5 @@ export function useGlobalVar() { console.log(data1); console.log(globalThis.someGlobalVar); // 此时由于main.ets中加载了sideEffectModule模块,someGlobalVar的值已经被改为200 } + // [End export_change_some_global_var] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets index 1f401a0dfd..6ebd10c608 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets @@ -17,4 +17,5 @@ export let data2 = 'data from side effect module'; globalThis.someGlobalVar = 200; // 也变了全局状态 + // [End export_change_global_data_200] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/Index.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/Index.ets index bd12a8a0a2..1fdf6ac524 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/Index.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/Index.ets @@ -60,6 +60,7 @@ struct Index { function maybeNotCalledAtAll() { console.log(data); } + // [End set_app_storage_var_200] function maybeNotCalledAtAllOptimize() { diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/module.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/module.ets index 8d84ffea49..221498215a 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/module.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/module.ets @@ -17,4 +17,5 @@ export let data = 'data from module'; AppStorage.setOrCreate('SomeAppStorageVar1', 200); // 修改应用全局的UI状态 + // [End set_app_storage_var] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/a.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/a.ets index 2d5fc12b08..732e3dbf47 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/a.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/a.ets @@ -19,4 +19,5 @@ import { b } from './b'; console.log('Module A: ', b); export const a = 'A'; + // [End module_cycle_dependence_a] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/b.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/b.ets index 106641288a..646246d940 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/b.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/b.ets @@ -19,4 +19,5 @@ import { a } from './a'; console.log('Module B: ', a); export const b = 'B'; + // [End module_cycle_dependence_b] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/main.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/main.ets index 5a06290dd9..4238ef7c17 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/main.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/main.ets @@ -72,4 +72,5 @@ struct main { .width('100%') } } + // [End call_modify_array_prototype_include] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/modifyPrototype.ts b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/modifyPrototype.ts index e67a973072..0b48732dd9 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/modifyPrototype.ts +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyingGlobalVariables/modifyPrototype.ts @@ -19,4 +19,5 @@ export let data = 'data from modifyPrototype'; Array.prototype.includes = function (value) { return this.indexOf(value) == -1; }; + // [End array_prototype_include] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/main.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/main.ets index d327b4e0df..1e13d770a5 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/main.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/main.ets @@ -17,6 +17,7 @@ import { data } from './topCodeModule'; // 导入时,module.ets中的console.log会执行,产生输出。 import { dataOptimizeOne } from './topCodeModuleOptimize'; import { dataOptimizeTwo } from './module'; + // [End import_put_console_log] @Entry diff --git a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets index d83291a974..9ae49e4861 100755 --- a/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets +++ b/code/DocsSample/ArkTs/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets @@ -17,6 +17,7 @@ export function initialize() { console.log('Module loaded!'); } + // [End module_load_directly] // [Start module_load_optimize] -- Gitee