nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets
arkts
WaterRipplesComponent
功能描述: 本示例主要介绍在很多应用中,会出现点击按钮出现水波纹的特效。 推荐场景: 水波纹的特效 核心组件: 1. ButtonWithWaterRipples 实现步骤: 1. 要实现存在两个连续的涟漪,需要两个层叠的Stack分别以一定延迟进行相同的动画。 2. 通过点击按钮来判断isListening变量,如果为true则添加动画。涟漪动画实际上的效果为透明度0.8->0,半径扩大到6倍的动画,持续时间无限。 3. 如果isListening为false,则用持续时间为0的动画来打断持续时间无限的动画。
@Component export struct WaterRipplesComponent { @State isListening: boolean = false; // 控制组件状态 true:开启水波纹 false:停止水波纹 /** * 创建一个Column组件,内部的ButtonWithWaterRipples为水波纹按钮,用来切换水波纹动画。 * 当点击按钮时,开始触发水波纹动画,下方的文字从点击开始识曲改为正在聆听 */ build() { Column() { Text($r('app.string.water_ripples_sound_hound')) .fontColor(Color.White) .fontSize(18) .margin({ top: $r('app.integer.water_ripples_margin_large') }) ButtonWithWaterRipples({ isListening: this.isListening }) Text(this.isListening ? $r('app.string.water_ripples_is_listening') : $r('app.string.water_ripples_click_to_listen')) .fontColor(Color.White) .margin({ bottom: $r('app.integer.water_ripples_margin_large') }) } .backgroundColor(Color.Black) .justifyContent(FlexAlign.SpaceBetween) .width("100%") .height("100%") .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WaterRipplesComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isListening : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 控制组件状态 true:开启水波纹 false:停止水波纹 /** * 创建一个Column组件,内部的ButtonWithWaterRipples为水波纹按钮,用来切换水波纹动画。 * 当点击按钮时,开始触发水波纹动画,下方的文字从点击开始识曲改为正在聆听 */ AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.water_ripples_sound_hound' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.water_ripples_margin_large' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ButtonWithWaterRipples ( AST#component_parameters#Left { AST#component_parameter#Left isListening : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isListening AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isListening AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.water_ripples_is_listening' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.water_ripples_click_to_listen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.water_ripples_margin_large' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct WaterRipplesComponent { @State isListening: boolean = false; build() { Column() { Text($r('app.string.water_ripples_sound_hound')) .fontColor(Color.White) .fontSize(18) .margin({ top: $r('app.integer.water_ripples_margin_large') }) ButtonWithWaterRipples({ isListening: this.isListening }) Text(this.isListening ? $r('app.string.water_ripples_is_listening') : $r('app.string.water_ripples_click_to_listen')) .fontColor(Color.White) .margin({ bottom: $r('app.integer.water_ripples_margin_large') }) } .backgroundColor(Color.Black) .justifyContent(FlexAlign.SpaceBetween) .width("100%") .height("100%") .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets#L31-L58
66b488f3f8613190d96fa1a37204060b3b790eca
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets
arkts
@file 日期工具
export default class DateTimeUtil { /** * 时分 */ getTime() { const DATETIME = new Date() return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes()) } /** * 月日 */ getDate() { const DATETIME = new Date() return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate()) } /** * 日期不足两位补充0 * @param value-数据值 */ fill(value) { return (value > 9 ? '' : '0') + value } /** * 月日格式修饰 * @param year * @param month * @param date */ concatDate(month, date) { return `${this.fill(month)}-${this.fill(date)}` } /** * 时分格式修饰 * @param hours * @param minutes * @param seconds */ concatTime(hours, minutes) { return `${this.fill(hours)}:${this.fill(minutes)}` } }
AST#export_declaration#Left export default AST#class_declaration#Left class DateTimeUtil AST#class_body#Left { /** * 时分 */ AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . concatTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 月日 */ AST#method_declaration#Left getDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . concatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 日期不足两位补充0 * @param value-数据值 */ AST#method_declaration#Left fill AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right > AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '' AST#expression#Right : AST#expression#Left '0' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 月日格式修饰 * @param year * @param month * @param date */ AST#method_declaration#Left concatDate AST#parameter_list#Left ( AST#parameter#Left month AST#parameter#Right , AST#parameter#Left date AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 时分格式修饰 * @param hours * @param minutes * @param seconds */ AST#method_declaration#Left concatTime AST#parameter_list#Left ( AST#parameter#Left hours AST#parameter#Right , AST#parameter#Left minutes AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hours AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left minutes AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class DateTimeUtil { getTime() { const DATETIME = new Date() return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes()) } getDate() { const DATETIME = new Date() return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate()) } fill(value) { return (value > 9 ? '' : '0') + value } concatDate(month, date) { return `${this.fill(month)}-${this.fill(date)}` } concatTime(hours, minutes) { return `${this.fill(hours)}:${this.fill(minutes)}` } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L19-L64
9a2cb898cf8ad3b4f48d5509dfcf5eac956e157f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets
arkts
getW
Get width. @returns
getW(): number { return this.w; }
AST#method_declaration#Left getW AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . w AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getW(): number { return this.w; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L51-L53
9789e26b59d77b852ce3ccc921fb87947fe170b9
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
startPlayUpdateTimer
启动播放状态更新定时器
startPlayUpdateTimer() { this.playUpdateTimer = setInterval(() => { this.checkCurrentEpisode(); }, 500); }
AST#method_declaration#Left startPlayUpdateTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playUpdateTimer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkCurrentEpisode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
startPlayUpdateTimer() { this.playUpdateTimer = setInterval(() => { this.checkCurrentEpisode(); }, 500); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L82-L86
13d7a4123dedd4f86dcacd13d1a79e8bed4a090b
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets
arkts
selectedIndex
默认选中索引 @param selectedIndex @returns
selectedIndex(selectedIndex: number) { this.builderOptions.selectedIndex = selectedIndex return this; }
AST#method_declaration#Left selectedIndex AST#parameter_list#Left ( AST#parameter#Left selectedIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . selectedIndex AST#member_expression#Right = AST#expression#Left selectedIndex AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
selectedIndex(selectedIndex: number) { this.builderOptions.selectedIndex = selectedIndex return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L36-L39
282f0d1bc23ca4409908f8036134e1412b1616c0
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/pages/AboutUs.ets
arkts
aboutToAppear(): void { const componentContent = new ComponentContent( this.uiContext, wrapBuilder<[Params]>(builderOverlay), new Params(this.uiContext, { x: '2%', y: '3%', }) ) this.overlayNode.addComponentContent(componentContent, 100) // 设置较高层级 this.overlayContent.push(componentContent) } aboutToDisappear(): void { const componentContent = this.overlayContent.pop() if (componentContent) { this.overlayNode.removeComponentContent(componentContent) } }
build() { Column() { Web({ src: $rawfile('AboutUs.html'), controller: this.webviewController }) } .width("100%") .height("100%") }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AboutUs.html' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { Web({ src: $rawfile('AboutUs.html'), controller: this.webviewController }) } .width("100%") .height("100%") }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/AboutUs.ets#L53-L61
b9c7042f8f5beda6d523f71304568d46141e74e0
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/SpecSelectModal.ets
arkts
ModalContentNetWorkLayout
弹窗内容包装器(包含网络状态处理) @returns {void} 无返回值
@Builder private ModalContentNetWorkLayout(): void { BaseNetWorkView({ uiState: this.uiState, onRetry: this.onRetry, loadingBuilder: (): void => this.CustomLoading(), errorBuilder: (): void => this.CustomError(), content: (): void => this.ModalContent() }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ModalContentNetWorkLayout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left BaseNetWorkView ( AST#component_parameters#Left { AST#component_parameter#Left uiState : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRetry : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRetry AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left loadingBuilder : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CustomLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left errorBuilder : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CustomError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ModalContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private ModalContentNetWorkLayout(): void { BaseNetWorkView({ uiState: this.uiState, onRetry: this.onRetry, loadingBuilder: (): void => this.CustomLoading(), errorBuilder: (): void => this.CustomError(), content: (): void => this.ModalContent() }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L116-L125
da65cf0ef3dc521f775fe46654b57cc215bea7ec
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/NavigationService.ets
arkts
获取指定路由的首个参数(类型安全,屏蔽 unknown) @template T @param {string} name - 路由名称 @returns {T} 参数对象;未获取到时返回 undefined
export function getRouteParams<T>(name: string): T { const stack: NavPathStack | undefined = getNavPathStack(); if (!stack) { return undefined as T; } try { return stack.getParamByName(name)[0] as T; } catch (err) { hilog.error(DOMAIN, "NavSvc", "[NavigationService] getRouteParams failed: %{public}s", JSON.stringify(err)); return undefined as T; } }
AST#export_declaration#Left export AST#function_declaration#Left function getRouteParams AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left stack : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NavPathStack AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getNavPathStack AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left stack AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left undefined AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stack AST#expression#Right . getParamByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left "NavSvc" AST#expression#Right , AST#expression#Left "[NavigationService] getRouteParams failed: %{public}s" AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left undefined AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getRouteParams<T>(name: string): T { const stack: NavPathStack | undefined = getNavPathStack(); if (!stack) { return undefined as T; } try { return stack.getParamByName(name)[0] as T; } catch (err) { hilog.error(DOMAIN, "NavSvc", "[NavigationService] getRouteParams failed: %{public}s", JSON.stringify(err)); return undefined as T; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L192-L203
b3d5e8398ce115ee971c86ad60cfe870055542fb
github
RicardoWesleyli/ArkUI-Animations.git
a85f94156d3fde1439bfb68a2108dbc3eb4a1dca
BuyButtonAnimation/entry/src/main/ets/pages/Index.ets
arkts
startSpinAnimation
处理旋转动画(但 UI 中未使用 rotation 绑定)
private startSpinAnimation() { animateTo({ duration: 2000, curve: Curve.Linear }, () => { this.spin = !this.spin }) }
AST#method_declaration#Left private startSpinAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left 2000 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spin AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . spin AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
private startSpinAnimation() { animateTo({ duration: 2000, curve: Curve.Linear }, () => { this.spin = !this.spin }) }
https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/BuyButtonAnimation/entry/src/main/ets/pages/Index.ets#L74-L78
a083b988f8bc6a753969f79a29d4988b40a8a39f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets
arkts
水印文本属性 @param {string} text - 内容 @param {string} [fontSize] - 字体大小 @param {string} [fontColor] - 字体颜色 @param {CanvasTextAlign} [textAlign] - 文本绘制中的文本对齐方式 @param {CanvasTextBaseline} [textBaseline] - 设置文本沿水平方向的对齐方式 @param {number} [offsetY] - 需要绘制的文本的左下角x坐标(图片添加水印方式中引用) @param {number} [offsetX] - 需要绘制的文本的左下角y坐标(图片添加水印方式中引用)
export class TextModify { text: string; fontSize: string; fontColor: string; textAlign: CanvasTextAlign; textBaseline: CanvasTextBaseline; offsetX: number; offsetY: number; constructor(text: string, fontSize: string = '16vp', fontColor: string = '#000', textAlign: CanvasTextAlign = 'center', textBaseline: CanvasTextBaseline = 'middle', offsetX: number = 0, offsetY: number = 0) { this.text = text; this.fontSize = fontSize; this.fontColor = fontColor; this.textAlign = textAlign ; this.textBaseline = textBaseline; this.offsetX = offsetX; this.offsetY = offsetY; } }
AST#export_declaration#Left export AST#class_declaration#Left class TextModify AST#class_body#Left { AST#property_declaration#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left fontSize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left fontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left textAlign : AST#type_annotation#Left AST#primary_type#Left CanvasTextAlign AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left textBaseline : AST#type_annotation#Left AST#primary_type#Left CanvasTextBaseline AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fontSize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16vp' AST#expression#Right AST#parameter#Right , AST#parameter#Left fontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#000' AST#expression#Right AST#parameter#Right , AST#parameter#Left textAlign : AST#type_annotation#Left AST#primary_type#Left CanvasTextAlign AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'center' AST#expression#Right AST#parameter#Right , AST#parameter#Left textBaseline : AST#type_annotation#Left AST#primary_type#Left CanvasTextBaseline AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'middle' AST#expression#Right AST#parameter#Right , AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . text AST#member_expression#Right = AST#expression#Left text AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontSize AST#member_expression#Right = AST#expression#Left fontSize AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColor AST#member_expression#Right = AST#expression#Left fontColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left textAlign AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left textBaseline AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left offsetX AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left offsetY AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TextModify { text: string; fontSize: string; fontColor: string; textAlign: CanvasTextAlign; textBaseline: CanvasTextBaseline; offsetX: number; offsetY: number; constructor(text: string, fontSize: string = '16vp', fontColor: string = '#000', textAlign: CanvasTextAlign = 'center', textBaseline: CanvasTextBaseline = 'middle', offsetX: number = 0, offsetY: number = 0) { this.text = text; this.fontSize = fontSize; this.fontColor = fontColor; this.textAlign = textAlign ; this.textBaseline = textBaseline; this.offsetX = offsetX; this.offsetY = offsetY; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets#L66-L86
1dd4272cb3c7fb12f13a4a01c0591c68de97d24b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseEntry.ets
arkts
getData
Returns the data, additional information that this Entry represents, or null, if no data has been specified. @return
public getData(): Object | null { return this.mData; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getData(): Object | null { return this.mData; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L80-L82
2d90db60709fbd949167f18307e77ca13aa1b10c
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/common/Id.ets
arkts
ID模型 用于处理只返回ID的接口响应 @author Joker.X
export class Id { /** * ID值 */ id: number; constructor(id: number = 0) { this.id = id; } }
AST#export_declaration#Left export AST#class_declaration#Left class Id AST#class_body#Left { /** * ID值 */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Id { id: number; constructor(id: number = 0) { this.id = id; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/common/Id.ets#L6-L15
e527b084684c3a6b7229a6f5b822496903829034
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceVerticalMedium
创建一个中等垂直间距(12vp) @returns {void} 无返回值
@Builder export function SpaceVerticalMedium(): void { Blank().height($r("app.float.space_vertical_medium")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalMedium AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function SpaceVerticalMedium(): void { Blank().height($r("app.float.space_vertical_medium")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L37-L40
c2ac6660f19784d4e2aedae84a8cd6aef7cd8ad9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
isInBoundsX
Checks if the provided entry object is in bounds for drawing considering the current animation phase. @param e @param set @return
protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean { if (e == null) return false; let entryIndex = dataSet.getEntryIndexByEntry(e); if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) { return false; } else { return true; } }
AST#method_declaration#Left protected isInBoundsX AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IBarLineScatterCandleBubbleDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left entryIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getEntryIndexByEntry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left entryIndex AST#expression#Right >= AST#expression#Left dataSet AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right . getPhaseX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean { if (e == null) return false; let entryIndex = dataSet.getEntryIndexByEntry(e); if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) { return false; } else { return true; } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets#L100-L112
20a0d3cadaf28c4cb08d39eb60dd18b7c4a4396c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSource.ets
arkts
@file 商品相关数据源接口 定义商品模块所需的所有网络请求操作 @author Joker.X
export interface GoodsNetworkDataSource { /** * 查询商品分类列表 * @returns 商品分类列表响应 */ getGoodsTypeList(): Promise<NetworkResponse<Category[]>>; /** * 查询商品规格列表 * @param {GoodsIdRequest} params - 商品 ID 请求参数 * @returns {Promise<NetworkResponse<GoodsSpec[]>>} 商品规格列表响应 */ getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>>; /** * 查询搜索关键词列表 * @returns 搜索关键词列表响应 */ getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>>; /** * 分页查询商品 * @param params 商品搜索请求参数 * @returns 商品分页数据响应 */ getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>>; /** * 获取商品信息 * @param id 商品ID * @returns 商品信息响应 */ getGoodsInfo(id: string): Promise<NetworkResponse<Goods>>; /** * 提交商品评论 * @param params 评论提交请求参数 * @returns 提交结果响应 */ submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>>; /** * 分页查询商品评论 * @param params 评论分页请求参数 * @returns 评论分页数据响应 */ getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GoodsNetworkDataSource AST#object_type#Left { /** * 查询商品分类列表 * @returns 商品分类列表响应 */ AST#type_member#Left getGoodsTypeList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 查询商品规格列表 * @param {GoodsIdRequest} params - 商品 ID 请求参数 * @returns {Promise<NetworkResponse<GoodsSpec[]>>} 商品规格列表响应 */ AST#type_member#Left getGoodsSpecList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsIdRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GoodsSpec [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 查询搜索关键词列表 * @returns 搜索关键词列表响应 */ AST#type_member#Left getSearchKeywordList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GoodsSearchKeyword [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 分页查询商品 * @param params 商品搜索请求参数 * @returns 商品分页数据响应 */ AST#type_member#Left getGoodsPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsSearchRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 获取商品信息 * @param id 商品ID * @returns 商品信息响应 */ AST#type_member#Left getGoodsInfo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 提交商品评论 * @param params 评论提交请求参数 * @returns 提交结果响应 */ AST#type_member#Left submitGoodsComment AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentSubmitRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 分页查询商品评论 * @param params 评论分页请求参数 * @returns 评论分页数据响应 */ AST#type_member#Left getGoodsCommentPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentPageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface GoodsNetworkDataSource { getGoodsTypeList(): Promise<NetworkResponse<Category[]>>; getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>>; getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>>; getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>>; getGoodsInfo(id: string): Promise<NetworkResponse<Goods>>; submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>>; getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>>; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSource.ets#L20-L67
3d7799ce2e0925d4d2fe8cdccc67d59b07f39355
github
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/model/CommandEntryList.ets
arkts
updateAllFormBelongsToEntry
以下为桌面卡片(Form)相关 仅更改持久化存储,不刷新卡片 UI 卡片 UI 在 ViewModel 刷新
private async updateAllFormBelongsToEntry(commandEntry: CommandEntry): Promise<string[]> { const updatedFormIDs = await this.pm.updateByShortcut(commandEntry); Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`); return updatedFormIDs; }
AST#method_declaration#Left private async updateAllFormBelongsToEntry AST#parameter_list#Left ( AST#parameter#Left commandEntry : AST#type_annotation#Left AST#primary_type#Left CommandEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left updatedFormIDs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . pm AST#member_expression#Right AST#expression#Right . updateByShortcut AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left commandEntry AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 已更新 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left updatedFormIDs AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个相关卡片 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left updatedFormIDs AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async updateAllFormBelongsToEntry(commandEntry: CommandEntry): Promise<string[]> { const updatedFormIDs = await this.pm.updateByShortcut(commandEntry); Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`); return updatedFormIDs; }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/model/CommandEntryList.ets#L127-L131
58f290a162921bb13bd2984e2efd3048ec34b177
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringUtils.ets
arkts
removedPunctuations
去除标点符号 @param str 输入字符串 @returns 处理后的字符串
static removedPunctuations(str: string): string { return Array.from(str) .filter(c => !punkMarks.has(c)) .join(''); }
AST#method_declaration#Left static removedPunctuations AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left c => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left punkMarks AST#expression#Right AST#unary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left c AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static removedPunctuations(str: string): string { return Array.from(str) .filter(c => !punkMarks.has(c)) .join(''); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L106-L110
7d81f608f1593c26805f245cc95166156c76fde1
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/huawei/HwSubscriber.ets
arkts
queryEnvironmentStatus
检查 IAP 环境
async queryEnvironmentStatus(): Promise<number> { try { await iap.queryEnvironmentStatus(this.context); DebugLog.i('Succeeded in querying environment status.'); return 0; } catch (err) { const e = err as BusinessError; DebugLog.e(`Failed to query environment status. Code: ${e.code}, message: ${e.message}`); return e.code; } }
AST#method_declaration#Left async queryEnvironmentStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left iap AST#expression#Right AST#await_expression#Right AST#expression#Right . queryEnvironmentStatus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Succeeded in querying environment status.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left e = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to query environment status. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async queryEnvironmentStatus(): Promise<number> { try { await iap.queryEnvironmentStatus(this.context); DebugLog.i('Succeeded in querying environment status.'); return 0; } catch (err) { const e = err as BusinessError; DebugLog.e(`Failed to query environment status. Code: ${e.code}, message: ${e.message}`); return e.code; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L38-L48
ce242d09f2ccbb5ea34171d7d0f9cf2a0c943aa6
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
set
Sets the corresponding value of key, and save it in the sandbox. @param key A string, the key of the setting. @param value A string | boolean | number, the corresponding value of key to be set.
static set(key: string, value: string | boolean | number, save: boolean = true) { let found = false; // Sequential search to modify that value. for (let index = 0; index < bunch_of_settings.settings_list.length; index++) { if (bunch_of_settings.settings_list[index].key == key) { bunch_of_settings.settings_list[index].value = value; found = true; break; } } if (!found) { bunch_of_settings.settings_list.push(new settings_item(key, value)); } // Save to sandbox if (save) { bunch_of_settings.save_to_disk(); } }
AST#method_declaration#Left static set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left save : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left found = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Sequential search to modify that value. AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left bunch_of_settings AST#expression#Right AST#binary_expression#Right AST#expression#Right . settings_list AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_list AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . key AST#member_expression#Right AST#expression#Right == AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_list AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . value AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left found = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left found AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_list AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left settings_item AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Save to sandbox AST#statement#Left AST#if_statement#Left if ( AST#expression#Left save AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . save_to_disk AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static set(key: string, value: string | boolean | number, save: boolean = true) { let found = false; for (let index = 0; index < bunch_of_settings.settings_list.length; index++) { if (bunch_of_settings.settings_list[index].key == key) { bunch_of_settings.settings_list[index].value = value; found = true; break; } } if (!found) { bunch_of_settings.settings_list.push(new settings_item(key, value)); } if (save) { bunch_of_settings.save_to_disk(); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L144-L163
d1311040d898f2044cc7423263a933a373ac770e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/LanguageDetector.ets
arkts
detectUserPreferredLanguage
检测用户偏好语言
async detectUserPreferredLanguage(userPreference: UserLanguagePreference): Promise<LanguageDetectionResult> { try { const preferredLanguage = userPreference.preferredLanguages[0] || SupportedLanguage.ZH_CN; const alternatives = userPreference.preferredLanguages.slice(1); return { detectedLanguage: preferredLanguage, confidence: 0.9, source: DetectionSource.USER_PREFERENCE, alternatives }; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to detect user preferred language: ${error}`); throw error; } }
AST#method_declaration#Left async detectUserPreferredLanguage AST#parameter_list#Left ( AST#parameter#Left userPreference : AST#type_annotation#Left AST#primary_type#Left UserLanguagePreference AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LanguageDetectionResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left preferredLanguage = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userPreference AST#expression#Right . preferredLanguages AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left SupportedLanguage AST#expression#Right AST#binary_expression#Right AST#expression#Right . ZH_CN AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left alternatives = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userPreference AST#expression#Right . preferredLanguages AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left detectedLanguage AST#property_name#Right : AST#expression#Left preferredLanguage AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left confidence AST#property_name#Right : AST#expression#Left 0.9 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left source AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DetectionSource AST#expression#Right . USER_PREFERENCE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left alternatives AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to detect user preferred language: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left error AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async detectUserPreferredLanguage(userPreference: UserLanguagePreference): Promise<LanguageDetectionResult> { try { const preferredLanguage = userPreference.preferredLanguages[0] || SupportedLanguage.ZH_CN; const alternatives = userPreference.preferredLanguages.slice(1); return { detectedLanguage: preferredLanguage, confidence: 0.9, source: DetectionSource.USER_PREFERENCE, alternatives }; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to detect user preferred language: ${error}`); throw error; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L285-L301
4e350185df2fb3cf0d9b09a718db60663ed56910
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/model/Step.ets
arkts
日程步骤数据类型。
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/Step.ets#L4-L4
681def3f5e864b6984e2543ee111652fa959dfca
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets
arkts
increment
计数加一 @returns {void} 无返回值
increment(): void { this.counterState.increment(); }
AST#method_declaration#Left increment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . counterState AST#member_expression#Right AST#expression#Right . increment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
increment(): void { this.counterState.increment(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets#L20-L22
645e793a158bdf2c004430289c3855297842a505
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
arkts
encode2048PKCS1Segment
2048位加密-分段 @param str 待加密的字符串 @param pubKey 2048位RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static encode2048PKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, resultCoding, isPem); }
AST#method_declaration#Left static encode2048PKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right , AST#parameter#Left isPem : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . encodeAsymSegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left 'RSA2048' AST#expression#Right , AST#expression#Left 'RSA2048|PKCS1' AST#expression#Right , AST#expression#Left 2048 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right , AST#expression#Left isPem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encode2048PKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, resultCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L96-L100
fb3cd857743945af4dd7cabc3316a4e0a1f1cad4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
getNumber
获取数字值 @param key 键 @param defaultValue 默认值 @returns 数字值
async getNumber(key: string, defaultValue: number = 0): Promise<number> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as number; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get number: ${businessError.message}`); return defaultValue; } }
AST#method_declaration#Left async getNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialized AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defaultValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get number: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left defaultValue AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getNumber(key: string, defaultValue: number = 0): Promise<number> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as number; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get number: ${businessError.message}`); return defaultValue; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L116-L125
59bfaef4b3893ffd743f9c316d68974108e14cd2
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/world.ets
arkts
矿工世界运动一次
export function playerActionOnce(world: WORLD): t.TWorldAction { let exp = 0 // 创建深度 const perStep = calcPerStepVal(world) exp = utils.getRandomInt(1,10) % 3 === 0 ? calcPlayerExpByActionOnce(perStep, world) : 0 // 创建事件 const event = createActionEvent(world, perStep) // 创建消息 let message: string[] = [] if (world.per>=100) { message.push('你努力的将矿洞向前挖进了1米!|2') world.perFull() } // 处理挖掘事件 const eventResult = handlerEffectScript(event, world) if (eventResult.msg) { message.push(`${eventResult.msg}|${event.quality}`) } // 增加一次打坐能力 world.player.meditationPoint = utils.getRandomInt(1,10) % 3 === 0 ? 1 : 0 // // 处理经验值 const levelUp = world.player.setExp(exp) if(levelUp) { message.push(`恭喜矿工升级了[等级: ${world.player.level}级]|2`) } console.warn('action message: ', message) const res: t.TWorldAction = { perStep, // 计算后的挖掘进度 event, // 触发的事件 message, // 动作事件 exp, // 获得的经验 levelUp: eventResult.levelUp, } return res }
AST#export_declaration#Left export AST#function_declaration#Left function playerActionOnce AST#parameter_list#Left ( AST#parameter#Left world : AST#type_annotation#Left AST#primary_type#Left WORLD AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TWorldAction AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left exp = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right // 创建深度 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left perStep AST#ERROR#Left = AST#expression#Left AST#call_expression#Left AST#expression#Left calcPerStepVal AST#expression#Right AST#argument_list#Left ( AST#expression#Left world AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right exp AST#ERROR#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left calcPlayerExpByActionOnce AST#expression#Right AST#argument_list#Left ( AST#expression#Left perStep AST#expression#Right , AST#expression#Left world AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right // 创建事件 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left event = AST#expression#Left AST#call_expression#Left AST#expression#Left createActionEvent AST#expression#Right AST#argument_list#Left ( AST#expression#Left world AST#expression#Right , AST#expression#Left perStep AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 创建消息 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . per AST#member_expression#Right AST#expression#Right >= AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '你努力的将矿洞向前挖进了1米!|2' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . perFull AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 处理挖掘事件 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left eventResult = AST#expression#Left AST#call_expression#Left AST#expression#Left handlerEffectScript AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right , AST#expression#Left world AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left eventResult AST#expression#Right . msg AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left eventResult AST#expression#Right . msg AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right | AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . quality AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 增加一次打坐能力 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . player AST#member_expression#Right AST#expression#Right . meditationPoint AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // // 处理经验值 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left levelUp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . player AST#member_expression#Right AST#expression#Right . setExp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left exp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left levelUp AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 恭喜矿工升级了[等级: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . player AST#member_expression#Right AST#expression#Right . level AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 级]|2 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'action message: ' AST#expression#Right , AST#expression#Left message AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left res : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TWorldAction AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left perStep AST#property_assignment#Right , // 计算后的挖掘进度 AST#property_assignment#Left event AST#property_assignment#Right , // 触发的事件 AST#property_assignment#Left message AST#property_assignment#Right , // 动作事件 AST#property_assignment#Left exp AST#property_assignment#Right , // 获得的经验 AST#property_assignment#Left AST#property_name#Left levelUp AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left eventResult AST#expression#Right . levelUp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function playerActionOnce(world: WORLD): t.TWorldAction { let exp = 0 const perStep = calcPerStepVal(world) exp = utils.getRandomInt(1,10) % 3 === 0 ? calcPlayerExpByActionOnce(perStep, world) : 0 const event = createActionEvent(world, perStep) let message: string[] = [] if (world.per>=100) { message.push('你努力的将矿洞向前挖进了1米!|2') world.perFull() } const eventResult = handlerEffectScript(event, world) if (eventResult.msg) { message.push(`${eventResult.msg}|${event.quality}`) } world.player.meditationPoint = utils.getRandomInt(1,10) % 3 === 0 ? 1 : 0 const levelUp = world.player.setExp(exp) if(levelUp) { message.push(`恭喜矿工升级了[等级: ${world.player.level}级]|2`) } console.warn('action message: ', message) const res: t.TWorldAction = { perStep, event, message, exp, levelUp: eventResult.levelUp, } return res }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L120-L160
ed41809fe5b5059ea08e446adb4f0c59c165e21f
github
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git
3b5fa45c650dcae2773a19f122161935e0c0e2bc
entry/src/main/ets/pages/customScan/view/ScanLine.ets
arkts
backAnimatorCreate
Scanning line animation.
async backAnimatorCreate(): Promise<void> { if (this.backAnimator) { this.backAnimator.onRepeat = () => { this.reverse = !this.reverse; if (this.reverse) { this.allAngle = 0; } else { this.allAngle = 180; } } this.backAnimator.onCancel = () => { this.isScanMotion = false; } this.backAnimator.onFrame = (value) => { if (!this.isScanMotion) { this.isScanMotion = true; } this.isOpenAlbum = false; value = value / 100; if (value < 0.389) { this.speed = curves.cubicBezierCurve(0.4, 0.0, 0.7, 1.0).interpolate(value / 0.389); } else { this.speed = 1.0 - curves.cubicBezierCurve(0.25, 0.0, 0.4, 1.0).interpolate((value - 0.389) / 0.611); } this.linePosition = 100 * value; } } }
AST#method_declaration#Left async backAnimatorCreate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backAnimator AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backAnimator AST#member_expression#Right AST#expression#Right . onRepeat AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reverse AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . reverse AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reverse AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allAngle AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allAngle AST#member_expression#Right = AST#expression#Left 180 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backAnimator AST#member_expression#Right AST#expression#Right . onCancel AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isScanMotion AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backAnimator AST#member_expression#Right AST#expression#Right . onFrame AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isScanMotion AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isScanMotion AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpenAlbum AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left value = AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right < AST#expression#Left 0.389 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . speed AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left curves AST#expression#Right . cubicBezierCurve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.4 AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right , AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . interpolate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right / AST#expression#Left 0.389 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . speed AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1.0 AST#expression#Right - AST#expression#Left curves AST#expression#Right AST#binary_expression#Right AST#expression#Right . cubicBezierCurve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.25 AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right , AST#expression#Left 0.4 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . interpolate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right - AST#expression#Left 0.389 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 0.611 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linePosition AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left 100 AST#expression#Right * AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
async backAnimatorCreate(): Promise<void> { if (this.backAnimator) { this.backAnimator.onRepeat = () => { this.reverse = !this.reverse; if (this.reverse) { this.allAngle = 0; } else { this.allAngle = 180; } } this.backAnimator.onCancel = () => { this.isScanMotion = false; } this.backAnimator.onFrame = (value) => { if (!this.isScanMotion) { this.isScanMotion = true; } this.isOpenAlbum = false; value = value / 100; if (value < 0.389) { this.speed = curves.cubicBezierCurve(0.4, 0.0, 0.7, 1.0).interpolate(value / 0.389); } else { this.speed = 1.0 - curves.cubicBezierCurve(0.25, 0.0, 0.4, 1.0).interpolate((value - 0.389) / 0.611); } this.linePosition = 100 * value; } } }
https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/view/ScanLine.ets#L80-L109
f59aa8b0e50f3b225541b55faa1aeb5af493fb10
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/NotificationUtil.ets
arkts
authorizeNotification
请求通知授权,第一次调用会弹窗让用户选择。 @returns
static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtil.isNotificationEnabled(); //查询通知是否授权 if (!isEnabled) { //未授权,拉起授权 try { await notificationManager.requestEnableNotification(AppUtil.getContext()); callBack?.(true); return true; } catch (e) { callBack?.(false); return false; } } else { callBack?.(true); return true; } }
AST#method_declaration#Left static async authorizeNotification AST#parameter_list#Left ( AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left grant : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NotificationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //查询通知是否授权 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isEnabled AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { //未授权,拉起授权 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtil.isNotificationEnabled(); if (!isEnabled) { try { await notificationManager.requestEnableNotification(AppUtil.getContext()); callBack?.(true); return true; } catch (e) { callBack?.(false); return false; } } else { callBack?.(true); return true; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NotificationUtil.ets#L79-L94
f3773ebde6c2969642b222d4ca1aab53a38bd3be
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets
arkts
isSandboxFunc
是否为沙箱应用
async isSandboxFunc(): Promise<void> { try { this.inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内 Logger.info(TAG, 'inSandbox:' + this.inSandbox); promptAction.showToast({ message: 'inSandbox:' + this.inSandbox, duration: 2000 }); } catch (err) { Logger.error(TAG, 'error' + (err as BusinessError).code + (err as BusinessError).message); } }
AST#method_declaration#Left async isSandboxFunc AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inSandbox AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dlpPermission AST#expression#Right AST#await_expression#Right AST#expression#Right . isInSandbox AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 是否在沙箱内 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'inSandbox:' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . inSandbox AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'inSandbox:' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . inSandbox AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'error' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async isSandboxFunc(): Promise<void> { try { this.inSandbox = await dlpPermission.isInSandbox(); Logger.info(TAG, 'inSandbox:' + this.inSandbox); promptAction.showToast({ message: 'inSandbox:' + this.inSandbox, duration: 2000 }); } catch (err) { Logger.error(TAG, 'error' + (err as BusinessError).code + (err as BusinessError).message); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L71-L79
55d8b68faac6110b65f935cc934bbce3adc07ee1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
cancelTodo
取消代办事项
async cancelTodo(id: string): Promise<Todo | null> { const todo = await this.updateTodo({ id, status: TodoStatus.CANCELLED }); if (todo) { this.recordOperation('cancel', id, undefined, `取消代办事项: ${todo.title}`); } return todo; }
AST#method_declaration#Left async cancelTodo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Todo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . updateTodo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left id AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left status AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TodoStatus AST#expression#Right . CANCELLED AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left todo AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . recordOperation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'cancel' AST#expression#Right , AST#expression#Left id AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 取消代办事项: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left todo AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left todo AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async cancelTodo(id: string): Promise<Todo | null> { const todo = await this.updateTodo({ id, status: TodoStatus.CANCELLED }); if (todo) { this.recordOperation('cancel', id, undefined, `取消代办事项: ${todo.title}`); } return todo; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L305-L316
4e629ae4fa52d6bc8edec5cb0b67c3d9dbe38661
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
zoomIn
################ ################ ################ ################ CODE BELOW THIS RELATED TO SCALING AND GESTURES Zooms in by 1.4f, x and y are the coordinates (in pixels) of the zoom center. @param x @param y
public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix { let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix; save.reset(); save.set(this.mMatrixTouch); save.postScale(1.4, 1.4, x, y); return save; }
AST#method_declaration#Left public zoomIn AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputMatrix ? : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left save : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left outputMatrix AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left outputMatrix AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Matrix AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left outputMatrix AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left save AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left save AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMatrixTouch AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left save AST#expression#Right . postScale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1.4 AST#expression#Right , AST#expression#Left 1.4 AST#expression#Right , AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left save AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix { let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix; save.reset(); save.set(this.mMatrixTouch); save.postScale(1.4, 1.4, x, y); return save; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ViewPortHandler.ets#L193-L199
8e88829f1890d954afda10447b0bfd1e5314320c
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/utils/PermissionsUtil.ets
arkts
reqPermissionsFromUser
使用UIExtensionAbility:将common.UIAbilityContext 替换为common.UIExtensionContext
reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 atManager.requestPermissionsFromUser(context, permissions).then((data) => { let grantStatus: Array<number> = data.authResults; let length: number = grantStatus.length; for (let i = 0; i < length; i++) { if (grantStatus[i] === 0) { // 用户授权,可以继续访问目标操作 hilog.debug(DOMAIN, TAG, "授权成功,可以访问蓝牙服务") } else { // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 hilog.warn(DOMAIN, TAG, "用户拒绝授权,无法访问蓝牙服务") this.reqPermissionOnSetting(permissions, context) return; } } // 授权成功 }).catch((err: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`); }) }
AST#method_declaration#Left reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . AtManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . createAtManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left atManager AST#expression#Right . requestPermissionsFromUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left permissions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left grantStatus : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . authResults AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left grantStatus AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left length AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left grantStatus AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 用户授权,可以继续访问目标操作 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left "授权成功,可以访问蓝牙服务" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left "用户拒绝授权,无法访问蓝牙服务" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reqPermissionOnSetting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left permissions AST#expression#Right , AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 授权成功 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to request permissions from user. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(context, permissions).then((data) => { let grantStatus: Array<number> = data.authResults; let length: number = grantStatus.length; for (let i = 0; i < length; i++) { if (grantStatus[i] === 0) { hilog.debug(DOMAIN, TAG, "授权成功,可以访问蓝牙服务") } else { hilog.warn(DOMAIN, TAG, "用户拒绝授权,无法访问蓝牙服务") this.reqPermissionOnSetting(permissions, context) return; } } }).catch((err: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`); }) }
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/utils/PermissionsUtil.ets#L35-L57
a0805251af60b98f5f7739e42d82bcd0d7d9b798
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取梦想详情 @param id 梦想ID @returns 梦想详情
export function getDreamById(id: number): Promise<Dream> { console.info(`开始获取梦想详情, ID: ${id}`); try { return request<Dream>(RequestMethod.GET, `/dreams/${id}`) .then(dreamDetail => { // 处理图片URL if (dreamDetail && dreamDetail.imageUrl) { dreamDetail.imageUrl = processImageUrl(dreamDetail.imageUrl); console.info(`梦想图片URL处理后: ${dreamDetail.imageUrl}`); } return dreamDetail; }); } catch (error) { const errorMsg = `获取梦想详情失败: ${error instanceof Error ? error.message : String(error)}`; console.error(errorMsg); console.error(`梦想ID: ${id}`); throw new Error(errorMsg); } }
AST#export_declaration#Left export AST#function_declaration#Left function getDreamById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Dream AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 开始获取梦想详情, ID: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Dream AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /dreams/ AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left dreamDetail => AST#block_statement#Left { // 处理图片URL AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left dreamDetail AST#expression#Right && AST#expression#Left dreamDetail AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left dreamDetail AST#expression#Right . imageUrl AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left processImageUrl AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dreamDetail AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 梦想图片URL处理后: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left dreamDetail AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left dreamDetail AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorMsg = AST#expression#Left AST#template_literal#Left ` 获取梦想详情失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 梦想ID: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getDreamById(id: number): Promise<Dream> { console.info(`开始获取梦想详情, ID: ${id}`); try { return request<Dream>(RequestMethod.GET, `/dreams/${id}`) .then(dreamDetail => { if (dreamDetail && dreamDetail.imageUrl) { dreamDetail.imageUrl = processImageUrl(dreamDetail.imageUrl); console.info(`梦想图片URL处理后: ${dreamDetail.imageUrl}`); } return dreamDetail; }); } catch (error) { const errorMsg = `获取梦想详情失败: ${error instanceof Error ? error.message : String(error)}`; console.error(errorMsg); console.error(`梦想ID: ${id}`); throw new Error(errorMsg); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L651-L669
a9f0dd60ed7a4c23147ba2dca0dd48ceef6997c5
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/auth/src/main/ets/navigation/AuthGraph.ets
arkts
register
注册认证模块导航路由 @returns {void} 无返回值
register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); }
AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AuthRoutes AST#expression#Right . Login AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left LoginNav AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/navigation/AuthGraph.ets#L14-L16
94cfac6ea40e6611e29917fd7373516f4b6aedf5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/cs/src/main/ets/navigation/ChatNav.ets
arkts
ChatNav
@file 客服聊天页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function ChatNav(): void { ChatPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ChatNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left ChatPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function ChatNav(): void { ChatPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/cs/src/main/ets/navigation/ChatNav.ets#L8-L11
460edd3df89f42c5cd3a1570bcb04955d6d59d35
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
全局组件复用池
export class NodePool { private static instance: NodePool; private idGen: number; private nodePool: HashMap<string, Array<NodeItem>>; private constructor() { this.nodePool = new HashMap(); this.idGen = 0; } // 使用单例模式,用于全局管理组件复用池 public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; } // 获取组件ID public getNextId(): number { this.idGen += 1; return this.idGen; } // 根据type获取子组件,如果有则直接复用,如果没有则创建新的子组件 public getNode(type: string, item: ESObject, itemColor: Color, builder: WrappedBuilder<ESObject>): NodeItem | undefined { let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop(); if (!nodeItem) { nodeItem = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; nodeItem.type = type; nodeItem.data.itemColor = itemColor; } else { nodeItem.data.data = item; nodeItem.data.itemColor = itemColor; } return nodeItem; } // 回收子组件到复用池中 public recycleNode(type: string, node: NodeItem) { let nodeArray: Array<NodeItem> = this.nodePool.get(type); if (!nodeArray) { nodeArray = new Array(); this.nodePool.set(type, nodeArray); } nodeArray.push(node); } }
AST#export_declaration#Left export AST#class_declaration#Left class NodePool AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left NodePool AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private idGen : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private nodePool : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HashMap AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NodeItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodePool AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left HashMap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGen AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // 使用单例模式,用于全局管理组件复用池 AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left NodePool AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left NodePool AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left NodePool AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NodePool AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 获取组件ID AST#method_declaration#Left public getNextId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGen AST#member_expression#Right += AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGen AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 根据type获取子组件,如果有则直接复用,如果没有则创建新的子组件 AST#method_declaration#Left public getNode AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemColor : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NodeItem AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left nodeItem : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NodeItem AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodePool AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left nodeItem AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left nodeItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left NodeItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . builder AST#member_expression#Right = AST#expression#Left builder AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right = AST#expression#Left item AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . itemColor AST#member_expression#Right = AST#expression#Left itemColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right = AST#expression#Left item AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . itemColor AST#member_expression#Right = AST#expression#Left itemColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left nodeItem AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 回收子组件到复用池中 AST#method_declaration#Left public recycleNode AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left node : AST#type_annotation#Left AST#primary_type#Left NodeItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left nodeArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NodeItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodePool AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left nodeArray AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left nodeArray = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodePool AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left nodeArray AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeArray AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left node AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class NodePool { private static instance: NodePool; private idGen: number; private nodePool: HashMap<string, Array<NodeItem>>; private constructor() { this.nodePool = new HashMap(); this.idGen = 0; } public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; } public getNextId(): number { this.idGen += 1; return this.idGen; } public getNode(type: string, item: ESObject, itemColor: Color, builder: WrappedBuilder<ESObject>): NodeItem | undefined { let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop(); if (!nodeItem) { nodeItem = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; nodeItem.type = type; nodeItem.data.itemColor = itemColor; } else { nodeItem.data.data = item; nodeItem.data.itemColor = itemColor; } return nodeItem; } public recycleNode(type: string, node: NodeItem) { let nodeArray: Array<NodeItem> = this.nodePool.get(type); if (!nodeArray) { nodeArray = new Array(); this.nodePool.set(type, nodeArray); } nodeArray.push(node); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L53-L103
708a983a64b9a56b7cb4c070fe319239821e160c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
getUserLevel
获取用户等级信息
getUserLevel(): UserLevel { if (!this.userGameData) { return this.levelConfig[0]; } return this.userGameData.level; }
AST#method_declaration#Left getUserLevel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserLevel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . userGameData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . levelConfig AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userGameData AST#member_expression#Right AST#expression#Right . level AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getUserLevel(): UserLevel { if (!this.userGameData) { return this.levelConfig[0]; } return this.userGameData.level; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L440-L445
5f5b673390e2cd619fd6da0a98d9529d36f7dbb3
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerComponent.ets
arkts
startTimer
开始计时(从初始状态)
private startTimer() { if (this.isRunning) return; // 开始是从初始状态启动,需要重置当前时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.resumeTimer(); }
AST#method_declaration#Left private startTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRunning AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 开始是从初始状态启动,需要重置当前时间 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSeconds AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIncrementing AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . totalSeconds AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resumeTimer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private startTimer() { if (this.isRunning) return; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.resumeTimer(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L92-L97
677232827ac25bcf4ee9c692df25b9b7749e2c3c
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PickerUtils.ets
arkts
savePhoto
通过保存模式拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入 @param newFileNames
static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> { try { let photoPicker = new picker.PhotoViewPicker(); if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) { let photoSaveResult = await photoPicker.save() if (photoSaveResult && photoSaveResult.length > 0) { return photoSaveResult } else { return []; } } else { let PhotoSaveOptions = new picker.PhotoSaveOptions(); PhotoSaveOptions.newFileNames = newFileNames; let photoSaveResult = await photoPicker.save(PhotoSaveOptions) if (photoSaveResult && photoSaveResult.length > 0) { return photoSaveResult } else { return []; } } } catch (err) { let error = err as BusinessError; LogUtils.debug( 'PickerUtil',`-savePhoto-异常 ~ code: ${error.code} -·- message: ${error.message}`); return []; } }
AST#method_declaration#Left static async savePhoto AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left newFileNames AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoSaveResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left photoSaveResult AST#expression#Right && AST#expression#Left photoSaveResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left photoSaveResult AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left PhotoSaveOptions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSaveOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left PhotoSaveOptions AST#expression#Right . newFileNames AST#member_expression#Right = AST#expression#Left newFileNames AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoSaveResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left PhotoSaveOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left photoSaveResult AST#expression#Right && AST#expression#Left photoSaveResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left photoSaveResult AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtils AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'PickerUtil' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` -savePhoto-异常 ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> { try { let photoPicker = new picker.PhotoViewPicker(); if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) { let photoSaveResult = await photoPicker.save() if (photoSaveResult && photoSaveResult.length > 0) { return photoSaveResult } else { return []; } } else { let PhotoSaveOptions = new picker.PhotoSaveOptions(); PhotoSaveOptions.newFileNames = newFileNames; let photoSaveResult = await photoPicker.save(PhotoSaveOptions) if (photoSaveResult && photoSaveResult.length > 0) { return photoSaveResult } else { return []; } } } catch (err) { let error = err as BusinessError; LogUtils.debug( 'PickerUtil',`-savePhoto-异常 ~ code: ${error.code} -·- message: ${error.message}`); return []; } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L107-L132
aff77f79184ed96d5eeb8477fac87046d40dc525
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/CheckSurveyView.ets
arkts
itemEnd
划出组件 —— 当前用于删除问题
@Builder itemEnd(questionIndex: number) { Row({ space: 16 }) { Button() { SymbolGlyph($r('sys.symbol.trash_fill')) .fontSize(24) .fontColor([Color.White]) } .width(40) .height(40) .backgroundColor(Color.Red) .onClick(() => { // 开启按钮触感反馈 if (this.appGeneralData.isHapticButton) { StartVibrator() } this.survey!.questions.splice(questionIndex, 1); }) } .alignItems(VerticalAlign.Center) .height('100%') .margin({ left: 24 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left questionIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.trash_fill' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 开启按钮触感反馈 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticButton AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left StartVibrator AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . survey AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . questions AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left questionIndex AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder itemEnd(questionIndex: number) { Row({ space: 16 }) { Button() { SymbolGlyph($r('sys.symbol.trash_fill')) .fontSize(24) .fontColor([Color.White]) } .width(40) .height(40) .backgroundColor(Color.Red) .onClick(() => { if (this.appGeneralData.isHapticButton) { StartVibrator() } this.survey!.questions.splice(questionIndex, 1); }) } .alignItems(VerticalAlign.Center) .height('100%') .margin({ left: 24 }) }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/CheckSurveyView.ets#L189-L211
4d6c15c751f88582b54dd7a7e4722d13b6c3fd86
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceSearch.d.ets
arkts
AtomicServiceSearch
Defines AtomicServiceSearch. @struct {AtomicServiceSearch} @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
@Component export declare struct AtomicServiceSearch { /** * Sets the search text content that is currently displayed. * * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ @Prop value?: ResourceStr; /** * Indicates default prompt text displayed in the search box. * The default value is Search, which supports globalization. * * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ @Prop placeholder?: ResourceStr; /** * Events and styles supported by the search area. * * @type { ?SearchParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ @Prop search?: SearchParams; /** * Contents, events, and styles of the select area. * * @type { ?SelectParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ @Prop select?: SelectParams; /** * Function settings in the selection area (right). * * @type { ?OperationParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ operation?: OperationParams; /** * Set the Search component controller. * * @type { ?SearchController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ controller?: SearchController; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceSearch AST#component_body#Left { /** * Sets the search text content that is currently displayed. * * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right value ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Indicates default prompt text displayed in the search box. * The default value is Search, which supports globalization. * * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right placeholder ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Events and styles supported by the search area. * * @type { ?SearchParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right search ? : AST#type_annotation#Left AST#primary_type#Left SearchParams AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Contents, events, and styles of the select area. * * @type { ?SelectParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right select ? : AST#type_annotation#Left AST#primary_type#Left SelectParams AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Function settings in the selection area (right). * * @type { ?OperationParams }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left operation ? : AST#type_annotation#Left AST#primary_type#Left OperationParams AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Set the Search component controller. * * @type { ?SearchController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left SearchController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export declare struct AtomicServiceSearch { @Prop value?: ResourceStr; @Prop placeholder?: ResourceStr; @Prop search?: SearchParams; @Prop select?: SelectParams; operation?: OperationParams; controller?: SearchController; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L767-L828
cbd847c033a5ad7d40307e1eb6b10619c6e2aab0
gitee
SeaEpoch/SepWeather.git
e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c
entry/src/main/ets/common/database/tables/LocationTable.ets
arkts
query
查询
query(locationName: string, callback: Function, isAll: boolean = true) { let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName); if (!isAll) { predicates.equalTo('locationName', locationName); } this.locationTable.query(predicates, (resultSet: relationalStore.ResultSet) => { let count: number = resultSet.rowCount; if (count === 0 || typeof count === 'string') { console.log(`${CommonConstants.LOCATION_TABLE_TAG}` + 'Query no results!'); callback([]); } else { resultSet.goToFirstRow(); const result: LocationData[] = []; for (let i = 0; i < count; i++) { let tmp: LocationData = { id: 0, locationName: '', lat: 0.0, lon: 0.0, selected: false }; tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id')); tmp.locationName = resultSet.getString(resultSet.getColumnIndex('locationName')); tmp.lat = resultSet.getDouble(resultSet.getColumnIndex('lat')); tmp.lon = resultSet.getDouble(resultSet.getColumnIndex('lon')); tmp.selected = resultSet.getDouble(resultSet.getColumnIndex('selected')) == 0 ? false : true ; result[i] = tmp; resultSet.goToNextRow(); } callback(result); } }); }
AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left locationName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isAll : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LOCATION_TABLE AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isAll AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'locationName' AST#expression#Right , AST#expression#Left locationName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationTable AST#member_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . rowCount AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left count AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LOCATION_TABLE_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right + AST#expression#Left 'Query no results!' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LocationData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tmp : AST#type_annotation#Left AST#primary_type#Left LocationData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left locationName AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lat AST#property_name#Right : AST#expression#Left 0.0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lon AST#property_name#Right : AST#expression#Left 0.0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . locationName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'locationName' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . lat AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lat' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . lon AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lon' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . selected AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'selected' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = tmp AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
query(locationName: string, callback: Function, isAll: boolean = true) { let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName); if (!isAll) { predicates.equalTo('locationName', locationName); } this.locationTable.query(predicates, (resultSet: relationalStore.ResultSet) => { let count: number = resultSet.rowCount; if (count === 0 || typeof count === 'string') { console.log(`${CommonConstants.LOCATION_TABLE_TAG}` + 'Query no results!'); callback([]); } else { resultSet.goToFirstRow(); const result: LocationData[] = []; for (let i = 0; i < count; i++) { let tmp: LocationData = { id: 0, locationName: '', lat: 0.0, lon: 0.0, selected: false }; tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id')); tmp.locationName = resultSet.getString(resultSet.getColumnIndex('locationName')); tmp.lat = resultSet.getDouble(resultSet.getColumnIndex('lat')); tmp.lon = resultSet.getDouble(resultSet.getColumnIndex('lon')); tmp.selected = resultSet.getDouble(resultSet.getColumnIndex('selected')) == 0 ? false : true ; result[i] = tmp; resultSet.goToNextRow(); } callback(result); } }); }
https://github.com/SeaEpoch/SepWeather.git/blob/e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c/entry/src/main/ets/common/database/tables/LocationTable.ets#L43-L71
dd624930a30846711692918f45f7d2dc9e9daf23
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/MoodEntry.ets
arkts
Unix timestamp in milliseconds
constructor( id: number = 0, date: string = '', emotion: string = 'neutral', intensity: number = 3, messageCount: number = 1, timestamp: number = Date.now() ) { this.id = id; this.date = date; this.emotion = emotion; this.intensity = intensity; this.messageCount = messageCount; this.timestamp = timestamp; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left emotion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'neutral' AST#expression#Right AST#parameter#Right , AST#parameter#Left intensity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right AST#parameter#Right , AST#parameter#Left messageCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right , AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right = AST#expression#Left date AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . emotion AST#member_expression#Right = AST#expression#Left emotion AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intensity AST#member_expression#Right = AST#expression#Left intensity AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . messageCount AST#member_expression#Right = AST#expression#Left messageCount AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timestamp AST#member_expression#Right = AST#expression#Left timestamp AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor( id: number = 0, date: string = '', emotion: string = 'neutral', intensity: number = 3, messageCount: number = 1, timestamp: number = Date.now() ) { this.id = id; this.date = date; this.emotion = emotion; this.intensity = intensity; this.messageCount = messageCount; this.timestamp = timestamp; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L39-L53
51c58cafc2ef74711992f21e94cd2712fcfce6f4
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/mock/CityInfo.ets
arkts
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 cityData: CityInfo[] = [ { "name": $r('app.string.Beijing'), "temp": "32", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Shanghai'), "temp": "28", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Guangzhou'), "temp": "35", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Tianjin'), "temp": "35", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Wuhan'), "temp": "26", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Shenyang'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Chongqing'), "temp": "27", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Hangzhou'), "temp": "35", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Nanjing'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Harbin'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Changchun'), "temp": "28", "weather": $r('app.string.Shower') }, { "name": $r('app.string.Hohhot'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Shijiazhuang'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Yinchuan'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Urumqi'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Lhasa'), "temp": "35", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Xining'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Xian'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Lanzhou'), "temp": "25", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Taiyuan'), "temp": "25", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Kunming'), "temp": "25", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Nanning'), "temp": "20", "weather": $r('app.string.Sunny') } ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left cityData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CityInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Beijing' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "32" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Shanghai' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "28" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Cloudy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Guangzhou' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "35" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Rainy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Tianjin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "35" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Rainy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Wuhan' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "26" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Cloudy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Shenyang' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Chongqing' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "27" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Rainy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Hangzhou' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "35" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Nanjing' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Harbin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Changchun' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "28" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Shower' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Hohhot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Shijiazhuang' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Yinchuan' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Urumqi' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Lhasa' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "35" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Xining' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Xian' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Lanzhou' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Cloudy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Taiyuan' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Cloudy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Kunming' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "25" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Rainy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "name" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Nanning' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "temp" AST#property_name#Right : AST#expression#Left "20" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "weather" AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.Sunny' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const cityData: CityInfo[] = [ { "name": $r('app.string.Beijing'), "temp": "32", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Shanghai'), "temp": "28", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Guangzhou'), "temp": "35", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Tianjin'), "temp": "35", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Wuhan'), "temp": "26", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Shenyang'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Chongqing'), "temp": "27", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Hangzhou'), "temp": "35", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Nanjing'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Harbin'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Changchun'), "temp": "28", "weather": $r('app.string.Shower') }, { "name": $r('app.string.Hohhot'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Shijiazhuang'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Yinchuan'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Urumqi'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Lhasa'), "temp": "35", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Xining'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Xian'), "temp": "25", "weather": $r('app.string.Sunny') }, { "name": $r('app.string.Lanzhou'), "temp": "25", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Taiyuan'), "temp": "25", "weather": $r('app.string.Cloudy') }, { "name": $r('app.string.Kunming'), "temp": "25", "weather": $r('app.string.Rainy') }, { "name": $r('app.string.Nanning'), "temp": "20", "weather": $r('app.string.Sunny') } ];
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/mock/CityInfo.ets#L16-L127
731a28488dfd4943cabdeaa950b027b67961d0b5
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
arkts
decodeCBC
解密-CBC模式 @param str 加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @returns
static async decodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> { return CryptoUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256); }
AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decodeCBC AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left aesKey AST#expression#Right , AST#expression#Left iv AST#expression#Right , AST#expression#Left 'AES256' AST#expression#Right , AST#expression#Left 'AES256|CBC|PKCS7' AST#expression#Right , AST#expression#Left 256 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async decodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> { return CryptoUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L182-L184
f467eaa8e02066766ee9002259a6323a0fac97e6
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/dataModel/NoticeModel.ets
arkts
Copyright (c) 2024 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 class NoticeModel { id: number; //通知ID uri: ResourceStr; //通知图标 title: ResourceStr; //通知主题 content: ResourceStr; //内容内容 collections: number; //收藏次数 isCollection: boolean; //当前收藏状态 type: number; //通知类型 "系统" | "互动" | "活动" time: string; // 🆕 添加时间字段 isRead: boolean; // 🆕 已读标识 constructor(id: number, uri: ResourceStr, title: ResourceStr, content: ResourceStr, collections: number, isCollection: boolean, type: number,time:string,isRead:boolean) { this.id = id; this.uri = uri; this.title = title; this.content = content; this.collections = collections; this.isCollection = isCollection; this.type = type; this.time=time; this.isRead=isRead; } toString(): string { return this.id.toString() + ' ' + this.title; } }
AST#export_declaration#Left export AST#class_declaration#Left class NoticeModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //通知ID AST#property_declaration#Left uri : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //通知图标 AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //通知主题 AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //内容内容 AST#property_declaration#Left collections : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //收藏次数 AST#property_declaration#Left isCollection : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //当前收藏状态 AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //通知类型 "系统" | "互动" | "活动" AST#property_declaration#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 🆕 添加时间字段 AST#property_declaration#Left isRead : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 🆕 已读标识 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left collections : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isCollection : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isRead : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uri AST#member_expression#Right = AST#expression#Left uri AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . collections AST#member_expression#Right = AST#expression#Left collections AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCollection AST#member_expression#Right = AST#expression#Left isCollection AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . time AST#member_expression#Right = AST#expression#Left time AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRead AST#member_expression#Right = AST#expression#Left isRead AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ' ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class NoticeModel { id: number; uri: ResourceStr; title: ResourceStr; content: ResourceStr; collections: number; isCollection: boolean; type: number; time: string; isRead: boolean; constructor(id: number, uri: ResourceStr, title: ResourceStr, content: ResourceStr, collections: number, isCollection: boolean, type: number,time:string,isRead:boolean) { this.id = id; this.uri = uri; this.title = title; this.content = content; this.collections = collections; this.isCollection = isCollection; this.type = type; this.time=time; this.isRead=isRead; } toString(): string { return this.id.toString() + ' ' + this.title; } }
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/dataModel/NoticeModel.ets#L16-L43
0c4bdfd582dd9b1fdb0c9e2f28601ac85e284b79
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Category.ets
arkts
@file 商品类型 @author Joker.X
export class Category { /** * ID */ id: number = 0; /** * 名称 */ name: string = ""; /** * 父ID */ parentId?: number | null = null; /** * 排序 */ sortNum: number = 0; /** * 图片 */ pic?: string | null = null; /** * 状态 0-禁用 1-启用 */ status: number = 1; /** * 子分类列表 */ children?: Category[] = []; /** * 创建时间 */ createTime?: string | null = null; /** * 更新时间 */ updateTime?: string | null = null; constructor(init?: Partial<Category>) { if (!init) { return; } this.id = init.id ?? this.id; this.name = init.name ?? this.name; this.parentId = init.parentId ?? this.parentId; this.sortNum = init.sortNum ?? this.sortNum; this.pic = init.pic ?? this.pic; this.status = init.status ?? this.status; this.children = init.children ?? this.children; this.createTime = init.createTime ?? this.createTime; this.updateTime = init.updateTime ?? this.updateTime; } }
AST#export_declaration#Left export AST#class_declaration#Left class Category AST#class_body#Left { /** * ID */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * 名称 */ AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right /** * 父ID */ AST#property_declaration#Left parentId ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 排序 */ AST#property_declaration#Left sortNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * 图片 */ AST#property_declaration#Left pic ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 状态 0-禁用 1-启用 */ AST#property_declaration#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * 子分类列表 */ AST#property_declaration#Left children ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 创建时间 */ AST#property_declaration#Left createTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 更新时间 */ AST#property_declaration#Left updateTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Category AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . parentId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . parentId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sortNum AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . sortNum AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sortNum AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pic AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . pic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . pic AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . status AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . status AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . children AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . children AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . children AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . createTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . createTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . updateTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . updateTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Category { id: number = 0; name: string = ""; parentId?: number | null = null; sortNum: number = 0; pic?: string | null = null; status: number = 1; children?: Category[] = []; createTime?: string | null = null; updateTime?: string | null = null; constructor(init?: Partial<Category>) { if (!init) { return; } this.id = init.id ?? this.id; this.name = init.name ?? this.name; this.parentId = init.parentId ?? this.parentId; this.sortNum = init.sortNum ?? this.sortNum; this.pic = init.pic ?? this.pic; this.status = init.status ?? this.status; this.children = init.children ?? this.children; this.createTime = init.createTime ?? this.createTime; this.updateTime = init.updateTime ?? this.updateTime; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Category.ets#L5-L57
07dcd51552d744a56aeed118b69866a573998919
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
initializeNotificationCenter
初始化通知中心
private async initializeNotificationCenter(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Initializing notification center...'); // 如果有今日生日,创建生日通知 if (this.todayBirthdays.length > 0) { for (const contact of this.todayBirthdays) { this.notificationCenterService.createBirthdayNotification(contact); } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Created ${this.todayBirthdays.length} birthday notifications`); } // 如果有即将到来的生日,创建提前提醒通知 if (this.upcomingBirthdays.length > 0 && this.advanceRemindDays > 0) { const upcomingContacts = this.upcomingBirthdays.filter(contact => contact.birthday.daysUntilBirthday !== undefined && contact.birthday.daysUntilBirthday <= this.advanceRemindDays && contact.birthday.daysUntilBirthday > 0 ); if (upcomingContacts.length > 0) { // 按天数分组创建通知 const groupedByDays = new Map<number, Contact[]>(); upcomingContacts.forEach(contact => { const days = contact.birthday.daysUntilBirthday!; if (!groupedByDays.has(days)) { groupedByDays.set(days, []); } groupedByDays.get(days)!.push(contact); }); groupedByDays.forEach((contacts, days) => { this.notificationCenterService.createUpcomingBirthdayNotification(contacts, days); }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Created upcoming birthday notifications for ${upcomingContacts.length} contacts`); } } // 创建欢迎AI建议通知 if (this.allContacts.length > 0) { const hasLunarContacts = this.allContacts.some(contact => contact.birthday.isLunar); if (hasLunarContacts) { this.notificationCenterService.createAISuggestionNotification( '检测到您有农历生日联系人,建议开启农历提醒功能以获得更准确的生日提醒。', this.createLunarMetadata(this.allContacts.length) ); } } // 加载通知数据到UI await this.loadNotificationData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Notification center initialized successfully'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Failed to initialize notification center: ${error}`); } }
AST#method_declaration#Left private async initializeNotificationCenter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left '[TestSimple] Initializing notification center...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果有今日生日,创建生日通知 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todayBirthdays AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const contact of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todayBirthdays AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notificationCenterService AST#member_expression#Right AST#expression#Right . createBirthdayNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TestSimple] Created AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todayBirthdays AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right birthday notifications ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 如果有即将到来的生日,创建提前提醒通知 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . upcomingBirthdays AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . advanceRemindDays AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left upcomingContacts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . upcomingBirthdays AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left contact => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . daysUntilBirthday AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left contact AST#expression#Right AST#binary_expression#Right AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . daysUntilBirthday AST#member_expression#Right AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . advanceRemindDays AST#member_expression#Right AST#expression#Right && AST#expression#Left contact AST#expression#Right AST#binary_expression#Right AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . daysUntilBirthday AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left upcomingContacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 按天数分组创建通知 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left groupedByDays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left upcomingContacts AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left contact => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left days = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . daysUntilBirthday AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left groupedByDays AST#expression#Right AST#unary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left days AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedByDays AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left days AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedByDays AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left days AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedByDays AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contacts AST#parameter#Right , AST#parameter#Left days AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notificationCenterService AST#member_expression#Right AST#expression#Right . createUpcomingBirthdayNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left days AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TestSimple] Created upcoming birthday notifications for AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left upcomingContacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right contacts ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 创建欢迎AI建议通知 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allContacts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hasLunarContacts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allContacts AST#member_expression#Right AST#expression#Right . some AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left contact => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . isLunar AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left hasLunarContacts AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notificationCenterService AST#member_expression#Right AST#expression#Right . createAISuggestionNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '检测到您有农历生日联系人,建议开启农历提醒功能以获得更准确的生日提醒。' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createLunarMetadata AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allContacts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 加载通知数据到UI AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . loadNotificationData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left '[TestSimple] Notification center initialized successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TestSimple] Failed to initialize notification center: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async initializeNotificationCenter(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Initializing notification center...'); if (this.todayBirthdays.length > 0) { for (const contact of this.todayBirthdays) { this.notificationCenterService.createBirthdayNotification(contact); } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Created ${this.todayBirthdays.length} birthday notifications`); } if (this.upcomingBirthdays.length > 0 && this.advanceRemindDays > 0) { const upcomingContacts = this.upcomingBirthdays.filter(contact => contact.birthday.daysUntilBirthday !== undefined && contact.birthday.daysUntilBirthday <= this.advanceRemindDays && contact.birthday.daysUntilBirthday > 0 ); if (upcomingContacts.length > 0) { const groupedByDays = new Map<number, Contact[]>(); upcomingContacts.forEach(contact => { const days = contact.birthday.daysUntilBirthday!; if (!groupedByDays.has(days)) { groupedByDays.set(days, []); } groupedByDays.get(days)!.push(contact); }); groupedByDays.forEach((contacts, days) => { this.notificationCenterService.createUpcomingBirthdayNotification(contacts, days); }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Created upcoming birthday notifications for ${upcomingContacts.length} contacts`); } } if (this.allContacts.length > 0) { const hasLunarContacts = this.allContacts.some(contact => contact.birthday.isLunar); if (hasLunarContacts) { this.notificationCenterService.createAISuggestionNotification( '检测到您有农历生日联系人,建议开启农历提醒功能以获得更准确的生日提醒。', this.createLunarMetadata(this.allContacts.length) ); } } await this.loadNotificationData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Notification center initialized successfully'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TestSimple] Failed to initialize notification center: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L850-L907
6471c68b209e68cc5e656cd9db86adda7ed6bd2f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/EncourageManager.ets
arkts
clearOldDatas
清空旧日期的数据,只保留今天的(对应Swift的clearOldDatas) 清空旧日期的数据,只保留今天的
private clearOldDatas(): void { const prefs = this.getPrefs(); const dict = prefs.getAllSync() as Record<string, number>; const newDict: Record<string, number> = {}; // 只保留今天的数据 EncourageTypeHelper.allCases().forEach((type: EncourageType) => { const key = EncourageTypeHelper.getKeyWithToday(type); const val = dict[key]; if (val !== undefined && val !== null) { newDict[key] = val; } }); // 重写存储:先删除所有数据,再写入新数据 Object.keys(dict).forEach((key: string) => { prefs.deleteSync(key); }); // 修复:使用Object.keys遍历,通过key访问value Object.keys(newDict).forEach((key: string) => { const value = newDict[key]; // 通过key获取对应的value prefs.putSync(key, value); }); prefs.flushSync(); }
AST#method_declaration#Left private clearOldDatas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left prefs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getPrefs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dict = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . getAllSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newDict : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 只保留今天的数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageTypeHelper AST#expression#Right . allCases AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left EncourageType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EncourageTypeHelper AST#expression#Right . getKeyWithToday AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left val = AST#expression#Left AST#subscript_expression#Left AST#expression#Left dict AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left newDict AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = val AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 重写存储:先删除所有数据,再写入新数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dict AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . deleteSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 修复:使用Object.keys遍历,通过key访问value AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newDict AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left value = AST#expression#Left AST#subscript_expression#Left AST#expression#Left newDict AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过key获取对应的value AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . putSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . flushSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private clearOldDatas(): void { const prefs = this.getPrefs(); const dict = prefs.getAllSync() as Record<string, number>; const newDict: Record<string, number> = {}; EncourageTypeHelper.allCases().forEach((type: EncourageType) => { const key = EncourageTypeHelper.getKeyWithToday(type); const val = dict[key]; if (val !== undefined && val !== null) { newDict[key] = val; } }); Object.keys(dict).forEach((key: string) => { prefs.deleteSync(key); }); Object.keys(newDict).forEach((key: string) => { const value = newDict[key]; prefs.putSync(key, value); }); prefs.flushSync(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L121-L148
b2c23aea5f98d92dbbcde8fba1e3f51abc449c77
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets
arkts
decryptCBC
解密(CBC模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @returns
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7'); }
AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7'); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L97-L100
4c9739c461753078dfcc7704ec3267f146ece7b5
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets
arkts
Get Module List Data in Stack
export function getStackModuleList(): Array<ContainerModuleItem> { let stackModuleArray: Array<ContainerModuleItem> = [] STACK_MODULE.forEach((item:ContainerModuleItem) => { stackModuleArray.push(item); }) return stackModuleArray; }
AST#export_declaration#Left export AST#function_declaration#Left function getStackModuleList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left stackModuleArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left STACK_MODULE AST#ERROR#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stackModuleArray AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left stackModuleArray AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getStackModuleList(): Array<ContainerModuleItem> { let stackModuleArray: Array<ContainerModuleItem> = [] STACK_MODULE.forEach((item:ContainerModuleItem) => { stackModuleArray.push(item); }) return stackModuleArray; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets#L55-L61
7813ec15c0bc0212d3b9ba44caac3fa2c29d8aa2
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
updateData
更新数据函数
public updateData(index: number, data: IChatMessage): void { if (this.originDataArray.length <= index) { this.originDataArray.push(data); } else { this.originDataArray[index].roleType = data.roleType; this.originDataArray[index].name = data.name; this.originDataArray[index].content = data.content; this.originDataArray[index].picurl = data.picurl; } this.notifyDataChange(index); }
AST#method_declaration#Left public updateData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right <= AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . roleType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . roleType AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . content AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . picurl AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . picurl AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public updateData(index: number, data: IChatMessage): void { if (this.originDataArray.length <= index) { this.originDataArray.push(data); } else { this.originDataArray[index].roleType = data.roleType; this.originDataArray[index].name = data.name; this.originDataArray[index].content = data.content; this.originDataArray[index].picurl = data.picurl; } this.notifyDataChange(index); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L27-L37
784b09d656f21fc08d0b9cd31b0ad7e2b128fa58
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets
arkts
getNextPlanId
====== 查询操作 ======
async getNextPlanId(): Promise<number> { const maxId = await this.db?.getMax(Tables.Plan.Col.planId, Tables.Plan.name); return (maxId != null ? maxId + 1 : 1); }
AST#method_declaration#Left async getNextPlanId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right ?. getMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Plan AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Plan AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left maxId AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left maxId AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getNextPlanId(): Promise<number> { const maxId = await this.db?.getMax(Tables.Plan.Col.planId, Tables.Plan.name); return (maxId != null ? maxId + 1 : 1); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L199-L202
aab2ad53c9dd8fdac5d1c5a602d717a4d774f972
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesListener.ets
arkts
Preferences listener interface.
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesListener.ets#L19-L19
13e7b79c88f1c4d402b08976f8f8cd4ad942e891
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/ChatTools.ets
arkts
hideSoftInputMethod
收起软键盘。 @param context 上下文对象
static hideSoftInputMethod(context: UIContext) { context.getFocusController().clearFocus(); }
AST#method_declaration#Left static hideSoftInputMethod AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . getFocusController AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clearFocus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static hideSoftInputMethod(context: UIContext) { context.getFocusController().clearFocus(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L54-L56
0f1cdfca548567892b3130a402d398e37090e69a
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
工作模式枚举
export enum WorkMode { ONSITE = 'onsite', // 现场办公 REMOTE = 'remote', // 远程办公 HYBRID = 'hybrid' // 混合办公 }
AST#export_declaration#Left export AST#enum_declaration#Left enum WorkMode AST#enum_body#Left { AST#enum_member#Left ONSITE = AST#expression#Left 'onsite' AST#expression#Right AST#enum_member#Right , // 现场办公 AST#enum_member#Left REMOTE = AST#expression#Left 'remote' AST#expression#Right AST#enum_member#Right , // 远程办公 AST#enum_member#Left HYBRID = AST#expression#Left 'hybrid' AST#expression#Right AST#enum_member#Right // 混合办公 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum WorkMode { ONSITE = 'onsite', REMOTE = 'remote', HYBRID = 'hybrid' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L25-L29
55ec8682ed07c815632a9b29636b43af233caf11
github
azhuge233/Wake-HarmonyOS.git
68c4e961f9cf5fab8699af99313dd5854ea313a1
entry/src/main/ets/pages/Index.ets
arkts
goToSpecifyPage
快捷方式跳转判断
private async goToSpecifyPage(path: string): Promise<void> { // 如果应用内已经进入其他页面,返回到主页面 if(this.pageStack.size() > 0) this.pageStack.clear(); try { Logger.debug(this.LOG_TAG, `跳转至页面 ${path}`); this.pageStack.pushPath({ name: path, param: this.deviceList, onPop: async (popInfo) => { await this.refreshIPBanner(); CommonUtils.returnFromSubPage(popInfo); } }); } catch (err) { Logger.error(this.LOG_TAG, `${path} 页面跳转失败, ${err}`); } }
AST#method_declaration#Left private async goToSpecifyPage AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果应用内已经进入其他页面,返回到主页面 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageStack AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageStack AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 跳转至页面 AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageStack AST#member_expression#Right AST#expression#Right . pushPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left path AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left param AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deviceList AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onPop AST#property_name#Right : AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left popInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . refreshIPBanner AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonUtils AST#expression#Right . returnFromSubPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left popInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right 页面跳转失败, AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async goToSpecifyPage(path: string): Promise<void> { if(this.pageStack.size() > 0) this.pageStack.clear(); try { Logger.debug(this.LOG_TAG, `跳转至页面 ${path}`); this.pageStack.pushPath({ name: path, param: this.deviceList, onPop: async (popInfo) => { await this.refreshIPBanner(); CommonUtils.returnFromSubPage(popInfo); } }); } catch (err) { Logger.error(this.LOG_TAG, `${path} 页面跳转失败, ${err}`); } }
https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/pages/Index.ets#L78-L95
7fcb91fbd7b008e8edce517f64acdec2ef05e314
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets
arkts
getCheckBoxUnClickImage
多选-未点击提交答案按钮时的图标展示 @param option 当前选项 @param selected 已选择的选项集合 @returns 对应图标
function getCheckBoxUnClickImage(option: string, selected: Array<string>): ResourceStr { if (selected.includes(option)) { return $r('app.media.checkbox_select'); } return $r('app.media.no_select'); }
AST#function_declaration#Left function getCheckBoxUnClickImage AST#parameter_list#Left ( AST#parameter#Left option : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left selected : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selected AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left option AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.checkbox_select' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.no_select' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function getCheckBoxUnClickImage(option: string, selected: Array<string>): ResourceStr { if (selected.includes(option)) { return $r('app.media.checkbox_select'); } return $r('app.media.no_select'); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets#L378-L383
a4d0cf233c0365ce7940384cd6c3d1dfc8e0eb89
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CouponRepository.ets
arkts
@file 优惠券仓库,封装优惠券相关请求 @author Joker.X
export class CouponRepository { /** * 优惠券网络数据源 */ private networkDataSource: CouponNetworkDataSource; /** * 构造函数 * @param networkDataSource 可选的数据源实例,便于注入测试替身 */ constructor(networkDataSource?: CouponNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CouponNetworkDataSourceImpl(); } /** * 领取优惠券 * @param request 领取请求参数 * @returns 领取结果 */ async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> { return this.networkDataSource.receiveCoupon(request); } /** * 分页查询用户优惠券 * @param params 分页查询参数 * @returns 用户优惠券分页数据 */ async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> { return this.networkDataSource.getUserCouponPage(params); } /** * 查询用户优惠券列表 * @param params 查询参数 * @returns 用户优惠券列表数据 */ async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { return this.networkDataSource.getUserCouponList(params); } }
AST#export_declaration#Left export AST#class_declaration#Left class CouponRepository AST#class_body#Left { /** * 优惠券网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left CouponNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 构造函数 * @param networkDataSource 可选的数据源实例,便于注入测试替身 */ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left CouponNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left networkDataSource AST#expression#Right ?? AST#expression#Left AST#new_expression#Left new AST#expression#Left CouponNetworkDataSourceImpl AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * 领取优惠券 * @param request 领取请求参数 * @returns 领取结果 */ AST#method_declaration#Left async receiveCoupon AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left ReceiveCouponRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . receiveCoupon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left request AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 分页查询用户优惠券 * @param params 分页查询参数 * @returns 用户优惠券分页数据 */ AST#method_declaration#Left async getUserCouponPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Coupon AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getUserCouponPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 查询用户优惠券列表 * @param params 查询参数 * @returns 用户优惠券列表数据 */ AST#method_declaration#Left async getUserCouponList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Coupon [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getUserCouponList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CouponRepository { private networkDataSource: CouponNetworkDataSource; constructor(networkDataSource?: CouponNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CouponNetworkDataSourceImpl(); } async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> { return this.networkDataSource.receiveCoupon(request); } async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> { return this.networkDataSource.getUserCouponPage(params); } async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { return this.networkDataSource.getUserCouponList(params); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CouponRepository.ets#L15-L55
135b8b813db8c3dc2e915d573e48fcfa5089afac
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseEntry.ets
arkts
getIcon
Returns the icon of this Entry. @return
public getIcon(): ChartPixelMap | null { return this.mIcon; }
AST#method_declaration#Left public getIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIcon AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getIcon(): ChartPixelMap | null { return this.mIcon; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L61-L63
8279c58f770c4abfc73095fb023c195ecd1e72a0
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets
arkts
应用约束61:使用ES模块语法代替module.exports
export default PartialGuild;
AST#export_declaration#Left export default AST#expression#Left PartialGuild AST#expression#Right ; AST#export_declaration#Right
export default PartialGuild;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets#L45-L45
4cdebb66cdcfcac3e865f48d404a325f02f45d9f
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
arkts
getDaysBetweenDates
获取总天数 返回dayDiff(注册总天数)
function getDaysBetweenDates(date1: string, date2: string): number { // 将日期字符串转换为Date对象(支持格式:"YYYY-MM-DD"、"YYYY/MM/DD"等) const d1 = new Date(date1); const d2 = new Date(date2); // 检查日期是否有效 if (isNaN(d1.getTime()) || isNaN(d2.getTime())) { throw new Error("无效的日期格式"); } // 计算时间差(毫秒),取绝对值 const timeDiff = Math.abs(d1.getTime() - d2.getTime()); // 转换为天数(1天 = 86400000毫秒),向下取整 const dayDiff = Math.floor(timeDiff / 86400000); return dayDiff; }
AST#function_declaration#Left function getDaysBetweenDates AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 将日期字符串转换为Date对象(支持格式:"YYYY-MM-DD"、"YYYY/MM/DD"等) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left d1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left d2 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查日期是否有效 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left d1 AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left isNaN AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left d2 AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "无效的日期格式" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 计算时间差(毫秒),取绝对值 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeDiff = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left d1 AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left d2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 转换为天数(1天 = 86400000毫秒),向下取整 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dayDiff = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left timeDiff AST#expression#Right / AST#expression#Left 86400000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left dayDiff AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function getDaysBetweenDates(date1: string, date2: string): number { const d1 = new Date(date1); const d2 = new Date(date2); if (isNaN(d1.getTime()) || isNaN(d2.getTime())) { throw new Error("无效的日期格式"); } const timeDiff = Math.abs(d1.getTime() - d2.getTime()); const dayDiff = Math.floor(timeDiff / 86400000); return dayDiff; }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L47-L64
f9b34c0dc185ad736313c5ce2ec287df392d770c
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/NetConnectionUtils.ets
arkts
unregister
取消订阅默认网络状态变化的通知。
static unregister() { if (NetConnectionUtils.netConnection) { NetConnectionUtils.netConnection.unregister((error: BusinessError) => { if (error) { LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`); } }); } }
AST#method_declaration#Left static unregister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NetConnectionUtils AST#expression#Right . netConnection AST#member_expression#Right AST#expression#Right . unregister AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left error AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtils AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NetworkUtil-' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` unregister-异常 ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
static unregister() { if (NetConnectionUtils.netConnection) { NetConnectionUtils.netConnection.unregister((error: BusinessError) => { if (error) { LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`); } }); } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L118-L126
1fb32ee9c3c2f4b57313f6a3f4f7b4d142c1932f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/data/ViewItem.ets
arkts
瀑布流子组件数据结构
export class ViewItem { id: string = ''; // 名字 name: string = ''; // 描述 des: string = ''; // 类型 type: number = 0; // 封面图片 image: string | Resource = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class ViewItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 名字 AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 描述 AST#property_declaration#Left des : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 类型 AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 封面图片 AST#property_declaration#Left image : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ViewItem { id: string = ''; name: string = ''; des: string = ''; type: number = 0; image: string | Resource = ''; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/data/ViewItem.ets#L17-L27
1560a7cdaa65268acea40c117a7c00a60c7ef479
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/KMP.ets
arkts
countMatches
计算模式串在文本中的出现次数 @param text 文本字符串 @param pattern 模式串 @returns 出现次数
static countMatches(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return 0; } const matches = KMP.findAllMatches(text, pattern); return matches.length; }
AST#method_declaration#Left static countMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left pattern AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left pattern AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left matches = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left KMP AST#expression#Right . findAllMatches AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right , AST#expression#Left pattern AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left matches AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static countMatches(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return 0; } const matches = KMP.findAllMatches(text, pattern); return matches.length; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L227-L234
5183c45610e6061c4c7ff081c894596c97614b85
github
jiwangyihao/FlameChase.git
446275e6972bd5f92a3c5b7eba354ca83d504594
entry/src/main/ets/pages/ChroniclePage.ets
arkts
aboutToAppear
aboutToAppear 生命周期钩子,在组件即将显示时执行一次
aboutToAppear() { // 初始化时,根据当前日期设置显示的字符串 this.currentDate = this.getFormattedDate(this.displayDate); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 初始化时,根据当前日期设置显示的字符串 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentDate AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFormattedDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayDate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() { this.currentDate = this.getFormattedDate(this.displayDate); }
https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/pages/ChroniclePage.ets#L518-L521
643305b5bf7c0c2e6fbb3f125a0a92a6cfd091bd
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/WebCookie/entry/src/main/ets/common/utils/DialogUtil.ets
arkts
Pop up a message box. @param message Message.
export function showDialog(message: ResourceStr) { let newMessage = message.toString(); if (newMessage.length > CommonConstants.SUB_LENGTH) { message = newMessage.substring(0, CommonConstants.SUB_LENGTH); } AlertDialog.show( { title: $r('app.string.dialog_message'), message: message, confirm: { value: $r('app.string.button_confirm'), action: () => { Logger.info('Button-clicking callback'); } }, cancel: () => { Logger.info('Closed callbacks'); } } ) }
AST#export_declaration#Left export AST#function_declaration#Left function showDialog AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newMessage AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUB_LENGTH AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newMessage AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SUB_LENGTH AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.dialog_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left confirm AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.button_confirm' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Button-clicking callback' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cancel AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Closed callbacks' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function showDialog(message: ResourceStr) { let newMessage = message.toString(); if (newMessage.length > CommonConstants.SUB_LENGTH) { message = newMessage.substring(0, CommonConstants.SUB_LENGTH); } AlertDialog.show( { title: $r('app.string.dialog_message'), message: message, confirm: { value: $r('app.string.button_confirm'), action: () => { Logger.info('Button-clicking callback'); } }, cancel: () => { Logger.info('Closed callbacks'); } } ) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebCookie/entry/src/main/ets/common/utils/DialogUtil.ets#L24-L44
2fc519097f7b0971771aa8bbbd3da1d4d0f23de0
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
checkCamera
检查摄像头连接
static async checkCamera(): Promise<CheckResult> { try { console.info('[SystemCheckService] 开始检查摄像头连接'); const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_CAM); console.info('[SystemCheckService] 摄像头检查响应:', JSON.stringify(response)); return { success: response.code === 200, message: response.msg, errorCode: response.code }; } catch (error) { console.error('[SystemCheckService] 摄像头检查异常:', error); return { success: false, message: '摄像头连接检查失败', errorCode: -1 }; } }
AST#method_declaration#Left static async checkCamera AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CheckResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SystemCheckService] 开始检查摄像头连接' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left HttpUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . API AST#member_expression#Right AST#expression#Right . SYSTEM_CHECK_CAM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SystemCheckService] 摄像头检查响应:' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . msg AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SystemCheckService] 摄像头检查异常:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '摄像头连接检查失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCode AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async checkCamera(): Promise<CheckResult> { try { console.info('[SystemCheckService] 开始检查摄像头连接'); const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_CAM); console.info('[SystemCheckService] 摄像头检查响应:', JSON.stringify(response)); return { success: response.code === 200, message: response.msg, errorCode: response.code }; } catch (error) { console.error('[SystemCheckService] 摄像头检查异常:', error); return { success: false, message: '摄像头连接检查失败', errorCode: -1 }; } }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L95-L113
813d89a08c1f7fba7a33962b5033eb48df4e86d5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
deleteBackup
根据指定名称删除备份文件 @param files 删除备份文件所指定的名称 @returns
static async deleteBackup(files: Array<string>): Promise<Array<[string, number]>> { let kvStore = await KvUtil.getKvStore(); return kvStore.deleteBackup(files); }
AST#method_declaration#Left static async deleteBackup AST#parameter_list#Left ( AST#parameter#Left files : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left kvStore = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left KvUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getKvStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left kvStore AST#expression#Right . deleteBackup AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left files AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async deleteBackup(files: Array<string>): Promise<Array<[string, number]>> { let kvStore = await KvUtil.getKvStore(); return kvStore.deleteBackup(files); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L189-L192
807e36cdaa659557286b55b57f5b0c29479fb854
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/auth/UserSessionManager.ets
arkts
表示用户信息是否已加载完成
constructor() { this.personModelLoaded = new Promise(resolve => { this.personModelReady = resolve; }); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . personModelLoaded AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left resolve => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . personModelReady AST#member_expression#Right = AST#expression#Left resolve AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor() { this.personModelLoaded = new Promise(resolve => { this.personModelReady = resolve; }); }
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/auth/UserSessionManager.ets#L17-L21
bad0a2c693afc4004d77076270beee310f422693
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/AgvMovementService.ets
arkts
isOnline
检查AGV是否在线 @returns 在线状态
static async isOnline(): Promise<boolean> { try { const heartbeatResult = await AgvMovementService.heartbeat(); return heartbeatResult.success; } catch (error) { console.error('[AgvMovementService] ❌ 检查AGV在线状态失败:', error); return false; } }
AST#method_declaration#Left static async isOnline AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left heartbeatResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AgvMovementService AST#expression#Right AST#await_expression#Right AST#expression#Right . heartbeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left heartbeatResult AST#expression#Right . success AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[AgvMovementService] ❌ 检查AGV在线状态失败:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async isOnline(): Promise<boolean> { try { const heartbeatResult = await AgvMovementService.heartbeat(); return heartbeatResult.success; } catch (error) { console.error('[AgvMovementService] ❌ 检查AGV在线状态失败:', error); return false; } }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L156-L164
b6d95f1f21cb4abe447e773bf37ec1d9b4b9871e
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets
arkts
Waterfall sub component WrappedBuilder object
export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder);
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left flowItemWrapper : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left flowItemBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder);
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets#L26-L26
aec5d5dc0be8b9c46123b5e989d4f80d19e3898a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets
arkts
好友数据结构
export interface PersonData { wid: string; // 用户wid headImg: ResourceStr | image.PixelMap // 头像 name: string // 用户昵称 }
AST#export_declaration#Left export AST#interface_declaration#Left interface PersonData AST#object_type#Left { AST#type_member#Left wid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 用户wid AST#type_member#Left headImg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right // 头像 AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 用户昵称 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PersonData { wid: string; headImg: ResourceStr | image.PixelMap name: string }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets#L29-L33
ce8612ac3708330a74ee4613340aac2aec7b498c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/greeting/GreetingService.ets
arkts
createGreeting
创建祝福语 @param params 创建参数 @returns 创建的祝福语
async createGreeting(params: CreateGreetingParams): Promise<Greeting> { try { // 验证数据 const validationResult = this.validateGreetingParams(params); if (!validationResult.isValid) { throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`); } // 检查祝福语数量限制 const totalCount = await this.databaseService.count(StorageConstants.TABLE_GREETINGS); if (totalCount >= BusinessConstants.MAX_GREETINGS) { throw new Error(`祝福语数量已达到上限 ${BusinessConstants.MAX_GREETINGS}`); } // 创建祝福语对象 const greeting: Greeting = { id: `greeting_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, content: params.content.trim(), style: params.style, occasion: params.occasion, language: params.language || GreetingLanguage.ZH_CN, tags: params.tags || [], isCustom: params.isCustom !== false, // 默认为自定义 usageCount: 0, rating: 0, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }; // 转换数据格式用于数据库存储 const dbData = this.greetingToDbData(greeting); // 插入数据库 await this.databaseService.insert(StorageConstants.TABLE_GREETINGS, dbData); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Greeting created: ${greeting.id}`); return greeting; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create greeting: ${businessError.message}`); throw businessError; } }
AST#method_declaration#Left async createGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateGreetingParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 验证数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left validationResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . validateGreetingParams AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left validationResult AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 数据验证失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left validationResult AST#expression#Right . errors AST#member_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ', ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 检查祝福语数量限制 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalCount = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . databaseService AST#member_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_GREETINGS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left totalCount AST#expression#Right >= AST#expression#Left BusinessConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAX_GREETINGS AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 祝福语数量已达到上限 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left BusinessConstants AST#expression#Right . MAX_GREETINGS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 创建祝福语对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` greeting_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 36 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . substr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left 9 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . content AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . style AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . occasion AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left language AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . language AST#member_expression#Right AST#expression#Right || AST#expression#Left GreetingLanguage AST#expression#Right AST#binary_expression#Right AST#expression#Right . ZH_CN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left tags AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . tags AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isCustom AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . isCustom AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , // 默认为自定义 AST#property_assignment#Left AST#property_name#Left usageCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left rating AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left createdAt AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updatedAt AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 转换数据格式用于数据库存储 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . greetingToDbData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greeting AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 插入数据库 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . databaseService AST#member_expression#Right AST#expression#Right . insert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_GREETINGS AST#member_expression#Right AST#expression#Right , AST#expression#Left dbData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Greeting created: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left greeting AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to create greeting: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left businessError AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async createGreeting(params: CreateGreetingParams): Promise<Greeting> { try { const validationResult = this.validateGreetingParams(params); if (!validationResult.isValid) { throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`); } const totalCount = await this.databaseService.count(StorageConstants.TABLE_GREETINGS); if (totalCount >= BusinessConstants.MAX_GREETINGS) { throw new Error(`祝福语数量已达到上限 ${BusinessConstants.MAX_GREETINGS}`); } const greeting: Greeting = { id: `greeting_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, content: params.content.trim(), style: params.style, occasion: params.occasion, language: params.language || GreetingLanguage.ZH_CN, tags: params.tags || [], isCustom: params.isCustom !== false, usageCount: 0, rating: 0, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }; const dbData = this.greetingToDbData(greeting); await this.databaseService.insert(StorageConstants.TABLE_GREETINGS, dbData); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Greeting created: ${greeting.id}`); return greeting; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create greeting: ${businessError.message}`); throw businessError; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/greeting/GreetingService.ets#L58-L100
d1256e478226098ac1a4900d37d2b3e1fc31c763
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets
arkts
@file 用户信息相关数据源接口 @author Joker.X
export interface UserInfoNetworkDataSource { /** * 更新用户个人信息 * @param params 用户信息参数 * @returns 更新结果响应 */ updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; /** * 更新用户密码 * @param params 密码参数 * @returns 更新结果响应 */ updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>>; /** * 注销账号 * @param params 注销参数 * @returns 注销结果响应 */ logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; /** * 绑定手机号 * @param params 绑定参数 * @returns 绑定结果响应 */ bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>>; /** * 获取用户个人信息 * @returns 用户信息响应 */ getPersonInfo(): Promise<NetworkResponse<User>>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfoNetworkDataSource AST#object_type#Left { /** * 更新用户个人信息 * @param params 用户信息参数 * @returns 更新结果响应 */ AST#type_member#Left updatePersonInfo AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 更新用户密码 * @param params 密码参数 * @returns 更新结果响应 */ AST#type_member#Left updatePassword AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 注销账号 * @param params 注销参数 * @returns 注销结果响应 */ AST#type_member#Left logoff AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 绑定手机号 * @param params 绑定参数 * @returns 绑定结果响应 */ AST#type_member#Left bindPhone AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 获取用户个人信息 * @returns 用户信息响应 */ AST#type_member#Left getPersonInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface UserInfoNetworkDataSource { updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>>; logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>>; getPersonInfo(): Promise<NetworkResponse<User>>; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets#L7-L41
f8f5ef483b5c696b7a8d389a3b2142b0b461bee9
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AppUtils.ets
arkts
getBundleInfoSync
获取当前应用的BundleInfo
static getBundleInfoSync(): bundleManager.BundleInfo { const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ROUTER_MAP | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_MENU | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SKILL | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_DISABLE; return bundleManager.getBundleInfoForSelfSync(bundleFlags) }
AST#method_declaration#Left static getBundleInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bundleFlags = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_ABILITY AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_HAP_MODULE AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_METADATA AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_SIGNATURE_INFO AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_ROUTER_MAP AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_MENU AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_SKILL AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_DISABLE AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . getBundleInfoForSelfSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleFlags AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getBundleInfoSync(): bundleManager.BundleInfo { const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ROUTER_MAP | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_MENU | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SKILL | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_DISABLE; return bundleManager.getBundleInfoForSelfSync(bundleFlags) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L77-L90
9834fce4e22872612b296c940884d8d09456be7b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/PagesRouter/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The index page message. */ static readonly INDEX_MESSAGE: string = 'Index Page'; /** * The src msg. */ static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; /** * The second page url. */ static readonly SECOND_URL: string = 'pages/SecondPage'; /** * The second page message. */ static readonly SECOND_MESSAGE: string = 'Second Page'; /** * The src param. */ static readonly SECOND_SRC_PARAM: string = 'src'; /** * Full the width. */ static readonly FULL_WIDTH: string = '100%'; /** * Full the height. */ static readonly FULL_HEIGHT: string = '100%'; /** * The hello world font size. */ static readonly FONT_SIZE: string = '38fp'; /** * The param font size. */ static readonly PARAMS_FONT_SIZE: string = '20fp'; /** * The button font size. */ static readonly BUTTON_FONT_SIZE: string = '16fp'; /** * The button width. */ static readonly BUTTON_WIDTH: string = '296vp'; /** * The button height. */ static readonly BUTTON_HEIGHT: string = '40vp'; /** * The layout height. */ static readonly LAYOUT_HEIGHT: string = '140vp'; /** * The param opacity. */ static readonly PARAMS_OPACITY: number = 0.6; }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The index page message. */ AST#property_declaration#Left static readonly INDEX_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Index Page' AST#expression#Right ; AST#property_declaration#Right /** * The src msg. */ AST#property_declaration#Left static readonly SECOND_SRC_MSG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Index页面传来的数据' AST#expression#Right ; AST#property_declaration#Right /** * The second page url. */ AST#property_declaration#Left static readonly SECOND_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/SecondPage' AST#expression#Right ; AST#property_declaration#Right /** * The second page message. */ AST#property_declaration#Left static readonly SECOND_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Second Page' AST#expression#Right ; AST#property_declaration#Right /** * The src param. */ AST#property_declaration#Left static readonly SECOND_SRC_PARAM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'src' AST#expression#Right ; AST#property_declaration#Right /** * Full the width. */ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Full the height. */ AST#property_declaration#Left static readonly FULL_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * The hello world font size. */ AST#property_declaration#Left static readonly FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '38fp' AST#expression#Right ; AST#property_declaration#Right /** * The param font size. */ AST#property_declaration#Left static readonly PARAMS_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '20fp' AST#expression#Right ; AST#property_declaration#Right /** * The button font size. */ AST#property_declaration#Left static readonly BUTTON_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16fp' AST#expression#Right ; AST#property_declaration#Right /** * The button width. */ AST#property_declaration#Left static readonly BUTTON_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '296vp' AST#expression#Right ; AST#property_declaration#Right /** * The button height. */ AST#property_declaration#Left static readonly BUTTON_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40vp' AST#expression#Right ; AST#property_declaration#Right /** * The layout height. */ AST#property_declaration#Left static readonly LAYOUT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '140vp' AST#expression#Right ; AST#property_declaration#Right /** * The param opacity. */ AST#property_declaration#Left static readonly PARAMS_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.6 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class CommonConstants { static readonly INDEX_MESSAGE: string = 'Index Page'; static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; static readonly SECOND_URL: string = 'pages/SecondPage'; static readonly SECOND_MESSAGE: string = 'Second Page'; static readonly SECOND_SRC_PARAM: string = 'src'; static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; static readonly FONT_SIZE: string = '38fp'; static readonly PARAMS_FONT_SIZE: string = '20fp'; static readonly BUTTON_FONT_SIZE: string = '16fp'; static readonly BUTTON_WIDTH: string = '296vp'; static readonly BUTTON_HEIGHT: string = '40vp'; static readonly LAYOUT_HEIGHT: string = '140vp'; static readonly PARAMS_OPACITY: number = 0.6; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/PagesRouter/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L89
329ffaa77a0292e0e89b0d860fc45e5dc76bedb9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isNumber
判断是否是Number类型
static isNumber(value: Any): boolean { return typeof value === 'number'; }
AST#method_declaration#Left static isNumber AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isNumber(value: Any): boolean { return typeof value === 'number'; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L40-L42
b087856409142be688b18ca27f0193a8d9ec7735
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/index.ets
arkts
GameDB
class
export { GameDB }
AST#export_declaration#Left export { GameDB } AST#export_declaration#Right
export { GameDB }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/index.ets#L15-L17
0d99985ea87b8884a2816d933daed65b860679ff
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets
arkts
MARK: - CMetaInfo 等价 ArkTS 实现
export class CMetaInfo { fileName : string | null = null; // fullFileName: "Book.sqlite.zip", "hsk_1.jpg" sizeInBytes : number | null = null; // 多少M updateDate : string | null = null; // 更新日期 constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null) { this.fileName = fileName; this.sizeInBytes = sizeInBytes; this.updateDate = updateDate; } // 等价于 Swift 的 == 运算符 static equals(lhs: CMetaInfo, rhs: CMetaInfo): boolean { return lhs.fileName === rhs.fileName; } /// 获取纯主文件名(第一个点之前的内容) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book" get baseName(): string | null { return this.fileName !== null ? CMetaInfoHelper.baseName(this.fileName) : null; } /// 获取主名+第一层扩展名(去除最外层扩展) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book.sqlite" get baseNameWithInnerExtension(): string | null { return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null; } }
AST#export_declaration#Left export AST#class_declaration#Left class CMetaInfo AST#class_body#Left { AST#property_declaration#Left fileName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // fullFileName: "Book.sqlite.zip", "hsk_1.jpg" AST#property_declaration#Left sizeInBytes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 多少M AST#property_declaration#Left updateDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 更新日期 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left sizeInBytes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left updateDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right = AST#expression#Left fileName AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeInBytes AST#member_expression#Right = AST#expression#Left sizeInBytes AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateDate AST#member_expression#Right = AST#expression#Left updateDate AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // 等价于 Swift 的 == 运算符 AST#method_declaration#Left static equals AST#parameter_list#Left ( AST#parameter#Left lhs : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rhs : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lhs AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right === AST#expression#Left rhs AST#expression#Right AST#binary_expression#Right AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /// 获取纯主文件名(第一个点之前的内容) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book" AST#method_declaration#Left get AST#ERROR#Left b as eName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CMetaInfoHelper AST#expression#Right . baseName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /// 获取主名+第一层扩展名(去除最外层扩展) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book.sqlite" AST#method_declaration#Left get AST#ERROR#Left b as eNameWithInnerExtension AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CMetaInfoHelper AST#expression#Right . baseNameWithInnerExtension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CMetaInfo { fileName : string | null = null; sizeInBytes : number | null = null; updateDate : string | null = null; constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null) { this.fileName = fileName; this.sizeInBytes = sizeInBytes; this.updateDate = updateDate; } static equals(lhs: CMetaInfo, rhs: CMetaInfo): boolean { return lhs.fileName === rhs.fileName; } get baseName(): string | null { return this.fileName !== null ? CMetaInfoHelper.baseName(this.fileName) : null; } get baseNameWithInnerExtension(): string | null { return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L2-L31
cefdc82a57c926c5618288bb59d5bfd1ef161e70
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
arkts
decodePKCS1Segment
解密-分段 @param decodeStr 待解密的字符串 @param priKey RSA私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
AST#method_declaration#Left static decodePKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right , AST#parameter#Left isPem : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . decodeAsymSegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'RSA1024' AST#expression#Right , AST#expression#Left 'RSA1024|PKCS1' AST#expression#Right , AST#expression#Left 1024 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left dataCoding AST#expression#Right , AST#expression#Left isPem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L123-L127
950c9c63af70079e1e9dc7b328fc80181497415c
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
open_month_from_disk_sync
Files and Saving Opens a month of history using lite import, that is, assuming all of them are in time range one month. @param path A string, the path of the file.
open_month_from_disk_sync(year: number, month: number) { if (history_path_of_month(year, month) == this.current_opened_file_path) { // Already opened // console.log('already opened') return; } console.log('[bunch_of_history] Called open_month_from_disk_sync Y: ' + year + ' M: ' + month + '.'); ensure_this_month_history_file(); let path = history_path_of_month(year, month); let the_file = sandbox_read_text_sync(path); this.current_opened_file_path = path; this.current_year = year; this.current_month = month; if (the_file == "undefined" || the_file.length <= 1) { console.info("[Meow][bunch_of_history] Import history SKIPPED: Too short. (" + path + ")."); // Clear this.history_this_month = []; return; } this.import_string_lite(the_file, year, month); }
AST#method_declaration#Left open_month_from_disk_sync AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left history_path_of_month AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . current_opened_file_path AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // Already opened // console.log('already opened') AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[bunch_of_history] Called open_month_from_disk_sync Y: ' AST#expression#Right + AST#expression#Left year AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' M: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left month AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '.' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ensure_this_month_history_file AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left path = AST#expression#Left AST#call_expression#Left AST#expression#Left history_path_of_month AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left the_file = AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_read_text_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_opened_file_path AST#member_expression#Right = AST#expression#Left path AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_year AST#member_expression#Right = AST#expression#Left year AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_month AST#member_expression#Right = AST#expression#Left month AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left the_file AST#expression#Right == AST#expression#Left "undefined" AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left the_file AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right <= AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "[Meow][bunch_of_history] Import history SKIPPED: Too short. (" AST#expression#Right + AST#expression#Left path AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ")." AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Clear AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . history_this_month AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . import_string_lite AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left the_file AST#expression#Right , AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
open_month_from_disk_sync(year: number, month: number) { if (history_path_of_month(year, month) == this.current_opened_file_path) { return; } console.log('[bunch_of_history] Called open_month_from_disk_sync Y: ' + year + ' M: ' + month + '.'); ensure_this_month_history_file(); let path = history_path_of_month(year, month); let the_file = sandbox_read_text_sync(path); this.current_opened_file_path = path; this.current_year = year; this.current_month = month; if (the_file == "undefined" || the_file.length <= 1) { console.info("[Meow][bunch_of_history] Import history SKIPPED: Too short. (" + path + ")."); this.history_this_month = []; return; } this.import_string_lite(the_file, year, month); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L440-L460
02f20e941057760db4cd13644f4aa7dcb9ce84ff
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/event/LoadingDialogEvent.ets
arkts
展示Loading的Event @param showLoading @param " @returns
export function LoadingDialogEvent(showLoading: boolean, loadingTips: string = "加载中...") { return { data: { "showLoading": showLoading, "loadingTips": loadingTips } } }
AST#export_declaration#Left export AST#function_declaration#Left function LoadingDialogEvent AST#parameter_list#Left ( AST#parameter#Left showLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loadingTips : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "加载中..." AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "showLoading" AST#property_name#Right : AST#expression#Left showLoading AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "loadingTips" AST#property_name#Right : AST#expression#Left loadingTips AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function LoadingDialogEvent(showLoading: boolean, loadingTips: string = "加载中...") { return { data: { "showLoading": showLoading, "loadingTips": loadingTips } } }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/event/LoadingDialogEvent.ets#L7-L14
650185614348d4bfb1da6d0df3762ada49ea1620
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets
arkts
getRate
Get rate. @returns
getRate(): number { return (this.w / this.h); }
AST#method_declaration#Left getRate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . w AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . h AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getRate(): number { return (this.w / this.h); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L67-L69
02623f4d63d7c2700947ff60f5d7e5c255066ae0
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets
arkts
getTransactionsWithPagination
获取交易记录
public async getTransactionsWithPagination( conditions: UserTablePredicateParams[], page: number, pageSize: number, ): Promise<TableQueryWithPaginationRsp<TransactionTableBasis>> { return this.queryWithPagination<TransactionTableBasis>( AccountingDBConstants.TRANSACTION_TABLE_NAME, conditions, page, pageSize, { field: TransactionTableFields.TRANSACTION_ID, desc: true }, ); }
AST#method_declaration#Left public async getTransactionsWithPagination AST#parameter_list#Left ( AST#parameter#Left conditions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserTablePredicateParams [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pageSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left TableQueryWithPaginationRsp AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TransactionTableBasis AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . queryWithPagination AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TransactionTableBasis AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AccountingDBConstants AST#expression#Right . TRANSACTION_TABLE_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left conditions AST#expression#Right , AST#expression#Left page AST#expression#Right , AST#expression#Left pageSize AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left field AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TransactionTableFields AST#expression#Right . TRANSACTION_ID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left desc AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public async getTransactionsWithPagination( conditions: UserTablePredicateParams[], page: number, pageSize: number, ): Promise<TableQueryWithPaginationRsp<TransactionTableBasis>> { return this.queryWithPagination<TransactionTableBasis>( AccountingDBConstants.TRANSACTION_TABLE_NAME, conditions, page, pageSize, { field: TransactionTableFields.TRANSACTION_ID, desc: true }, ); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L206-L218
de01e19b128b031c475aa9eea70f88867c3888e8
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_a.ets
arkts
Introduction export-default/import
export default function cross_file_004_F_a(taint_src : string) { return taint_src; }
AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_004_F_a AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left taint_src AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right AST#export_declaration#Right
export default function cross_file_004_F_a(taint_src : string) { return taint_src; }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_a.ets#L6-L8
49054c54509e77ccd4a6156f43feab8271f574cb
github
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/view/VideoPlaySlider.ets
arkts
VideoSlider
video slider component
@Component export struct VideoSlider { @Consume isOpacity: boolean; private controller: VideoController = new VideoController(); @Consume currentStringTime: string; @Consume currentTime: number; @Consume durationTime: number; @Consume durationStringTime: string; @Consume isPlay: boolean; @Consume flag: boolean; @Consume isLoading: boolean; @Consume progressVal: number; build() { Row({ space: MARGIN_FONT_SIZE.FIRST_MARGIN }) { Image(this.isPlay ? $r('app.media.ic_pause') : $r('app.media.ic_play')) .width(IMAGE_SIZE) .height(IMAGE_SIZE) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) .onClick(() => { this.iconOnclick(); }) Text(this.currentStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .fontColor(Color.White) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) Slider({ value: this.currentTime, min: 0, max: this.durationTime, step: 1, style: SliderStyle.OutSet }) .blockColor($r('app.color.white')) .width(STRING_PERCENT.SLIDER_WITH) .trackColor(Color.Gray) .selectedColor($r("app.color.white")) .showSteps(true) .showTips(true) .trackThickness(this.isOpacity ? SMALL_TRACK_THICK_NESS : BIG_TRACK_THICK_NESS) .onChange((value: number, mode: SliderChangeMode) => { this.sliderOnchange(value, mode); }) Text(this.durationStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .margin({ right: MARGIN_FONT_SIZE.FIRST_MARGIN }) .fontColor(Color.White) } .opacity(this.isOpacity ? DEFAULT_OPACITY : 1) .width(ALL_PERCENT) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) } /** * icon onclick callback */ iconOnclick() { if (this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; // The video loading is not complete. The loading action is displayed. let intervalLoading = setInterval(() => { if (this.progressVal >= STACK_STYLE.PROGRESS_TOTAL) { this.progressVal = 0; } else { this.progressVal += STACK_STYLE.PROGRESS_STEP; } }, STACK_STYLE.MILLI_SECONDS) // The scheduled task determines whether the video loading is complete. let intervalFlag = setInterval(() => { if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; this.isLoading = false; clearInterval(intervalFlag); clearInterval(intervalLoading); } }, STACK_STYLE.MILLI_SECONDS); } } /** * video slider component onchange callback */ sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if (mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } if (mode === SliderChangeMode.End) { this.isOpacity = true; } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isOpacity : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left VideoController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VideoController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right currentStringTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right currentTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right durationTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right durationStringTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isPlay : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right progressVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . FIRST_MARGIN AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_pause' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_play' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left IMAGE_SIZE AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left IMAGE_SIZE AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . FIRST_MARGIN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconOnclick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentStringTime AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . SECOND_MARGIN AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . FIRST_MARGIN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Slider ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left min : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationTime AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left step : AST#expression#Left 1 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left style : AST#expression#Left AST#member_expression#Left AST#expression#Left SliderStyle AST#expression#Right . OutSet AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . blockColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left STRING_PERCENT AST#expression#Right . SLIDER_WITH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . trackColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . showSteps ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . showTips ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . trackThickness AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SMALL_TRACK_THICK_NESS AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left BIG_TRACK_THICK_NESS AST#primary_type#Right AST#type_annotation#Right ) AST#ERROR#Right . onChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sliderOnchange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left mode AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left Text AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationStringTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . SECOND_MARGIN AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . margin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left MARGIN_FONT_SIZE AST#expression#Right . FIRST_MARGIN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#Right . opacity AST#member_expression#Right AST#expression#Right ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DEFAULT_OPACITY AST#expression#Right AST#ERROR#Left : 1 ) AST#ERROR#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ALL_PERCENT AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /** * icon onclick callback */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left iconOnclick ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . pause AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // The video loading is not complete. The loading action is displayed. AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intervalLoading = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progressVal AST#member_expression#Right AST#expression#Right >= AST#expression#Left STACK_STYLE AST#expression#Right AST#binary_expression#Right AST#expression#Right . PROGRESS_TOTAL AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progressVal AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progressVal AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left STACK_STYLE AST#expression#Right . PROGRESS_STEP AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left STACK_STYLE AST#expression#Right . MILLI_SECONDS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // The scheduled task determines whether the video loading is complete. AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intervalFlag = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left intervalFlag AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left intervalLoading AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left STACK_STYLE AST#expression#Right . MILLI_SECONDS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /** * video slider component onchange callback */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left sliderOnchange ( AST#expression#Left value AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left mode AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . setCurrentTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SeekMode AST#expression#Right . Accurate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mode AST#expression#Right === AST#expression#Left SliderChangeMode AST#expression#Right AST#binary_expression#Right AST#expression#Right . Begin AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left mode AST#expression#Right === AST#expression#Left SliderChangeMode AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Moving AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mode AST#expression#Right === AST#expression#Left SliderChangeMode AST#expression#Right AST#binary_expression#Right AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct VideoSlider { @Consume isOpacity: boolean; private controller: VideoController = new VideoController(); @Consume currentStringTime: string; @Consume currentTime: number; @Consume durationTime: number; @Consume durationStringTime: string; @Consume isPlay: boolean; @Consume flag: boolean; @Consume isLoading: boolean; @Consume progressVal: number; build() { Row({ space: MARGIN_FONT_SIZE.FIRST_MARGIN }) { Image(this.isPlay ? $r('app.media.ic_pause') : $r('app.media.ic_play')) .width(IMAGE_SIZE) .height(IMAGE_SIZE) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) .onClick(() => { this.iconOnclick(); }) Text(this.currentStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .fontColor(Color.White) .margin({ left: MARGIN_FONT_SIZE.FIRST_MARGIN }) Slider({ value: this.currentTime, min: 0, max: this.durationTime, step: 1, style: SliderStyle.OutSet }) .blockColor($r('app.color.white')) .width(STRING_PERCENT.SLIDER_WITH) .trackColor(Color.Gray) .selectedColor($r("app.color.white")) .showSteps(true) .showTips(true) .trackThickness(this.isOpacity ? SMALL_TRACK_THICK_NESS : BIG_TRACK_THICK_NESS) .onChange((value: number, mode: SliderChangeMode) => { this.sliderOnchange(value, mode); }) Text(this.durationStringTime) .fontSize(MARGIN_FONT_SIZE.SECOND_MARGIN) .margin({ right: MARGIN_FONT_SIZE.FIRST_MARGIN }) .fontColor(Color.White) } .opacity(this.isOpacity ? DEFAULT_OPACITY : 1) .width(ALL_PERCENT) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) } iconOnclick() { if (this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; let intervalLoading = setInterval(() => { if (this.progressVal >= STACK_STYLE.PROGRESS_TOTAL) { this.progressVal = 0; } else { this.progressVal += STACK_STYLE.PROGRESS_STEP; } }, STACK_STYLE.MILLI_SECONDS) let intervalFlag = setInterval(() => { if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; this.isLoading = false; clearInterval(intervalFlag); clearInterval(intervalLoading); } }, STACK_STYLE.MILLI_SECONDS); } } sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if (mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } if (mode === SliderChangeMode.End) { this.isOpacity = true; } } }
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/view/VideoPlaySlider.ets#L16-L121
9363babea3b4e760094713d9e2809d2ef7076797
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
deleteWordIds
/从plan中删除words
public static async deleteWordIds(wordIds: number[], plan: Plan): Promise<void> { ////删除内存 中的缓存 plan.getPieces().forEach(piece => { wordIds.forEach(wordId => { //删除wordId piece.removeMem(wordId); //删除此piece if (piece.wordIds.length === 0) { plan.removeMemPiece(piece); //删除 相应的boxes plan.getBoxes().filter(b => b.pieceNo === piece.pieceNo).forEach(b => plan.removeMemBox(b)); } //删除内存 word的Learn plan.getLearns().forEach(l => plan.removeMemLearn(l)); }); }); //保存db(更新内存中plan+pieces+box) await plan.save(); //还要删除DB中相应wordIds的learn //这里为了与plan主逻辑区分,不放在一个transaction中执行 if (plan.planId != null) { await PlanDbAccess.shared.deleteLearn(plan.planId, wordIds); } //重新加载当前plan if (plan.planId === PlanManager.shared.plan?.planId) { PlanManager.shared.plan = plan; } }
AST#method_declaration#Left public static async deleteWordIds AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { ////删除内存 中的缓存 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . getPieces AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left piece => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wordIds AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left wordId => AST#block_statement#Left { //删除wordId AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left piece AST#expression#Right . removeMem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wordId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //删除此piece AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left piece AST#expression#Right . wordIds AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . removeMemPiece AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left piece AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //删除 相应的boxes AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . getBoxes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left b => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right === AST#expression#Left piece AST#expression#Right AST#binary_expression#Right AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left b => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . removeMemBox AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left b AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //删除内存 word的Learn AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . getLearns AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left l => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . removeMemLearn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left l AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //保存db(更新内存中plan+pieces+box) AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left plan AST#expression#Right AST#await_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //还要删除DB中相应wordIds的learn //这里为了与plan主逻辑区分,不放在一个transaction中执行 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . planId AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . deleteLearn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . planId AST#member_expression#Right AST#expression#Right , AST#expression#Left wordIds AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right //重新加载当前plan AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . planId AST#member_expression#Right AST#expression#Right === AST#expression#Left PlanManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . plan AST#member_expression#Right AST#expression#Right ?. planId AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PlanManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . plan AST#member_expression#Right = AST#expression#Left plan AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static async deleteWordIds(wordIds: number[], plan: Plan): Promise<void> { plan.getPieces().forEach(piece => { wordIds.forEach(wordId => { piece.removeMem(wordId); if (piece.wordIds.length === 0) { plan.removeMemPiece(piece); plan.getBoxes().filter(b => b.pieceNo === piece.pieceNo).forEach(b => plan.removeMemBox(b)); } plan.getLearns().forEach(l => plan.removeMemLearn(l)); }); }); await plan.save(); if (plan.planId != null) { await PlanDbAccess.shared.deleteLearn(plan.planId, wordIds); } if (plan.planId === PlanManager.shared.plan?.planId) { PlanManager.shared.plan = plan; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L416-L449
42bb4c3171bde853c06b7f1c99073942eebaa79e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
定价信息接口
export interface PricingInfo { inputTokenPrice: number; outputTokenPrice: number; currency: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PricingInfo AST#object_type#Left { AST#type_member#Left inputTokenPrice : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left outputTokenPrice : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left currency : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PricingInfo { inputTokenPrice: number; outputTokenPrice: number; currency: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L664-L668
8b89b05262029b0e0917a083a7e4da8bb849dd30
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeader.d.ets
arkts
SubHeader
Declare struct SubHeader @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare struct SubHeader @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare struct SubHeader @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@Component export declare struct SubHeader { /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop icon?: ResourceStr; /** * Attributes of Symbol icon. * @type { SymbolOptions}. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Attributes of Symbol icon. * @type { SymbolOptions}. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ iconSymbolOptions?: SymbolOptions; /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop primaryTitle?: ResourceStr; /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop secondaryTitle?: ResourceStr; /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ select?: SelectOptions; /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop operationType?: OperationType; /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ operationItem?: Array<OperationOption>; /** * Attributes of Symbol icons in operation area. * @type { Array<SymbolOptions> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Attributes of Symbol icons in operation area. * @type { Array<SymbolOptions> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ operationSymbolOptions?: Array<SymbolOptions>; /** * Text modifier for primary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Text modifier for primary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ primaryTitleModifier?: TextModifier; /** * Text modifier for secondary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Text modifier for secondary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ secondaryTitleModifier?: TextModifier; /** * Set the title content. * @type { () => void } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the title content. * @type { () => void } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @BuilderParam titleBuilder?: () => void; /** * Set the content margin. * @type { ?LocalizedMargin } * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the content margin. * @type { ?LocalizedMargin } * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop contentMargin?: LocalizedMargin; /** * Set the content padding. * @type { ?LocalizedPadding } * @default set different default values according to the width of the subHeader: * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon, * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)}; * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the content padding. * @type { ?LocalizedPadding } * @default set different default values according to the width of the subHeader: * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon, * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)}; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop contentPadding?: LocalizedPadding; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SubHeader AST#component_body#Left { /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Icon resource of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right icon ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Attributes of Symbol icon. * @type { SymbolOptions}. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Attributes of Symbol icon. * @type { SymbolOptions}. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left iconSymbolOptions ? : AST#type_annotation#Left AST#primary_type#Left SymbolOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The first line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right primaryTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The secondary line text of content area. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right secondaryTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Select option of content area. * @type { SelectOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left select ? : AST#type_annotation#Left AST#primary_type#Left SelectOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Operation style of SubHeader. * @type { OperationStyle }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right operationType ? : AST#type_annotation#Left AST#primary_type#Left OperationType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * operation item. * @type { Array<OperationOption> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left operationItem ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left OperationOption AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Attributes of Symbol icons in operation area. * @type { Array<SymbolOptions> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Attributes of Symbol icons in operation area. * @type { Array<SymbolOptions> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#property_declaration#Left operationSymbolOptions ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SymbolOptions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Text modifier for primary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Text modifier for primary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left primaryTitleModifier ? : AST#type_annotation#Left AST#primary_type#Left TextModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Text modifier for secondary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Text modifier for secondary title. * @type { TextModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left secondaryTitleModifier ? : AST#type_annotation#Left AST#primary_type#Left TextModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Set the title content. * @type { () => void } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the title content. * @type { () => void } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right titleBuilder ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Set the content margin. * @type { ?LocalizedMargin } * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the content margin. * @type { ?LocalizedMargin } * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right contentMargin ? : AST#type_annotation#Left AST#primary_type#Left LocalizedMargin AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Set the content padding. * @type { ?LocalizedPadding } * @default set different default values according to the width of the subHeader: * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon, * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)}; * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * Set the content padding. * @type { ?LocalizedPadding } * @default set different default values according to the width of the subHeader: * <br> When the left area is secondaryTitle or the group of secondaryTitle and icon, * <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)}; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right contentPadding ? : AST#type_annotation#Left AST#primary_type#Left LocalizedPadding AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export declare struct SubHeader { @Prop icon?: ResourceStr; iconSymbolOptions?: SymbolOptions; @Prop primaryTitle?: ResourceStr; @Prop secondaryTitle?: ResourceStr; select?: SelectOptions; @Prop operationType?: OperationType; operationItem?: Array<OperationOption>; operationSymbolOptions?: Array<SymbolOptions>; primaryTitleModifier?: TextModifier; secondaryTitleModifier?: TextModifier; @BuilderParam titleBuilder?: () => void; @Prop contentMargin?: LocalizedMargin; @Prop contentPadding?: LocalizedPadding; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeader.d.ets#L479-L746
02a359142b0ba97f7a02cd58e14bbbe9fe0abd40
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/common/conts.ets
arkts
5s
export const ATL3_MAX_REUSE_DURATION = 5*1000;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ATL3_MAX_REUSE_DURATION = AST#expression#Left AST#binary_expression#Left AST#expression#Left 5 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const ATL3_MAX_REUSE_DURATION = 5*1000;
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L21-L21
a40bc73a23325c2a21ef0da20c346ddeb15e53be
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
forward
Goes forward in the history of the web page. @throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a AtomicServiceWeb component. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
forward(): void;
AST#method_declaration#Left forward AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
forward(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L403-L403
0116f96315a1c3990f1d9b5ba08d05d5a622b6fa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getDeviceType
获取当前设备类型 resourceManager.DeviceType: DEVICE_TYPE_PHONE手机。 DEVICE_TYPE_TABLET 平板。 DEVICE_TYPE_CAR 汽车。 DEVICE_TYPE_PC 电脑。 DEVICE_TYPE_TV 电视。 DEVICE_TYPE_WEARABLE 穿戴。 DEVICE_TYPE_2IN1 2IN1。 @returns
static getDeviceType(): number { return DeviceUtil.getDeviceCapabilitySync().deviceType; }
AST#method_declaration#Left static getDeviceType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getDeviceCapabilitySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . deviceType AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getDeviceType(): number { return DeviceUtil.getDeviceCapabilitySync().deviceType; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L255-L257
9a26585521e4f5ae3b233652dea95b9cc80b6313
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/constants/AppConstants.ets
arkts
存储常量(兼容性)
export class StorageConstants { static readonly CONTACTS: string = 'contacts'; static readonly GREETINGS: string = 'greetings'; static readonly SETTINGS: string = 'settings'; static readonly LUNAR_CACHE: string = 'lunar_cache'; static readonly AI_CONFIG: string = 'ai_config'; // 数据库相关 static readonly DATABASE_NAME: string = 'birthday_reminder.db'; static readonly DATABASE_VERSION: number = 1; static readonly PREFERENCES_NAME: string = 'birthday_reminder_prefs'; // 表名 static readonly TABLE_CONTACTS: string = 'contacts'; static readonly TABLE_GREETINGS: string = 'greetings'; static readonly TABLE_GREETING_HISTORY: string = 'greeting_history'; static readonly TABLE_OPERATION_LOGS: string = 'operation_logs'; // 其他存储键 static readonly SYNC_STATISTICS_KEY: string = 'sync_statistics'; }
AST#export_declaration#Left export AST#class_declaration#Left class StorageConstants AST#class_body#Left { AST#property_declaration#Left static readonly CONTACTS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'contacts' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GREETINGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'greetings' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SETTINGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'settings' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LUNAR_CACHE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'lunar_cache' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly AI_CONFIG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'ai_config' AST#expression#Right ; AST#property_declaration#Right // 数据库相关 AST#property_declaration#Left static readonly DATABASE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'birthday_reminder.db' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DATABASE_VERSION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PREFERENCES_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'birthday_reminder_prefs' AST#expression#Right ; AST#property_declaration#Right // 表名 AST#property_declaration#Left static readonly TABLE_CONTACTS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'contacts' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_GREETINGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'greetings' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_GREETING_HISTORY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'greeting_history' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_OPERATION_LOGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'operation_logs' AST#expression#Right ; AST#property_declaration#Right // 其他存储键 AST#property_declaration#Left static readonly SYNC_STATISTICS_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sync_statistics' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class StorageConstants { static readonly CONTACTS: string = 'contacts'; static readonly GREETINGS: string = 'greetings'; static readonly SETTINGS: string = 'settings'; static readonly LUNAR_CACHE: string = 'lunar_cache'; static readonly AI_CONFIG: string = 'ai_config'; static readonly DATABASE_NAME: string = 'birthday_reminder.db'; static readonly DATABASE_VERSION: number = 1; static readonly PREFERENCES_NAME: string = 'birthday_reminder_prefs'; static readonly TABLE_CONTACTS: string = 'contacts'; static readonly TABLE_GREETINGS: string = 'greetings'; static readonly TABLE_GREETING_HISTORY: string = 'greeting_history'; static readonly TABLE_OPERATION_LOGS: string = 'operation_logs'; static readonly SYNC_STATISTICS_KEY: string = 'sync_statistics'; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L113-L133
0455a89c009f270415a63ecaedf69688b511e950
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/CsvParser.ets
arkts
parseCsvRow
解析CSV行为字段数组
private static parseCsvRow(line: string): string[] { const fields: string[] = []; let currentField = ''; let inQuotes = false; for (let i = 0; i < line.length; i++) { const char = line[i]; if (char === '"') { if (inQuotes && line[i + 1] === '"') { // 双引号转义 currentField += '"'; i++; // 跳过下一个引号 } else { inQuotes = !inQuotes; } } else if (char === ',' && !inQuotes) { fields.push(currentField.trim()); currentField = ''; } else { currentField += char; } } fields.push(currentField.trim()); return fields; }
AST#method_declaration#Left private static parseCsvRow AST#parameter_list#Left ( AST#parameter#Left line : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fields : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentField = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left inQuotes = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left line AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left char = AST#expression#Left AST#subscript_expression#Left AST#expression#Left line AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right === AST#expression#Left '"' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left inQuotes AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left line AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left '"' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 双引号转义 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left currentField += AST#expression#Left '"' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 跳过下一个引号 } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left inQuotes = AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inQuotes AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right === AST#expression#Left ',' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inQuotes AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fields AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentField AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left currentField = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left currentField += AST#expression#Left char AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fields AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentField AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left fields AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static parseCsvRow(line: string): string[] { const fields: string[] = []; let currentField = ''; let inQuotes = false; for (let i = 0; i < line.length; i++) { const char = line[i]; if (char === '"') { if (inQuotes && line[i + 1] === '"') { currentField += '"'; i++; } else { inQuotes = !inQuotes; } } else if (char === ',' && !inQuotes) { fields.push(currentField.trim()); currentField = ''; } else { currentField += char; } } fields.push(currentField.trim()); return fields; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/CsvParser.ets#L126-L152
03c5769e4f7d185f5e338800f5856f01092cef45
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/log/Logger.ets
arkts
log
统一日志输出
private log(level: LogLevel, tag: string, message: string, args: string[]): void { const logMessage = `[${tag}] ${message}`; switch (level) { case LogLevel.DEBUG: hilog.debug(this.DOMAIN, this.TAG, logMessage);
AST#method_declaration#Left private log AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left LogLevel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left logMessage = AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right ] AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left level AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { AST#property_name#Left case AST#property_name#Right LogLevel AST#ERROR#Right AST#modifier_chain_expression#Left . DEBUG AST#modifier_chain_expression#Right AST#ERROR#Right : AST#ERROR#Left AST#qualified_type#Left hilog . debug AST#qualified_type#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . DOMAIN AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left , this . TAG , logMessage AST#ERROR#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
private log(level: LogLevel, tag: string, message: string, args: string[]): void { const logMessage = `[${tag}] ${message}`; switch (level) { case LogLevel.DEBUG: hilog.debug(this.DOMAIN, this.TAG, logMessage);
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L87-L92
83fc796b33bf2adae71cb418d07e099011446be9
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/viewmodel/DetailViewModel.ets
arkts
详细页面视图模型描述
export default class DetailViewModel { static instant: DetailViewModel = new DetailViewModel(); private reminderService: ReminderService; private alarms: Array<AlarmItem>; private constructor() { this.reminderService = new ReminderService(); this.alarms = new Array<AlarmItem>(); } /** * 转换闹钟重复日期的内容 * * @param repeatDay number * @return repeatContent string */ public transAlarmRepeatDayContent(repeatDay: number): string { let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY; switch (repeatDay) { case WeekDays.DEFAULT_NUMBER_MONDAY: repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; break; case WeekDays.DEFAULT_NUMBER_TUESDAY: repeatContent = CommonConstants.DEFAULT_STRING_TUESDAY; break; case WeekDays.DEFAULT_NUMBER_WEDNESDAY: repeatContent = CommonConstants.DEFAULT_STRING_WEDNESDAY; break; case WeekDays.DEFAULT_NUMBER_THURSDAY: repeatContent = CommonConstants.DEFAULT_STRING_THURSDAY; break; case WeekDays.DEFAULT_NUMBER_FRIDAY: repeatContent = CommonConstants.DEFAULT_STRING_FRIDAY; break; case WeekDays.DEFAULT_NUMBER_SATURDAY: repeatContent = CommonConstants.DEFAULT_STRING_SATURDAY; break; case WeekDays.DEFAULT_NUMBER_SUNDAY: repeatContent = CommonConstants.DEFAULT_STRING_SUNDAY; break; default: break; }
AST#export_declaration#Left export default AST#class_declaration#Left class DetailViewModel AST#class_body#Left { AST#property_declaration#Left static instant : AST#type_annotation#Left AST#primary_type#Left DetailViewModel AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DetailViewModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private reminderService : AST#type_annotation#Left AST#primary_type#Left ReminderService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private alarms : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlarmItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderService AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ReminderService AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alarms AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlarmItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * 转换闹钟重复日期的内容 * * @param repeatDay number * @return repeatContent string */ AST#property_declaration#Left public transAlarmRepeatDayContent AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left repeatDay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left repeatContent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_MONDAY AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left repeatDay AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { AST#property_name#Left case AST#property_name#Right WeekDays AST#ERROR#Right AST#modifier_chain_expression#Left . DEFAULT_NUMBER_MONDAY AST#modifier_chain_expression#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_MONDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_TUESDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_TUESDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_WEDNESDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_WEDNESDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_THURSDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_THURSDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_FRIDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_FRIDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_SATURDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_SATURDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left WeekDays . DEFAULT_NUMBER_SUNDAY AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left repeatContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_STRING_SUNDAY AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left default : AST#type_annotation#Left AST#primary_type#Left break AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class DetailViewModel { static instant: DetailViewModel = new DetailViewModel(); private reminderService: ReminderService; private alarms: Array<AlarmItem>; private constructor() { this.reminderService = new ReminderService(); this.alarms = new Array<AlarmItem>(); } public transAlarmRepeatDayContent(repeatDay: number): string { let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY; switch (repeatDay) { case WeekDays.DEFAULT_NUMBER_MONDAY: repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; break; case WeekDays.DEFAULT_NUMBER_TUESDAY: repeatContent = CommonConstants.DEFAULT_STRING_TUESDAY; break; case WeekDays.DEFAULT_NUMBER_WEDNESDAY: repeatContent = CommonConstants.DEFAULT_STRING_WEDNESDAY; break; case WeekDays.DEFAULT_NUMBER_THURSDAY: repeatContent = CommonConstants.DEFAULT_STRING_THURSDAY; break; case WeekDays.DEFAULT_NUMBER_FRIDAY: repeatContent = CommonConstants.DEFAULT_STRING_FRIDAY; break; case WeekDays.DEFAULT_NUMBER_SATURDAY: repeatContent = CommonConstants.DEFAULT_STRING_SATURDAY; break; case WeekDays.DEFAULT_NUMBER_SUNDAY: repeatContent = CommonConstants.DEFAULT_STRING_SUNDAY; break; default: break; }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/DetailViewModel.ets#L13-L55
e8c93278c9c0349c301eee4f7830b4f4bd766733
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/sync/CloudStorageProvider.ets
arkts
阿里云存储实现
export class AliyunStorageProvider extends CloudStorageProvider { async initialize(): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Aliyun Storage'); // TODO: 实现阿里云存储初始化 } async upload(options: UploadOptions): Promise<string> { // TODO: 实现阿里云上传 throw new Error('Aliyun storage not implemented yet'); } async download(options: DownloadOptions): Promise<ArrayBuffer> { // TODO: 实现阿里云下载 throw new Error('Aliyun storage not implemented yet'); } async delete(path: string): Promise<void> { // TODO: 实现阿里云删除 throw new Error('Aliyun storage not implemented yet'); } async exists(path: string): Promise<boolean> { // TODO: 实现阿里云存在性检查 throw new Error('Aliyun storage not implemented yet'); } async list(prefix: string): Promise<CloudFile[]> { // TODO: 实现阿里云列表 throw new Error('Aliyun storage not implemented yet'); } async getFileInfo(path: string): Promise<CloudFile> { // TODO: 实现阿里云文件信息获取 throw new Error('Aliyun storage not implemented yet'); } }
AST#export_declaration#Left export AST#class_declaration#Left class AliyunStorageProvider extends AST#type_annotation#Left AST#primary_type#Left CloudStorageProvider AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left async initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Initializing Aliyun Storage' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO: 实现阿里云存储初始化 } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left async upload AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left UploadOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云上传 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async download AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DownloadOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云下载 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async delete AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云删除 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async exists AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云存在性检查 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async list AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CloudFile [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云列表 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async getFileInfo AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CloudFile AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // TODO: 实现阿里云文件信息获取 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Aliyun storage not implemented yet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class AliyunStorageProvider extends CloudStorageProvider { async initialize(): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Aliyun Storage'); } async upload(options: UploadOptions): Promise<string> { throw new Error('Aliyun storage not implemented yet'); } async download(options: DownloadOptions): Promise<ArrayBuffer> { throw new Error('Aliyun storage not implemented yet'); } async delete(path: string): Promise<void> { throw new Error('Aliyun storage not implemented yet'); } async exists(path: string): Promise<boolean> { throw new Error('Aliyun storage not implemented yet'); } async list(prefix: string): Promise<CloudFile[]> { throw new Error('Aliyun storage not implemented yet'); } async getFileInfo(path: string): Promise<CloudFile> { throw new Error('Aliyun storage not implemented yet'); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudStorageProvider.ets#L330-L365
0d74bb1e6f0fa0f7cb3a3f5dda5fe89ce2a97e0f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/common/constant/CommonConstants.ets
arkts
Copyright (c) 2024 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 class CommonConstants { /** * Adjust slider value. */ static readonly ADJUST_SLIDER_VALUE: number[] = [100, 100, 100]; static readonly PIXEL_STEP: number; /** * Slider step. */ static readonly SLIDER_MAX: number = 100; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Adjust slider value. */ AST#property_declaration#Left static readonly ADJUST_SLIDER_VALUE : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 100 AST#expression#Right , AST#expression#Left 100 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PIXEL_STEP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Slider step. */ AST#property_declaration#Left static readonly SLIDER_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { static readonly ADJUST_SLIDER_VALUE: number[] = [100, 100, 100]; static readonly PIXEL_STEP: number; static readonly SLIDER_MAX: number = 100; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/common/constant/CommonConstants.ets#L16-L27
17fac96fae8337f474d13a1a7ecca558bf416cc2
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets
arkts
sendTestMsg2Server
发送测试消息到服务端
async sendTestMsg2Server() { //执行TCP通讯的对象 let tcpSocket = socket.constructTCPSocketInstance(); await this.bind2Port(tcpSocket) await this.connect2Server(tcpSocket) for (let i = 0;i < 100; i++) { await tcpSocket.send({ data: i.toString() }) await sleep(1) } }
AST#method_declaration#Left async sendTestMsg2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //执行TCP通讯的对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpSocket = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left socket AST#expression#Right . constructTCPSocketInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . bind2Port AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpSocket AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . connect2Server AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpSocket AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left tcpSocket AST#expression#Right AST#await_expression#Right AST#expression#Right . send AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left i AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left sleep AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async sendTestMsg2Server() { let tcpSocket = socket.constructTCPSocketInstance(); await this.bind2Port(tcpSocket) await this.connect2Server(tcpSocket) for (let i = 0;i < 100; i++) { await tcpSocket.send({ data: i.toString() }) await sleep(1) } }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets#L106-L116
dc481a0b135ea6488fc4e44e5c625c07364189a1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showConfirmDialog
显示信息确认类弹出框 @param options
static showConfirmDialog(options: ConfirmOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initPrimarySecondaryButton(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ConfirmDialogBuilder), options); return dialogId; }
AST#method_declaration#Left static showConfirmDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . initBaseDefault AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . initDialogDefault AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionParameter AST#expression#Right . initPrimarySecondaryButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left dialogId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ActionBaseCore AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . openCustomDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left ConfirmDialogBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left dialogId AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static showConfirmDialog(options: ConfirmOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initPrimarySecondaryButton(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ConfirmDialogBuilder), options); return dialogId; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L152-L158
28a4bf4109d8a395045cbf1220becf01ef45be59
gitee