diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/README.md index 8643222d9c0e7ccbcf21a9c9be546d9132048d16..b41daa2e69fb5da222ce196f9af43c8b169666ca 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/README.md @@ -24,13 +24,13 @@ ArkTS应用开发过程中,需要用到并发能力的业务场景很多,不 ### 效果预览 -| 首页 | 执行及结果即时反 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反 | +| :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面中,点击任意功能按钮可跳转至相应页面,随后点击界面显示的文本字符串即可触发程序执行。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -86,10 +86,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/NativeInterthreadShared/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/NativeInterthreadShared/README.md index 67f2e86e27a110793329ecbd146a4ce8b231337c..d4f0b5deeca427fba4809ac27a4cad99599b516f 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/NativeInterthreadShared/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/NativeInterthreadShared/README.md @@ -12,13 +12,13 @@ ### 效果预览 -| 首页 | 执行结果 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行结果 | +| :-------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,可以点击hello world,开始执行。 +1. 在主界面,可以点击Hello World,开始执行。 2. 执行结果会即时反馈在屏幕中央。 ### 工程目录 @@ -69,10 +69,10 @@ entry/src 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/NativeInterthreadShared > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/README.md index 5c89060bdaeb1c3591b8d424d7ddac65a1f14ef1..8eeeaf4e45bcd4353b5ab1c5a1f10c28582eee03 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/README.md @@ -20,7 +20,7 @@ #### ArkUI数据更新场景 -当需要网络下载或者本地生成的数据需要发送到UI线程进行展示时,因为ArkUI的标注和[@Sendable装饰器](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/arkts-utils/arkts-sendable.md#sendable装饰器)不能同时修饰变量和对象,所以对于此类场景,需要使用[makeObserved](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/quick-start/arkts-new-makeObserved.md)在ArkUI中导入可观察的Sendable共享数据。 +当需要网络下载或者本地生成的数据需要发送到UI线程进行展示时,因为ArkUI的标注和[@Sendable装饰器](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/arkts-utils/arkts-sendable.md#sendable装饰器)不能同时修饰变量和对象,所以对于此类场景,需要使用[makeObserved](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/ui/state-management/arkts-new-makeObserved.md)在ArkUI中导入可观察的Sendable共享数据。 #### ArkUI瀑布流渲染场景 @@ -36,13 +36,13 @@ ### 效果预览 -| 首页 | 执行及结果 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果 | +| :----------------------------------------------------------------: | :----------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面中,点击任意功能按钮可跳转至相应页面,随后点击界面显示的文本字符串即可触发程序执行或滑动页面(WaterFlow)。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -101,10 +101,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/ohosTest.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/ohosTest.md index 1f5d4346f509598a395848c9cf899ef953a0ffb9..744e54e2c2ab56abcdf4a5120a4d95e73a7927f9 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/ohosTest.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/ohosTest.md @@ -2,12 +2,12 @@ ## 用例表 -| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | -| -------------------------------- | ------------------------------------- | ------------------------------------------------------------ | ---------------------- | -------- | -------- | -| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | -| 使用TaskPool进行频繁数据库操作 | 位于UsingTaskPool.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 使用Sendable进行大容量数据库操作 | 位于UsingSendable.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 业务模块并发加载场景 | 位于ConcurrentLoadingModulesGuide.ets | 点击calculate add,show history,countdown | 1秒后页面显示“success” | 是 | Pass | -| 全局配置项功能场景 | 位于GlobalConfigurationGuide.ets | 点击change name,task | 1秒后页面显示“success” | 是 | Pass | -| ArkUI数据更新场景 | 位于MakeobservedSendable.ets | 滑动屏幕 | 瀑布流形式加载信息 | 是 | Pass | -| ArkUI瀑布流渲染场景 | 位于WaterfallRendering.ets | 点击wifi on,download,在输入框输入信息,点击login显示信息,点击not login清除信息 | 输入信息显示上方 | 是 | Pass | \ No newline at end of file +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| -------------------------------- | ------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------- | -------- | -------- | +| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | +| 使用TaskPool进行频繁数据库操作 | 位于UsingTaskPool.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 使用Sendable进行大容量数据库操作 | 位于UsingSendable.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 业务模块并发加载场景 | 位于ConcurrentLoadingModulesGuide.ets | 点击calculate add,show history,countdown | 1秒后页面显示“success” | 是 | Pass | +| 全局配置项功能场景 | 位于GlobalConfigurationGuide.ets | 点击wifi on,download,在输入框输入信息,点击login显示信息,点击not login清除信息 | 输入信息显示上方 | 是 | Pass | +| ArkUI数据更新场景 | 位于MakeobservedSendable.ets | 点击change name,task | 页面上方显示“TomO”、“TomO-o” | 是 | Pass | +| ArkUI瀑布流渲染场景 | 位于WaterfallRendering.ets | 滑动屏幕 | 瀑布流形式加载信息 | 是 | Pass | diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/README.md index 8e17cab11e26b306b384d81c2c2950802625b09e..30814f87f67b9601a4165583b49445c181c979f3 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/README.md @@ -10,13 +10,13 @@ Promise和async/await提供异步并发能力,是标准的JS异步语法。异 ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :--------------------------------------------------------------------------: | :--------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,可以点击hello world,开始执行。 +1. 在主界面,可以点击Hello World,开始执行。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -57,10 +57,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/AsyncConcurrencyOverview > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/CommunicationObjects/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/CommunicationObjects/README.md index d01e95dbbeb804f4a969036abbd6de53dce4771f..0616ca75b627ce19ce36019cd6a608b23e42d250 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/CommunicationObjects/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/CommunicationObjects/README.md @@ -27,13 +27,13 @@ Transferable对象(也称为NativeBinding对象)指的是一个JS对象, ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :-----------------------------------------------------------------------: | :-----------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面中,点击任意功能按钮可跳转至相应页面,随后点击界面显示的文本字符串即可触发程序执行。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -84,10 +84,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/CommunicationObjects > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/README.md index 13b3282247804dda7e5bb6536bda12a68224a1f3..aceceb3f2464ec8af5199cf7f676172fc9fd5d18 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/README.md @@ -6,13 +6,13 @@ ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :-----------------------------------------------------------------------: | :-----------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击Hello World执行程序 +1. 在主界面中,点击任意功能按钮可跳转至相应页面,随后点击界面显示的文本字符串即可触发程序执行。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -21,6 +21,7 @@ achievenon/src/ ├── main │ ├── ets + │ │ ├── achievenonability │ │ ├── pages │ │ ├── Index.ets // 非Sendable class只能实现非Sendable interface和Sendable装饰器修饰类型时仅支持修饰函数类型 │ ├── module.json5 @@ -32,6 +33,7 @@ achievenon/src/ arrowfunctions/src/ ├── main │ ├── ets + │ │ ├── arrowfunctionsability │ │ ├── pages │ │ ├── Index.ets // 箭头函数不支持共享 │ ├── module.json5 @@ -43,6 +45,7 @@ arrowfunctions/src/ cannotbeused/src/ ├── main │ ├── ets + │ │ ├── cannotbeusedability │ │ ├── pages │ │ ├── Index.ets // Sendable class和Sendable function不能使用除了@Sendable的其它装饰器 │ ├── module.json5 @@ -54,6 +57,7 @@ cannotbeused/src/ inheritedfromnon/src/ ├── main │ ├── ets + │ │ ├── inheritedfromnonability │ │ ├── pages │ │ ├── Index.ets // 非Sendable class只能继承自非Sendable class │ ├── module.json5 @@ -65,6 +69,8 @@ inheritedfromnon/src/ inheritonly/src/ ├── main │ ├── ets + │ │ ├── entryability + │ │ ├── entrybackupability │ │ ├── pages │ │ ├── Index.ets // Sendable class只能继承自Sendable class │ ├── module.json5 @@ -76,6 +82,7 @@ inheritonly/src/ nocalculationsupport/src/ ├── main │ ├── ets + │ │ ├── nocalculationsupportability │ │ ├── pages │ │ ├── Index.ets // Sendable class/interface的成员变量不支持使用计算属性名 │ ├── module.json5 @@ -87,6 +94,7 @@ nocalculationsupport/src/ notallowedInside/src/ ├── main │ ├── ets + │ │ ├── notallowedinsideability │ │ ├── pages │ │ ├── Index.ets // Sendable class的内部不允许使用当前模块内上下文环境中定义的变量 │ ├── module.json5 @@ -98,6 +106,7 @@ notallowedInside/src/ objectliterals/src/ ├── main │ ├── ets + │ │ ├── objectliteralsability │ │ ├── pages │ │ ├── Index.ets // 不能使用对象字面量/数组字面量初始化Sendable类型 │ ├── module.json5 @@ -109,6 +118,7 @@ objectliterals/src/ templatetype/src/ ├── main │ ├── ets + │ │ ├── templatetypeability │ │ ├── pages │ │ ├── Index.ets // 泛型类中的Sendable class,collections.Array/Map/Set的模板类型必须是Sendable类型 │ ├── module.json5 @@ -120,6 +130,7 @@ templatetype/src/ typecannot/src/ ├── main │ ├── ets + │ │ ├── typecannotability │ │ ├── pages │ │ ├── Index.ets // 非Sendable类型不可以as成Sendable类型 │ ├── module.json5 @@ -131,6 +142,7 @@ typecannot/src/ variablenotsupported/src/ ├── main │ ├── ets + │ │ ├── variablenotsupportedability │ │ ├── pages │ │ ├── Index.ets // Sendable class/interface的成员变量不支持使用!断言 │ ├── module.json5 @@ -142,6 +154,7 @@ variablenotsupported/src/ variablesupport/src/ ├── main │ ├── ets + │ │ ├── variablesupportability │ │ ├── pages │ │ ├── Index.ets // Sendable class/interface成员变量必须是Sendable支持的数据类型 │ ├── module.json5 @@ -172,10 +185,10 @@ variablesupport/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/background.png b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/background.png new file mode 100755 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/background.png differ diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/foreground.png b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/foreground.png new file mode 100755 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/foreground.png differ diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/layered_image.json b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/layered_image.json new file mode 100755 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/startIcon.png b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/startIcon.png new file mode 100755 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/nocalculationsupport/src/main/resources/base/media/startIcon.png differ diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/ohosTest.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/ohosTest.md index 6b863f0d7516afb5e09639875626a5562d68d5fe..dd763399e4359fd20e019b60cc74caa0da0341bd 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/ohosTest.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/RulesAndRestrictions/ohosTest.md @@ -2,19 +2,19 @@ ## 用例表 -| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | -| ------------------------------------------------------------ | ------------------------------------- | --------------- | ---------------------- | -------- | -------- | -| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | -| Sendable class只能继承自Sendable class | 位于InheritOnly模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 非Sendable class只能继承自非Sendable class | 位于InheritedFromNon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 非Sendable class只能实现非Sendable interface | 位于AchieveNon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable class/interface成员变量必须是Sendable支持的数据类型 | 位于VariableSupport模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable class/interface的成员变量不支持使用!断言 | 位于VariableNotSupported模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable class/interface的成员变量不支持使用计算属性名 | 位于NoCalculationSupport模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 泛型类中的Sendable class,collections.Array,collections.Map,collections.Set的模板类型必须是Sendable类型 | 位于TemplateType模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable class的内部不允许使用当前模块内上下文环境中定义的变量 | 位于NotAllowedInside模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable class和Sendable function不能使用除了@Sendable的其它装饰器 | 位于CannotBeUsed模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 不能使用对象字面量/数组字面量初始化Sendable类型 | 位于ObjectLiterals模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 非Sendable类型不可以as成Sendable类型 | 位于TypeCannot模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| 箭头函数不支持共享 | 位于ArrowFunctions模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | -| Sendable装饰器修饰类型时仅支持修饰函数类型 | 位于achievenon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | \ No newline at end of file +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------------- | ---------------------- | -------- | -------- | +| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | +| Sendable class只能继承自Sendable class | 位于inheritonly模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 非Sendable class只能继承自非Sendable class | 位于inheritedfromnon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 非Sendable class只能实现非Sendable interface | 位于achievenon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable class/interface成员变量必须是Sendable支持的数据类型 | 位于variablesupport模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable class/interface的成员变量不支持使用!断言 | 位于variablenotsupported模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable class/interface的成员变量不支持使用计算属性名 | 位于nocalculationsupport模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 泛型类中的Sendable class,collections.Array,collections.Map,collections.Set的模板类型必须是Sendable类型 | 位于templatetype模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable class的内部不允许使用当前模块内上下文环境中定义的变量 | 位于notallowedInside模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable class和Sendable function不能使用除了@Sendable的其它装饰器 | 位于cannotbeused模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 不能使用对象字面量/数组字面量初始化Sendable类型 | 位于objectliterals模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 非Sendable类型不可以as成Sendable类型 | 位于typecannot模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| 箭头函数不支持共享 | 位于arrowfunctions模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | +| Sendable装饰器修饰类型时仅支持修饰函数类型 | 位于achievenon模块Index.ets | 点击Hello World | 1秒后页面显示“success” | 是 | Pass | diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectIntroduction/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectIntroduction/README.md index 226690ade5ccc8391831e32b308ae91666928637..d9a747b93f521fc6bb2f76817977f1c9d1173087 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectIntroduction/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectIntroduction/README.md @@ -10,20 +10,23 @@ ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :-----------------------------------------------------------------------------: | :-----------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 ``` -class - ├── Index.ets // 装饰器修饰Class使用示例 +class/src/ + ├── main + │ ├── ets + │ │ ├── components + │ │ ├── MainPage.ets // 装饰器修饰Class使用示例 entry/src/ ├── main │ ├── ets @@ -65,10 +68,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectIntroduction > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/README.md index c779b9c44fd1938265c8880b3b7be5a691814235..4d5d87e0546ea306af664de65109b89846c7e7d1 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/README.md @@ -42,13 +42,13 @@ Sendable对象支持冻结操作,冻结后的对象变成只读对象,不能 ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :------------------------------------------------------------------------: | :------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -103,10 +103,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/README.md index e2db0e7115a0075f82e8ed4388a6809b7d2855c5..86051aa2b752ea388451ca47c08f7c592372bed1 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/README.md @@ -13,15 +13,15 @@ Sendable对象可以在不同并发实例间通过引用传递。通过引用传 ### 效果预览 -| bigdata模块 | crossconcurrency模块 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| bigdata模块 | crossconcurrency模块 | +| :--------------------------------------------------------------------: | :--------------------------------------------------------------------: | | | | ### 使用说明 -1. 运行bigdata模块,分别点击Listener task和Data processing task执行程序 +1. 运行bigdata模块,分别点击Listener task和Data processing task执行程序。 2. 执行结果会即时反馈在屏幕中,并在控制台打印log。 -3. 运行crossconcurrency模块,点击Hello World执行程序 +3. 运行crossconcurrency模块,点击Hello World执行程序。 4. 执行结果会即时反馈在屏幕中,并在控制台打印log。 ### 工程目录 @@ -76,10 +76,10 @@ bigdata/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationScenario/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationScenario/README.md index ee0366719508365cd23758019807c24b78391980..e218d89ad94433bbabb00ccf88f537feda949900 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationScenario/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationScenario/README.md @@ -34,13 +34,13 @@ ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :-----------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -95,10 +95,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationScenario > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/README.md index aa74a6fc4bcd12edca2418922539f2d9d7d22b5a..8694463d36a1be3017d8cf686ff78bb72976a8dc 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/README.md @@ -10,13 +10,13 @@ ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :-----------------------------------------------------------------------: | :-----------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -66,10 +66,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/WorkerIntroduction/README.md b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/WorkerIntroduction/README.md index 88a673e8cb79d476ee714879782e66a87397f2fd..0cb3ec039d62c06d4eaef9353f7d43b43d4fbdf7 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/WorkerIntroduction/README.md +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/WorkerIntroduction/README.md @@ -10,13 +10,13 @@ Worker主要作用是为应用程序提供一个多线程的运行环境,可 ### 效果预览 -| 首页 | 执行及结果即时反馈 | -| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 首页 | 执行及结果即时反馈 | +| :---------------------------------------------------------------------: | :---------------------------------------------------------------------: | | | | ### 使用说明 -1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序 +1. 在主界面,点击任意按钮进行跳转,点击Hello World执行程序。 2. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 ### 工程目录 @@ -77,10 +77,10 @@ entry/src/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTs/ArkTsConcurrent/MultithreadedConcurrency/WorkerIntroduction > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +``` diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/.gitignore b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/app.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0fcdee187b6053ad02b3463be5572d332f96cfb9 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/app.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "bundleName": "com.example.nodeapimethodpromise", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_layered_image", + "label": "$string:app_name" + } +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/element/string.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e82ee8f23039e81a50c9144ffb6b680d1c7bcdf2 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "NodeAPIMethodPromise" + } + ] +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_background.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_background.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_foreground.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_foreground.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_layered_image.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..b71c16122943f248ace0f5fa26da38b71dbdbdde --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/AppScope/resources/base/media/app_layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:app_background", + "foreground" : "$media:app_foreground" + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/README.md b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/README.md new file mode 100644 index 0000000000000000000000000000000000000000..aa146a300d11dcced25de518e47f1a9dbdc235e5 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/README.md @@ -0,0 +1,73 @@ +# ArkTS使用Node-API调用返回值为promise的ArkTS方法 + +### 介绍 + +当ArkTS的返回值为promise,开发者可以按照以下方式在自己创建的ArkTS运行环境中调用异步的ArkTS接口。 + +- [使用Node-API调用返回值为promise的ArkTS方法](https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.1-Release/zh-cn/application-dev/napi/use-napi-method-promise.md) + +### 效果预览 + +| 首页 | 执行结果图 | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| | | + +### 使用说明 + +1. 运行Index主界面。 +2. 页面呈现上述首页效果,点击按钮,随后点击界面显示的文本字符串即可触发程序执行。 +3. 运行测试用例NodeAPIMethodPromise.test.ets文件对页面代码进行测试可以全部通过。 + +### 工程目录 + +``` +entry/src/ + ├── main + │ ├── cpp + │ │ ├── types + │ │ ├── Index.d.ts + │ │ ├── oh-package.json5 + │ │ ├── CMakeLists.txt + │ │ ├── hello.cpp + │ ├── ets + │ │ ├── entryability + │ │ ├── entrybackupability + │ │ ├── pages + │ │ ├── Index.ets // 使用Node-API调用返回值为promise的ArkTS方法示例代码 + │ ├── module.json5 + │ └── resources + ├── ohosTest + │ ├── ets + │ │ └── test + │ │ ├── Ability.test.ets + │ │ ├── NodeAPIMethodPromise.test.ets // 自动化测试代码 + │ │ └── List.test.ets +``` + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1.本示例仅支持标准系统上运行, 支持设备:RK3568。 + +2.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。 + +3.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。 + +### 下载 + +如需单独下载本工程,执行如下命令: + +``` +git init +git config core.sparsecheckout true +echo code/DocsSample/ArkTs/NodeAPI/NodeAPIUse/NodeAPIMethodPromise > .git/info/sparse-checkout +git remote add origin https://gitee.com/openharmony/applications_app_samples.git +git pull origin master +``` diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/build-profile.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9a067264a40737cf79d1d8ae7c574b8d2cc87ce0 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/build-profile.json5 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compileSdkVersion": 14, + "compatibleSdkVersion": 14, + "targetSdkVersion": 14, + "runtimeOS": "OpenHarmony", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/code-linter.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ed05653cca31b61d64cf6471529eaf50d4f70709 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/code-linter.json5 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/.gitignore b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/build-profile.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8bbe548ca77166375df1b97f53c10c7b4b7e46ad --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/build-profile.json5 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "apiType": "stageMode", + "buildOption": { + "externalNativeOptions": { + "path": "./src/main/cpp/CMakeLists.txt", + "arguments": "", + "cppFlags": "", + "abiFilters": [ + "x86_64", + "armeabi-v7a", + "arm64-v8a" + ] + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + }, + "nativeLib": { + "debugSymbol": { + "strip": true, + "exclude": [] + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/hvigorfile.ts b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/obfuscation-rules.txt b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/oh-package.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/oh-package.json5 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "libentry.so": "file:./src/main/cpp/types/libentry" + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/CMakeLists.txt b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..631e75662a288d2dc7d6dc82cab3a4fb1db79b00 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,14 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(nodeapimethodpromise) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +if(DEFINED PACKAGE_FIND_FILE) + include(${PACKAGE_FIND_FILE}) +endif() + +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) +add_library(entry SHARED hello.cpp) +target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so) \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/hello.cpp b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/hello.cpp new file mode 100644 index 0000000000000000000000000000000000000000..006d2e83a65c8ff643e661e49fd3f2756982bf15 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/hello.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// [Start use_napi_method_promise_cpp] +#include "hilog/log.h" +#include "napi/native_api.h" +#include +#include + +//解析Promise结果的回调 +static napi_value ResolvedCallback(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1]; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + + int result; + napi_get_value_int32(env, args[0], &result); + OH_LOG_INFO(LOG_APP, "Promise resolved with result:%{public}d", result); + return nullptr; +} + +//拒绝Promise的回调 +static napi_value RejectedCallback(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1]; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + + napi_value error; + napi_coerce_to_string(env, args[0], &error); + char errorMsg[1024]; + size_t len; + napi_get_value_string_utf8(env, error, errorMsg, sizeof(errorMsg), &len); + OH_LOG_ERROR(LOG_APP, "Promise rejected with error:%{public}s", errorMsg); + return nullptr; +} + +static napi_value CallArkTSAsync(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value argv[1] = { nullptr }; + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + napi_value promise = nullptr; + napi_call_function(env, nullptr, argv[0], 0, nullptr, &promise); + + napi_value thenFunc = nullptr; + if (napi_get_named_property(env, promise, "then", &thenFunc) != napi_ok) { + return nullptr; + } + + napi_value onResolve = nullptr; + napi_value onReject = nullptr; + napi_create_function(env, "onResolve", NAPI_AUTO_LENGTH, ResolvedCallback, nullptr, &onResolve); + napi_create_function(env, "onReject", NAPI_AUTO_LENGTH, RejectedCallback, nullptr, &onReject); + constexpr size_t kPromiseCallbackCount = 2; + napi_value argv1[2] = {onResolve, onReject}; + napi_call_function(env, promise, thenFunc, kPromiseCallbackCount, argv1, nullptr); + + return nullptr; +} + +// 注册模块接口 +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + {"callArkTSAsync", nullptr, CallArkTSAsync, nullptr, nullptr, nullptr, napi_default, nullptr} + }; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module nativeModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "entry", + .nm_priv = nullptr, + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterEntryModule() +{ + napi_module_register(&nativeModule); +} +// [End use_napi_method_promise_cpp] \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/Index.d.ts b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/Index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b538de4fc83553940ebedfb391ddba87284e63e --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/Index.d.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const callArkTSAsync: (func: Function) => object; \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/oh-package.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6abf3b7c20f22c62aaac6a995a25cae672f73f35 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/cpp/types/libentry/oh-package.json5 @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "name": "libentry.so", + "types": "./Index.d.ts", + "version": "1.0.0", + "description": "Please describe the basic information." +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entryability/EntryAbility.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3ee54d2beea61d38866762868bd056d3e39e3c9 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +const DOMAIN = 0x0000; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a97e21bd7a15599af76a806695860ff1eb0ebfe --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; + +const DOMAIN = 0x0000; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(DOMAIN, 'testTag', 'onBackup ok'); + await Promise.resolve(); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + await Promise.resolve(); + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/pages/Index.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..15c622c83216641e150e9b2e2f4213bcf5d8c78b --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// [Start use_napi_method_promise] +import testNapi from 'libentry.so'; + +export function SetTimeout(): Promise { + return new Promise((resolve) => { + setTimeout(() => { + resolve(42); + }, 1000); + }) +} + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize($r('app.float.page_text_font_size')) + .fontWeight(FontWeight.Bold) + Button($r('app.string.Call_ArkTSAsync')) + .onClick(() => { + try { + this.message = 'Result: napiMethodPromiseSuccess'; + testNapi.callArkTSAsync(SetTimeout); + } catch (e) { + this.message = 'Failed'; + } + }) + } + .width('100%') + } + .height('100%') + } +} +// [End use_napi_method_promise] \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/module.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4144486d1af4c03b0d767cce1cda86fc0d697f91 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/module.json5 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/color.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/float.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/string.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6215241caffccab986d7b7173e28c2c7a40ce16b --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "Call_ArkTSAsync", + "value": "Call" + } + ] +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/background.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/background.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/foreground.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/foreground.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/layered_image.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/startIcon.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/media/startIcon.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/backup_config.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/main_pages.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/dark/element/color.json b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/Ability.test.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f8ce9a2c012f8fe36114cef65216ef0b6254f41 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/List.test.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b35dc5c250a4c008fdef4027c2481f93ae4f22e --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import nodeAPIMethodPromiseTest from './NodeAPIMethodPromise.test'; + +export default function testsuite() { + nodeAPIMethodPromiseTest(); +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/NodeAPIMethodPromise.test.ets b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/NodeAPIMethodPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b95e558c6db126f5b795e12e7ff42c704e0b610 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/ets/test/NodeAPIMethodPromise.test.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, it, expect, beforeAll } from '@ohos/hypium'; +// 导入测试依赖kit +import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; +import { UIAbility, Want } from '@kit.AbilityKit'; + +const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); +const bundleName = abilityDelegatorRegistry.getArguments().bundleName; +let want: Want; + +export default function nodeAPIMethodPromiseTest() { + describe('nodeAPIMethodPromiseTest', () => { + /** + * 打开应用 + */ + beforeAll(async () => { + want = { + bundleName: bundleName, + abilityName: 'EntryAbility' + }; + await delegator.startAbility(want); + const driver = Driver.create(); + await driver.delayMs(1000); + const ability: UIAbility = await delegator.getCurrentTopAbility(); + console.info('get top ability'); + await driver.delayMs(1000); + expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); + }) + + /** + * 点击按钮,调用异步的ArkTS接口 + */ + it('testNodeAPIMethodPromise001', 0, async (done: Function) => { + console.info('uitest: testNodeAPIMethodPromise001 begin'); + const driver = Driver.create(); + await driver.delayMs(1000); + const text = await driver.findComponent(ON.text('Hello World')); + await driver.delayMs(1000); + await text.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('Result: napiMethodPromiseSuccess')); + console.info('uitest: testNodeAPIMethodPromise001 end'); + done(); + }) + }) +} \ No newline at end of file diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/module.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/entry/src/ohosTest/module.json5 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigor/hvigor-config.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..abba3f8bb5fd7ae3ea4626a345f3f557ce010ccc --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.1.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigorfile.ts b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/oh-package.json5 b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..776afe9eb3d822abcfd3e4273f23581af1d1acc1 --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.1.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.21", + "@ohos/hamock": "1.0.0" + } +} diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/ohosTest.md b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/ohosTest.md new file mode 100644 index 0000000000000000000000000000000000000000..227537d7a40d43e478e56ec7d23628101751d0fd --- /dev/null +++ b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/ohosTest.md @@ -0,0 +1,8 @@ +# 使用Node-API调用返回值为promise的ArkTS方法 + +## 用例表 + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 测试结果 | +| ----------------------------------------- | ------------ | --------------------------------- | ------------------------------------------------------------------------ | -------- | +| 拉起应用 | 设备正常运行 | | 成功拉起应用 | Pass | +| ArkTS端成功调用native侧callArkTSAsync接口 | 位于主页 | 点击文本为'Hello World'的文本组件 | 成功调用函数输出日志,页面顶端文本变为'Result: napiMethodPromiseSuccess' | Pass | diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise1.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise1.png new file mode 100644 index 0000000000000000000000000000000000000000..3713324a500848d974a964308a2016b196205044 Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise1.png differ diff --git a/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise2.png b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise2.png new file mode 100644 index 0000000000000000000000000000000000000000..f35f5312f846f3875cd06646b1a7bbc018cfee4e Binary files /dev/null and b/code/DocsSample/ArkTS/NodeAPI/NodeAPIUse/NodeAPIMethodPromise/screenshots/NodeAPIMethodPromise2.png differ diff --git a/code/DocsSample/ArkTSUtilsDocModule/README_zh.md b/code/DocsSample/ArkTSUtilsDocModule/README_zh.md index b0ac3cc4f7548cccb014f404d8049eef3cc35dc1..eb900d664bd54cd3eaf889835603c39edda3cd31 100644 --- a/code/DocsSample/ArkTSUtilsDocModule/README_zh.md +++ b/code/DocsSample/ArkTSUtilsDocModule/README_zh.md @@ -2,19 +2,21 @@ ### 介绍 -本示例通过使用[ArkTS指南文档](https://gitee.com/openharmony/docs/tree/master/zh-cn/application-dev/arkts-utils)中各场景的开发示例,展示在工程中,帮助开发者更好地理解ArkTS提供的各项能力并合理使用。该工程中展示的代码详细描述可查如下链接: +本示例通过使用[ArkTS指南文档](https://gitee.com/openharmony/docs/tree/master/zh-cn/application-dev/arkts-utils)中各场景的开发示例,展示在工程中,帮助开发者更好地理解ArkTS提供的各项能力并合理使用。 -1. [共享模块开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/arkts-sendable-module.md)。 -2. [CPU密集型任务开发指导 (TaskPool和Worker)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/cpu-intensive-task-development.md)。 -3. [I/O密集型任务开发指导 (TaskPool)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/io-intensive-task-development.md)。 -4. [单次I/O任务开发指导 (Promise和async/await)](https://gitee.com/openharmony/docs/blob/OpenHarmony-4.1-Release/zh-cn/application-dev/arkts-utils/single-io-development.md)。 -5. [同步任务开发指导 (TaskPool和Worker)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/sync-task-development.md)。 -6. [异步并发概述 (Promise和async/await)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/async-concurrency-overview.md)。 +该工程中展示的代码详细描述可查如下链接: + +1. [共享模块开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/arkts-sendable-module.md) +2. [CPU密集型任务开发指导 (TaskPool和Worker)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/cpu-intensive-task-development.md) +3. [I/O密集型任务开发指导 (TaskPool)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/io-intensive-task-development.md) +4. [单次I/O任务开发指导 (Promise和async/await)](https://gitee.com/openharmony/docs/blob/OpenHarmony-4.1-Release/zh-cn/application-dev/arkts-utils/single-io-development.md) +5. [同步任务开发指导 (TaskPool和Worker)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/sync-task-development.md) +6. [异步并发概述 (Promise和async/await)](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/arkts-utils/async-concurrency-overview.md) ### 效果预览 -| 首页 | 下拉选项选择各场景 | 执行及结果即时反馈 | -|-------------------------------------|-------------------------------------|-----------------------| +| 首页 | 下拉选项选择各场景 | 执行及结果即时反馈 | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | | ![](screenshots/device/image1.jpeg) | ![](screenshots/device/image2.jpeg) | ![](screenshots/device/image3.jpeg) | ### 使用说明 @@ -26,6 +28,7 @@ 3. 执行结果会即时反馈在按钮上方。 ### 工程目录 + ``` entry/src/main/ets/ |---entryability @@ -64,10 +67,10 @@ entry/src/main/ets/ 如需单独下载本工程,执行如下命令: -```` +``` git init git config core.sparsecheckout true echo code/DocsSample/ArkTSUtilsDocModule/ > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master -```` \ No newline at end of file +```