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
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/ExceptionInfo.ets
arkts
异常信息对象
export class ExceptionInfo { constructor(name: string, message: string, stack: string) { this.brandModel = DeviceUtil.getBrandModel(); this.marketName = DeviceUtil.getMarketName(); this.osFullName = DeviceUtil.getOsFullName(); this.displayVersion = DeviceUtil.getDisplayVersion(); this.osVersion = DeviceUtil.getOsVersion(); this.sdkApiVersion = DeviceUtil.getSdkApiVersion(); this.bundleName = AppUtil.getBundleName(); this.versionName = AppUtil.getVersionName(); this.versionCode = AppUtil.getVersionCode(); this.installTime = AppUtil.getInstallTime(); this.updateTime = AppUtil.getUpdateTime(); this.provisionType = AppUtil.getAppProvisionType(); this.crashTime = systemDateTime.getTime(false); this.name = name; this.message = message; this.stack = stack; } brandModel?: string; //设备品牌及型号 marketName?: string; //设备产品系列名称 osFullName?: string; //系统版本 displayVersion?: string; //产品版本。示例:ALN-AL00 5.0.0.1(XXX) osVersion?: string; //OS版本号,示例:5.0.4 sdkApiVersion?: number; //系统软件API版本,示例:12 bundleName?: string; //应用包的名称 versionName?: string; //应用版本名 versionCode?: number; //应用版本号 installTime?: number; //应用包安装时间 updateTime?: number; //应用包更新时间 provisionType?: string; //应用程序签名证书文件的类型,分为debug和release两种类型。 crashTime?: number; //崩溃的时间 name?: string; message?: string; stack?: string; }
AST#export_declaration#Left export AST#class_declaration#Left class ExceptionInfo AST#class_body#Left { AST#constructor_declaration#Left constructor 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#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 stack : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . brandModel AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getBrandModel 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marketName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getMarketName 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . osFullName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getOsFullName 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayVersion AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getDisplayVersion 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . osVersion AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getOsVersion 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sdkApiVersion AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . getSdkApiVersion 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bundleName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getBundleName 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . versionName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getVersionName 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . versionCode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getVersionCode 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . installTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getInstallTime 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getUpdateTime 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provisionType AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getAppProvisionType 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . crashTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemDateTime AST#expression#Right . getTime AST#member_expression#Right 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#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 name 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 . message AST#member_expression#Right = AST#expression#Left message 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 . stack AST#member_expression#Right = AST#expression#Left stack 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#property_declaration#Left brandModel ? : 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 marketName ? : 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 osFullName ? : 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 displayVersion ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //产品版本。示例:ALN-AL00 5.0.0.1(XXX) AST#property_declaration#Left osVersion ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //OS版本号,示例:5.0.4 AST#property_declaration#Left sdkApiVersion ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //系统软件API版本,示例:12 AST#property_declaration#Left bundleName ? : 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 versionName ? : 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 versionCode ? : 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 installTime ? : 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 updateTime ? : 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 provisionType ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //应用程序签名证书文件的类型,分为debug和release两种类型。 AST#property_declaration#Left crashTime ? : 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 name ? : 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 message ? : 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 stack ? : AST#type_annotation#Left AST#primary_type#Left string 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 class ExceptionInfo { constructor(name: string, message: string, stack: string) { this.brandModel = DeviceUtil.getBrandModel(); this.marketName = DeviceUtil.getMarketName(); this.osFullName = DeviceUtil.getOsFullName(); this.displayVersion = DeviceUtil.getDisplayVersion(); this.osVersion = DeviceUtil.getOsVersion(); this.sdkApiVersion = DeviceUtil.getSdkApiVersion(); this.bundleName = AppUtil.getBundleName(); this.versionName = AppUtil.getVersionName(); this.versionCode = AppUtil.getVersionCode(); this.installTime = AppUtil.getInstallTime(); this.updateTime = AppUtil.getUpdateTime(); this.provisionType = AppUtil.getAppProvisionType(); this.crashTime = systemDateTime.getTime(false); this.name = name; this.message = message; this.stack = stack; } brandModel?: string; marketName?: string; osFullName?: string; displayVersion?: string; osVersion?: string; sdkApiVersion?: number; bundleName?: string; versionName?: string; versionCode?: number; installTime?: number; updateTime?: number; provisionType?: string; crashTime?: number; name?: string; message?: string; stack?: string; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/ExceptionInfo.ets#L8-L50
2acbd91b089793f80ae15dd0d272f9bb5a590f75
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
pushData
在数据尾部增加一个元素
public pushData(data: SwiperModule): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left SwiperModule 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#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 . dataArray 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 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 . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#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 . dataArray AST#member_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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public pushData(data: SwiperModule): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L54-L57
430782d9e631be6cedcc4aad2d1c28ceed9af90e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildSelectionActions
构建选择模式操作栏
@Builder buildSelectionActions() { Row({ space: 16 }) { Button(`全选(${this.filteredGreetings.length})`) .type(ButtonType.Capsule) .fontSize(14) .backgroundColor('#f0f0f0') .fontColor('#333333') .height('32vp') .onClick(() => { if (this.selectedGreetings.size === this.filteredGreetings.length) { this.selectedGreetings.clear(); } else { this.filteredGreetings.forEach(greeting => { this.selectedGreetings.add(greeting.id); }); } this.selectedGreetings = new Set(this.selectedGreetings); }) Button(`删除(${this.selectedGreetings.size})`) .type(ButtonType.Capsule) .fontSize(14) .backgroundColor('#ff4444') .fontColor('#ffffff') .height('32vp') .enabled(this.selectedGreetings.size > 0) .onClick(() => { this.deleteSelectedGreetings(); }) } .width('100%') .justifyContent(FlexAlign.Start) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSelectionActions 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 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#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 this AST#expression#Right . filteredGreetings AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0f0f0' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '32vp' 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 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 . selectedGreetings AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . filteredGreetings AST#member_expression#Right AST#expression#Right . length 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 . selectedGreetings 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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . filteredGreetings AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left greeting => 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 . selectedGreetings AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . id 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#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 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 . selectedGreetings AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreetings 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#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#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 Button ( 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 this AST#expression#Right . selectedGreetings AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ff4444' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '32vp' AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( 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 . selectedGreetings AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleteSelectedGreetings 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#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#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#builder_function_body#Right AST#method_declaration#Right
@Builder buildSelectionActions() { Row({ space: 16 }) { Button(`全选(${this.filteredGreetings.length})`) .type(ButtonType.Capsule) .fontSize(14) .backgroundColor('#f0f0f0') .fontColor('#333333') .height('32vp') .onClick(() => { if (this.selectedGreetings.size === this.filteredGreetings.length) { this.selectedGreetings.clear(); } else { this.filteredGreetings.forEach(greeting => { this.selectedGreetings.add(greeting.id); }); } this.selectedGreetings = new Set(this.selectedGreetings); }) Button(`删除(${this.selectedGreetings.size})`) .type(ButtonType.Capsule) .fontSize(14) .backgroundColor('#ff4444') .fontColor('#ffffff') .height('32vp') .enabled(this.selectedGreetings.size > 0) .onClick(() => { this.deleteSelectedGreetings(); }) } .width('100%') .justifyContent(FlexAlign.Start) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L287-L320
d5180cc38720db17e4c4784fffb7ca549857391e
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/home.ets
arkts
getShowContent
*******网络接口*******//
async getShowContent() { let httpRequest = http.createHttp(); let url = address.IP+`/getShowContent`; try { let response = await httpRequest.request(url, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.token}` } }); let result=JSON.parse(response.result as string)as homeNetWorkType; if (result.code===200) { this.datas=result.data; this.isShow=true; } }catch (e) { promptAction.showToast({message:"网络错误"}) } }
AST#method_declaration#Left async getShowContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp 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 let AST#variable_declarator#Left url = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left address AST#expression#Right . IP AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#template_literal#Left ` /getShowContent ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let 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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'Authorization' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` Bearer AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . token AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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#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 result = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left homeNetWorkType 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result 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#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 . datas AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . data 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 . isShow 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#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 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#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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getShowContent() { let httpRequest = http.createHttp(); let url = address.IP+`/getShowContent`; try { let response = await httpRequest.request(url, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.token}` } }); let result=JSON.parse(response.result as string)as homeNetWorkType; if (result.code===200) { this.datas=result.data; this.isShow=true; } }catch (e) { promptAction.showToast({message:"网络错误"}) } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/home.ets#L155-L177
d547eaf51a6079bc54226191614e0dca25bbb6dd
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdCardUtil.ets
arkts
isValidCard15
校验15位身份证号是否合法 @param idCard @returns
static isValidCard15(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } if (IdCardUtil.CHINA_ID_MIN_LENGTH != idCard.length) { return OutDTO.Error("身份证长度不足15位"); } // 省份 let proCode: string = idCard.substring(0, 2) + "0000"; if (null == IdCardUtil.PROVINCE_CODES.get(proCode)) { return OutDTO.Error("省份代码不正确:" + proCode); } //城市 let cityCode: string = idCard.substring(0, 4) + "00"; if (null == IdCardUtil.CITY_CODES.get(cityCode)) { return OutDTO.Error("城市代码不正确:" + cityCode); } //乡镇 let districtCode: string = idCard.substring(0, 6); if (null == IdCardUtil.DISTRICT_CODES.get(districtCode)) { return OutDTO.Error("区域代码不正确:" + districtCode); } //校验生日 if (false == IdCardUtil.isBirthday("19" + idCard.substring(6, 12))) { return OutDTO.Error("生日格式不正确:" + idCard.substring(6, 12)); } return OutDTO.OK("身份证格式正确"); }
AST#method_declaration#Left static isValidCard15 AST#parameter_list#Left ( AST#parameter#Left idCard : 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 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#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#member_expression#Left AST#expression#Left IdCardUtil AST#expression#Right . PROVINCE_CODES AST#member_expression#Right AST#expression#Right . size 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 IdCardUtil AST#expression#Right . init 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#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 IdCardUtil AST#expression#Right . CHINA_ID_MIN_LENGTH AST#member_expression#Right AST#expression#Right != AST#expression#Left idCard AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#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 OutDTO AST#expression#Right . Error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "身份证长度不足15位" 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#if_statement#Right AST#statement#Right // 省份 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left proCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left idCard 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 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left "0000" AST#expression#Right AST#binary_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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right == AST#expression#Left IdCardUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . PROVINCE_CODES AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left proCode 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . Error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "省份代码不正确:" AST#expression#Right + AST#expression#Left proCode AST#expression#Right AST#binary_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#if_statement#Right AST#statement#Right //城市 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cityCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left idCard 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 4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left "00" AST#expression#Right AST#binary_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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right == AST#expression#Left IdCardUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . CITY_CODES AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cityCode 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . Error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "城市代码不正确:" AST#expression#Right + AST#expression#Left cityCode AST#expression#Right AST#binary_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#if_statement#Right AST#statement#Right //乡镇 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left districtCode : AST#type_annotation#Left AST#primary_type#Left string 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 idCard 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 6 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right == AST#expression#Left IdCardUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . DISTRICT_CODES AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left districtCode 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . Error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "区域代码不正确:" AST#expression#Right + AST#expression#Left districtCode AST#expression#Right AST#binary_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#if_statement#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#binary_expression#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right == AST#expression#Left IdCardUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBirthday 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 "19" AST#expression#Right + AST#expression#Left idCard AST#expression#Right AST#binary_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 AST#expression#Right , AST#expression#Left 12 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#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 OutDTO AST#expression#Right . Error 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#expression#Right + AST#expression#Left idCard AST#expression#Right AST#binary_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 AST#expression#Right , AST#expression#Left 12 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OK 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 isValidCard15(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } if (IdCardUtil.CHINA_ID_MIN_LENGTH != idCard.length) { return OutDTO.Error("身份证长度不足15位"); } let proCode: string = idCard.substring(0, 2) + "0000"; if (null == IdCardUtil.PROVINCE_CODES.get(proCode)) { return OutDTO.Error("省份代码不正确:" + proCode); } let cityCode: string = idCard.substring(0, 4) + "00"; if (null == IdCardUtil.CITY_CODES.get(cityCode)) { return OutDTO.Error("城市代码不正确:" + cityCode); } let districtCode: string = idCard.substring(0, 6); if (null == IdCardUtil.DISTRICT_CODES.get(districtCode)) { return OutDTO.Error("区域代码不正确:" + districtCode); } if (false == IdCardUtil.isBirthday("19" + idCard.substring(6, 12))) { return OutDTO.Error("生日格式不正确:" + idCard.substring(6, 12)); } return OutDTO.OK("身份证格式正确"); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L152-L186
f2e66a3d23d35008f8eedf865037bf8b9e3bba2d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/MultiThreadConcurrencyOverview/entry/src/main/ets/pages/Index.ets
arkts
produce
跨线程并发任务
@Concurrent async function produce(): Promise<number> { // 添加生产相关逻辑 console.info('producing...'); return Math.random(); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function produce 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#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 'producing...' 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#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 ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#decorated_function_declaration#Right
@Concurrent async function produce(): Promise<number> { console.info('producing...'); return Math.random(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/MultiThreadConcurrencyOverview/entry/src/main/ets/pages/Index.ets#L20-L25
8e6772900a5c17791503b8b1ae3ff2d6e4a4ef44
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
年份范围接口
export interface YearRange { min: number; max: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface YearRange AST#object_type#Left { AST#type_member#Left min : 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 max : AST#type_annotation#Left AST#primary_type#Left number 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 YearRange { min: number; max: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L55-L58
c45234976ab73ea60afc2431c493eda855a0bf75
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): TabDataModel { return this.dataArray[index]; }
AST#method_declaration#Left public getData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left TabDataModel AST#primary_type#Right AST#type_annotation#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 . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getData(index: number): TabDataModel { return this.dataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets#L132-L134
00a809bb56a61e49b2471de26e49cb9421aa9498
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/radio/radioBuild.ets
arkts
RadioBuildBuilder
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.
@Builder export function RadioBuildBuilder(name: string, param: Object) { RadioBuildExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function RadioBuildBuilder 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#Left param : AST#type_annotation#Left AST#primary_type#Left Object 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 RadioBuildExample ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function RadioBuildBuilder(name: string, param: Object) { RadioBuildExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/radio/radioBuild.ets#L16-L19
02ea267ec990f39b197a5706a160a45b6436d655
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
removeSpec
删除商品规格 @param {number} goodsId 商品ID @param {number} specId 规格ID @returns {Promise<void>} Promise<void>
async removeSpec(goodsId: number, specId: number): Promise<void> { await this.cartRepository.removeSpecFromCart(goodsId, specId); // 更新本地数据 for (let i = 0; i < this.cartList.length; i++) { const cart = this.cartList[i]; if (cart.goodsId === goodsId) { cart.spec = cart.spec.filter((s: CartGoodsSpec): boolean => s.id !== specId); if (cart.spec.length === 0) { this.cartList.splice(i, 1); } break; } } // 移除选中状态 const key = `${goodsId}_${specId}`; const newSet = new Set(this.selectedSpecIds); newSet.delete(key); this.selectedSpecIds = newSet; // 触发响应式更新 this.cartList = [...this.cartList]; }
AST#method_declaration#Left async removeSpec AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : 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 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#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 . cartRepository AST#member_expression#Right AST#expression#Right . removeSpecFromCart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right , AST#expression#Left specId 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . cartList 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 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 cart = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right === AST#expression#Left goodsId 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 cart AST#expression#Right . spec AST#member_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 cart AST#expression#Right . spec 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 AST#parameter_list#Left ( AST#parameter#Left s : AST#type_annotation#Left AST#primary_type#Left CartGoodsSpec 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#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left specId 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#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#member_expression#Left AST#expression#Left cart AST#expression#Right . spec 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i 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#if_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#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left goodsId AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left specId 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#variable_declaration#Left const AST#variable_declarator#Left newSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedSpecIds 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 newSet AST#expression#Right . delete 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedSpecIds AST#member_expression#Right = AST#expression#Left newSet 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 . cartList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async removeSpec(goodsId: number, specId: number): Promise<void> { await this.cartRepository.removeSpecFromCart(goodsId, specId); for (let i = 0; i < this.cartList.length; i++) { const cart = this.cartList[i]; if (cart.goodsId === goodsId) { cart.spec = cart.spec.filter((s: CartGoodsSpec): boolean => s.id !== specId); if (cart.spec.length === 0) { this.cartList.splice(i, 1); } break; } } const key = `${goodsId}_${specId}`; const newSet = new Set(this.selectedSpecIds); newSet.delete(key); this.selectedSpecIds = newSet; this.cartList = [...this.cartList]; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L192-L212
55ef739820104dbc400fc08b3efc3f2262e8c9fb
github
flowerca/arkTs--Menu-APP.git
2d41960e707ccc69ce2ad2f12c8b9b1ac9106ec1
entry/src/main/ets/pages/RecommendationPage.ets
arkts
RecommendationPage
@Entry @Preview
@Component export default struct RecommendationPage { @State menucontent:Array<MenuModel>=[] private swiperController: SwiperController = new SwiperController() aboutToAppear(){ this.menucontent=new Menudata().getmenuData() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RecommendationPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right menucontent : 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 MenuModel 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#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperController 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#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . menucontent 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#new_expression#Left new AST#expression#Left Menudata 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 . getmenuData 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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct RecommendationPage { @State menucontent:Array<MenuModel>=[] private swiperController: SwiperController = new SwiperController() aboutToAppear(){ this.menucontent=new Menudata().getmenuData() }
https://github.com/flowerca/arkTs--Menu-APP.git/blob/2d41960e707ccc69ce2ad2f12c8b9b1ac9106ec1/entry/src/main/ets/pages/RecommendationPage.ets#L6-L14
ad250912d5767a47164c74119c86658959a30590
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
initRdbStore
初始化数据库 @param context 上下文
public async initRdbStore(context: common.Context): Promise<void> { logger.info(TAG, 'init rdbStore begin'); if (!context) { logger.error(TAG, 'initRdbStore context is invalid'); return; } if (this.rdbStore) { logger.info(TAG, 'rdbStore is exist'); return; } try { this.rdbStore = await rdb.getRdbStore(context, STORE_CONFIG); logger.info(TAG, 'getRdbStore succeed'); await this.createTable(); } catch (err) { logger.error(TAG, `getRdbStore failed, err: ${err}`); return; } }
AST#method_declaration#Left public async initRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context 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 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#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 'init rdbStore begin' 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#unary_expression#Left ! AST#expression#Left context 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 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 'initRdbStore context is invalid' 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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore 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 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 'rdbStore is exist' 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#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 . rdbStore 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 rdb AST#expression#Right AST#await_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left STORE_CONFIG 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 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 'getRdbStore succeed' 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 . createTable 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#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#template_literal#Left ` getRdbStore failed, err: 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#statement#Left AST#return_statement#Left return ; 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
public async initRdbStore(context: common.Context): Promise<void> { logger.info(TAG, 'init rdbStore begin'); if (!context) { logger.error(TAG, 'initRdbStore context is invalid'); return; } if (this.rdbStore) { logger.info(TAG, 'rdbStore is exist'); return; } try { this.rdbStore = await rdb.getRdbStore(context, STORE_CONFIG); logger.info(TAG, 'getRdbStore succeed'); await this.createTable(); } catch (err) { logger.error(TAG, `getRdbStore failed, err: ${err}`); return; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L52-L72
e12917d8b8d74f8313961165951c390e12a408ee
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/CorePage.ets
arkts
构建核心页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.core"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.CoreContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.core" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . leftInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . rightInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#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 . CoreContent 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#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
build() { AppNavDestination({ title: $r("app.string.core"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.CoreContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L41-L53
4a1d9d96823fc8d209f53e618da6a6b3260522a8
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/features/pictureView/src/main/ets/view/BottomBar.ets
arkts
BottomBar
底部操作栏
@Component export struct BottomBar { build() { Flex({ justifyContent: FlexAlign.Center, direction: FlexDirection.Row }) { ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { Column() { Image(item.icon) .height(BaseConstants.DEFAULT_ICON_SIZE) .width(BaseConstants.DEFAULT_ICON_SIZE) Text(item.icon_name) .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) .fontSize(BaseConstants.FONT_SIZE_TEN) .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) .padding({ top: $r('app.float.icon_padding_top') }) } .width(PictureViewConstants.ICON_LIST_WIDTH) }, (item: ActionInterface, index: number) => index + JSON.stringify(item)) } .height($r('app.float.icon_list_height')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomBar AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left PictureViewConstants AST#expression#Right . ACTIONS AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ActionInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . icon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left BaseConstants AST#expression#Right . DEFAULT_ICON_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left BaseConstants AST#expression#Right . DEFAULT_ICON_SIZE AST#member_expression#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#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 item AST#expression#Right . icon_name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left AST#member_expression#Left AST#expression#Left BaseConstants AST#expression#Right . FONT_FAMILY_NORMAL AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left BaseConstants AST#expression#Right . FONT_SIZE_TEN AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left BaseConstants AST#expression#Right . FONT_WEIGHT_FOUR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( 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.float.icon_padding_top' 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#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 AST#member_expression#Left AST#expression#Left PictureViewConstants AST#expression#Right . ICON_LIST_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ActionInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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_list#Right => AST#expression#Left AST#call_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 JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify 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#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.icon_list_height' 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct BottomBar { build() { Flex({ justifyContent: FlexAlign.Center, direction: FlexDirection.Row }) { ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => { Column() { Image(item.icon) .height(BaseConstants.DEFAULT_ICON_SIZE) .width(BaseConstants.DEFAULT_ICON_SIZE) Text(item.icon_name) .fontFamily(BaseConstants.FONT_FAMILY_NORMAL) .fontSize(BaseConstants.FONT_SIZE_TEN) .fontWeight(BaseConstants.FONT_WEIGHT_FOUR) .padding({ top: $r('app.float.icon_padding_top') }) } .width(PictureViewConstants.ICON_LIST_WIDTH) }, (item: ActionInterface, index: number) => index + JSON.stringify(item)) } .height($r('app.float.icon_list_height')) } }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/src/main/ets/view/BottomBar.ets#L7-L30
133b1965a77d07ecaee4db5a1a6ee7a0773c5c3b
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets
arkts
value
默认选中项 @param value @returns
value(value: string | string[]) { this.builderOptions.value = value return this }
AST#method_declaration#Left value AST#parameter_list#Left ( 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 AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_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 . 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#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
value(value: string | string[]) { this.builderOptions.value = value return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L29-L32
a63e4af29702439ca7fe1412625815d53e4a23b6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets
arkts
bottomRightListItem
下部分右侧纵向滚动列表里的每一行参数信息 @param item 展示数据
@Builder bottomRightListItem(item: ShowData) { // TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销 LazyForEach(item.sub, (partInfo: PartInfo, key: number) => { ListItem() { ItemComponent({ listContent: partInfo.info, scroller: item.scrollerArray[key], // 展示内容横向滚动时,控制顶部标题的滚动控制器和每一行内容的滚动控制器,保持联动 scrollCallback: (value) => { // 顶部车型列表保持联动 this.topListScroller.scrollTo({ xOffset: value, yOffset: 0 }); // list列表滚动到指定index后的额外偏移量 let offsetX = value - this.scrollerIndex * LIST_ITEM_WIDTH; if (item.scrollerArray[key].currentOffset().xOffset === 0) { offsetX = 0; } this.showDataArray.forEach((showData: ShowData) => { // 通过scroller数组保持联动 showData.scrollerArray.forEach((scroller: Scroller) => { if (scroller !== item.scrollerArray[key]) { // 其余List与当前正在滑动的List的索引号和额外偏移量保持一致 scroller.scrollToIndex(this.scrollerIndex, false, ScrollAlign.START, { extraOffset: LengthMetrics.vp(offsetX) }); } }) }) }, // 展示内容横向滚动时,实时传回滚动偏移量 remainOffsetCallback: (index) => { this.scrollerIndex = index; } }); } .id(`bottomRightListItem${key}`) }, (partInfo: PartInfo, key: number) => partInfo.part + key); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomRightListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ShowData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销 AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . sub AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left partInfo : AST#type_annotation#Left AST#primary_type#Left PartInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left ItemComponent ( AST#component_parameters#Left { AST#component_parameter#Left listContent : AST#expression#Left AST#member_expression#Left AST#expression#Left partInfo AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . scrollerArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#component_parameter#Right , // 展示内容横向滚动时,控制顶部标题的滚动控制器和每一行内容的滚动控制器,保持联动 AST#component_parameter#Left scrollCallback : 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#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 . topListScroller AST#member_expression#Right AST#expression#Right . scrollTo 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 xOffset AST#property_name#Right : AST#expression#Left value AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left yOffset AST#property_name#Right : AST#expression#Left 0 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 // list列表滚动到指定index后的额外偏移量 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetX = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scrollerIndex AST#member_expression#Right AST#expression#Right * AST#expression#Left LIST_ITEM_WIDTH AST#expression#Right AST#binary_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#call_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 item AST#expression#Right . scrollerArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . currentOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . xOffset 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#assignment_expression#Left offsetX = 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#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 . showDataArray AST#member_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 showData : AST#type_annotation#Left AST#primary_type#Left ShowData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 通过scroller数组保持联动 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 showData AST#expression#Right . scrollerArray AST#member_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 scroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left scroller AST#expression#Right !== AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . scrollerArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { // 其余List与当前正在滑动的List的索引号和额外偏移量保持一致 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left scroller AST#expression#Right . scrollToIndex 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 . scrollerIndex AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollAlign AST#expression#Right . START AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left extraOffset AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#expression#Right ) 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#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#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#component_parameter#Right , // 展示内容横向滚动时,实时传回滚动偏移量 AST#component_parameter#Left remainOffsetCallback : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index 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 . scrollerIndex AST#member_expression#Right = AST#expression#Left index 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#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#template_literal#Left ` bottomRightListItem AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left partInfo : AST#type_annotation#Left AST#primary_type#Left PartInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : 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#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partInfo AST#expression#Right . part AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder bottomRightListItem(item: ShowData) { LazyForEach(item.sub, (partInfo: PartInfo, key: number) => { ListItem() { ItemComponent({ listContent: partInfo.info, scroller: item.scrollerArray[key], scrollCallback: (value) => { this.topListScroller.scrollTo({ xOffset: value, yOffset: 0 }); let offsetX = value - this.scrollerIndex * LIST_ITEM_WIDTH; if (item.scrollerArray[key].currentOffset().xOffset === 0) { offsetX = 0; } this.showDataArray.forEach((showData: ShowData) => { showData.scrollerArray.forEach((scroller: Scroller) => { if (scroller !== item.scrollerArray[key]) { scroller.scrollToIndex(this.scrollerIndex, false, ScrollAlign.START, { extraOffset: LengthMetrics.vp(offsetX) }); } }) }) }, remainOffsetCallback: (index) => { this.scrollerIndex = index; } }); } .id(`bottomRightListItem${key}`) }, (partInfo: PartInfo, key: number) => partInfo.part + key); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L215-L251
c65cf6133a6437d68fc6739f9b42e02cea07e973
gitee
MissTeven/ArkTS-demo.git
fd9f7695fa29889ad4a9ecf3330fda9991aca24c
entry/src/main/ets/view/MinePageContentComponent.ets
arkts
MinePageContentComponent
Personal page component.
@Component export default struct MinePageContentComponent { build() { Column() { List() { ForEach(LoginPageViewModel.getPersonalListItems(), (item: ListItemData) => { ListItem() { MinePageItemComponent({ itemTitle: item.title }) } }, (item, index) => index + JSON.stringify(item)) } .divider({ strokeWidth: $r('app.float.divider_stroke_width'), color: $r('app.color.item_divider') }) } .backgroundColor(Color.White) .margin({ top: $r('app.float.mine_content_column_margin_top') }) .border({ radius: $r('app.float.mine_content_column_border') }) .padding({ left: $r('app.float.mine_content_column_padding_left'), top: $r('app.float.mine_content_column_padding_top'), right: $r('app.float.mine_content_column_padding_right'), bottom: $r('app.float.mine_content_column_padding_top') }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MinePageContentComponent AST#component_body#Left { 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 List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LoginPageViewModel AST#expression#Right . getPersonalListItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MinePageItemComponent ( AST#component_parameters#Left { AST#component_parameter#Left itemTitle : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . title 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_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 JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify 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#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.divider_stroke_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.item_divider' 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#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 . 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.mine_content_column_margin_top' 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#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.mine_content_column_border' 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#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.mine_content_column_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.float.mine_content_column_padding_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.mine_content_column_padding_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.float.mine_content_column_padding_top' 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#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 default struct MinePageContentComponent { build() { Column() { List() { ForEach(LoginPageViewModel.getPersonalListItems(), (item: ListItemData) => { ListItem() { MinePageItemComponent({ itemTitle: item.title }) } }, (item, index) => index + JSON.stringify(item)) } .divider({ strokeWidth: $r('app.float.divider_stroke_width'), color: $r('app.color.item_divider') }) } .backgroundColor(Color.White) .margin({ top: $r('app.float.mine_content_column_margin_top') }) .border({ radius: $r('app.float.mine_content_column_border') }) .padding({ left: $r('app.float.mine_content_column_padding_left'), top: $r('app.float.mine_content_column_padding_top'), right: $r('app.float.mine_content_column_padding_right'), bottom: $r('app.float.mine_content_column_padding_top') }) } }
https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/view/MinePageContentComponent.ets#L8-L36
dc46bc2c32c5c4da98893d7939d0a08e16f926ca
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets
arkts
getResourceItem
获取账单来源单项数据
public getResourceItem(key: number): BalanceResourceItem { const list = key > 200 ? this.displayIncomeResource : this.displayExpenseResource; const resource = list.find((item) => item.key === key)!; return resource; }
AST#method_declaration#Left public getResourceItem AST#parameter_list#Left ( AST#parameter#Left key : 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 BalanceResourceItem AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left list = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left key AST#expression#Right > AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayIncomeResource AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . displayExpenseResource 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 resource = 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 list AST#expression#Right . find 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#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#return_statement#Left return AST#expression#Left resource AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getResourceItem(key: number): BalanceResourceItem { const list = key > 200 ? this.displayIncomeResource : this.displayExpenseResource; const resource = list.find((item) => item.key === key)!; return resource; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L80-L85
37ec948a95dcc3889bdac4e708b6bd5f9212854a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
verifySync
对数据进行验签,同步 @param dataBlob 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。 @returns
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean { return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName); }
AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256|SM3' AST#expression#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left algName 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 verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean { return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L249-L252
945956942a0569c773ab7e3353ab49fcd687fa36
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets
arkts
@Author csx @DateTime 2024/7/24 00:39 @TODO EfRcpClientApi rcp请求工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp
export class EfRcpClientApi { /** * 构建请求的header * @param headers 传入的自定义header * @returns 拼接完公共系列全部完整header */ private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders { //需要添加的header对象 let addHead: rcp.RequestHeaders = {}; //是否需要拼接token if (efRcpConfig.token.tokenValue) { if (efRcpConfig.token.tokenName && efRcpConfig.token.tokenName != 'authorization') { addHead[efRcpConfig.token.tokenName] = efRcpConfig.token.tokenValue; } else { addHead.authorization = efRcpConfig.token.tokenValue; } } //获取全局header配置 let cfg = efRcp.builder().configuration; //如果配置中有headers if (cfg && cfg.headers) { Object.entries(cfg.headers).forEach((row) => { addHead[row[0]] = row[1]; }); } //是否有传入header if (headers) { Object.entries(headers).forEach((row) => { addHead[row[0]] = row[1]; }); } if (!addHead["content-type"]) { addHead['content-type'] = "application/json"; } return addHead; } /** * 构建请求的cookies * @param headers 传入的自定义cookies * @returns 拼接完公共系列全部完整cookies */ private static buildCookies(cookies?: Record<string, string>): rcp.RequestCookies { //需要添加的header对象 let addCookie: rcp.RequestCookies = {}; //获取全局header配置 let cfg = efRcp.builder().configuration; //如果配置中有headers if (cfg && cfg.cookies) { Object.entries(cfg.cookies).forEach((row) => { addCookie[row[0]] = row[1]; }); } //是否有传入header if (cookies) { Object.entries(cookies).forEach((row) => { addCookie[row[0]] = row[1]; }); } return addCookie; } /** * 构建当前请求的证书配置 * @param security 当前请求证书配置 * @returns */ private static buildSecurity(security: efRcpConfig.securityCfg): rcp.SecurityConfiguration { let securityCfg: rcp.SecurityConfiguration = { remoteValidation: security.remoteValidation, serverAuthentication: security.serverAuthentication, certificate: security.certificate } return securityCfg; } /** * 构建请求对象 * @param url 请求url * @param method 请求方式 * @param headers 请求头 * @param cookies 自定义cookie * @param isSecurity 是否开启证书加密 * @param loadingTxt 是否覆写loading文本 * @param loading 是否开启全局加载框 * @param loadingColor loading加载框的背景颜色 默认为 #aa000000 * @returns */ private static async buildRequest(url: string, method: string, headers?: Record<string, string>, cookies?: Record<string, string>, loadingTxt?: string, baseURL?: string, loading?: boolean, loadingColor?: string): Promise<rcp.Request> { //是否开启全局loading if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { await RcpLoadingUtil.showLoading({ content: loadingTxt ? loadingTxt : efRcpConfig.loading.content, imgLayout: RcpImgLayout.TOP, layoutShape: RcpLoadingShape.SQUARE, winBgColor: loadingColor ? loadingColor : '#aa000000' }); } //创建请求 if (baseURL) { url = baseURL + url } let request = new rcp.Request(url, method, EfRcpClientApi.buildHeaders(headers), undefined, EfRcpClientApi.buildCookies(cookies)); //返回 return request; } /** * 构建响应对象 * @param request 请求 * @param isSecurity 是否开启证书校验 * @param loading 是否临时控制Loading * @returns */ private static async buildResponse<E>(request: rcp.Request, cls?: ClassConstructor<E>, securityCfg?: efRcpConfig.securityCfg, loading?: boolean): Promise<EfRcpResponse<E>> { try { //是否针对当前请求开启证书加密 if (securityCfg) { if (request.configuration) { if (securityCfg) { request.configuration.security = EfRcpClientApi.buildSecurity(securityCfg) } } else { if (securityCfg) { request.configuration = { security: EfRcpClientApi.buildSecurity(securityCfg) } } } } //发送请求 let response = await efRcp.builder().fetch(request); if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { //关闭loading await RcpLoadingUtil.closeLoading(); } //此处需要处理如果返回的data为null则页面端无任何提示 let result = response.toJSON(); if (result) { //response.toJSON后的数据为Object类型,此处考虑转换为E类型 if (cls) { let clsObj = plainToInstance(cls, response.toJSON()) return { data: clsObj }; } else { return { data: result as E }; } } else { //此处新增如果是非字符串类型则直接返回 if (response.statusCode == 200) { return { data: response.body as E }; } let errStr = 'efRcp解析【' + request.method + '】结果异常~'; //此处优化为调用者传入是否直接返回对应的字符串信息 if (efRcpConfig.isConvertError) { errStr = response.toString() as string; } return { error: new EfRcpError(response.statusCode, request.method + '请求异常提醒', errStr) }; } } catch (e) { if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { //关闭loading await RcpLoadingUtil.closeLoading(); } //此处进行实例化操作后,接口调用处可使用内部封装的一系列方法 if (e instanceof EfRcpError) { let efRcpError = new EfRcpError(e.code, e.name, e.message, e.stack); //抛出 return Promise.reject(efRcpError); } let b = e as BusinessError<Object>; if (b.data) { b.message = b.data as string; } let efRcpError = new EfRcpError(b.code, b.name, b.message, b.stack); //抛出 return Promise.reject({ error: efRcpError }); } }
AST#export_declaration#Left export AST#class_declaration#Left class EfRcpClientApi AST#class_body#Left { /** * 构建请求的header * @param headers 传入的自定义header * @returns 拼接完公共系列全部完整header */ AST#method_declaration#Left private static buildHeaders AST#parameter_list#Left ( AST#parameter#Left headers ? : 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#qualified_type#Left rcp . RequestHeaders AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //需要添加的header对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left addHead : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestHeaders AST#qualified_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 //是否需要拼接token 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 efRcpConfig AST#expression#Right . token AST#member_expression#Right AST#expression#Right . tokenValue AST#member_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#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 efRcpConfig AST#expression#Right . token AST#member_expression#Right AST#expression#Right . tokenName AST#member_expression#Right AST#expression#Right && AST#expression#Left efRcpConfig AST#expression#Right AST#binary_expression#Right AST#expression#Right . token AST#member_expression#Right AST#expression#Right . tokenName AST#member_expression#Right AST#expression#Right != AST#expression#Left 'authorization' 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addHead AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcpConfig AST#expression#Right . token AST#member_expression#Right AST#expression#Right . tokenName AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = efRcpConfig AST#ERROR#Right . token AST#member_expression#Right AST#expression#Right . tokenValue AST#member_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 addHead AST#expression#Right . authorization AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcpConfig AST#expression#Right . token AST#member_expression#Right AST#expression#Right . tokenValue 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#if_statement#Right AST#statement#Right //获取全局header配置 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cfg = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcp AST#expression#Right . builder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . configuration AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //如果配置中有headers 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 cfg AST#expression#Right && AST#expression#Left cfg AST#expression#Right AST#binary_expression#Right AST#expression#Right . headers 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cfg AST#expression#Right . headers AST#member_expression#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 AST#parameter_list#Left ( AST#parameter#Left row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addHead AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right //是否有传入header AST#statement#Left AST#if_statement#Left if ( AST#expression#Left headers 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left headers 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 row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addHead AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left addHead AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left "content-type" AST#expression#Right ] AST#subscript_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 addHead AST#expression#Right [ AST#expression#Left 'content-type' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left "application/json" 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 addHead AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 构建请求的cookies * @param headers 传入的自定义cookies * @returns 拼接完公共系列全部完整cookies */ AST#method_declaration#Left private static buildCookies AST#parameter_list#Left ( AST#parameter#Left cookies ? : 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#qualified_type#Left rcp . RequestCookies AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //需要添加的header对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left addCookie : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestCookies AST#qualified_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 //获取全局header配置 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cfg = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcp AST#expression#Right . builder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . configuration AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //如果配置中有headers 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 cfg AST#expression#Right && AST#expression#Left cfg AST#expression#Right AST#binary_expression#Right AST#expression#Right . cookies 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cfg AST#expression#Right . cookies AST#member_expression#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 AST#parameter_list#Left ( AST#parameter#Left row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addCookie AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right //是否有传入header AST#statement#Left AST#if_statement#Left if ( AST#expression#Left cookies 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cookies 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 row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addCookie AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left addCookie AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 构建当前请求的证书配置 * @param security 当前请求证书配置 * @returns */ AST#method_declaration#Left private static buildSecurity AST#parameter_list#Left ( AST#parameter#Left security : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . securityCfg 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#qualified_type#Left rcp . SecurityConfiguration 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 securityCfg : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . SecurityConfiguration AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left remoteValidation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left security AST#expression#Right . remoteValidation AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serverAuthentication AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left security AST#expression#Right . serverAuthentication AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left certificate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left security AST#expression#Right . certificate 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 securityCfg AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 构建请求对象 * @param url 请求url * @param method 请求方式 * @param headers 请求头 * @param cookies 自定义cookie * @param isSecurity 是否开启证书加密 * @param loadingTxt 是否覆写loading文本 * @param loading 是否开启全局加载框 * @param loadingColor loading加载框的背景颜色 默认为 #aa000000 * @returns */ AST#method_declaration#Left private static async buildRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left headers ? : 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#Left cookies ? : 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#Left loadingTxt ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left baseURL ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loading ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loadingColor ? : 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#qualified_type#Left rcp . Request 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 { //是否开启全局loading AST#ERROR#Left if ( AST#expression#Left loading AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left loading AST#expression#Right AST#ERROR#Left : loading AST#ERROR#Right == AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#ERROR#Left loading : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . loading . enable AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) { AST#ERROR#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left RcpLoadingUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . showLoading AST#member_expression#Right AST#expression#Right ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left loadingTxt AST#expression#Right AST#property_assignment#Right AST#ERROR#Left ? loadingTxt : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . loading . content AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#property_assignment#Left AST#property_name#Left imgLayout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RcpImgLayout AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left layoutShape AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RcpLoadingShape AST#expression#Right . SQUARE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left winBgColor AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left loadingColor AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left loadingColor : AST#ERROR#Left '#aa000000' } ) ; } //创建请求 if AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left baseURL AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right { AST#property_name#Left url AST#property_name#Right = b AST#ERROR#Right as AST#type_annotation#Left AST#primary_type#Left eURL AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right + AST#expression#Left url AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left request = 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 rcp AST#expression#Right AST#new_expression#Right AST#expression#Right . Request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left method AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfRcpClientApi AST#expression#Right . buildHeaders AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left headers AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfRcpClientApi AST#expression#Right . buildCookies AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cookies 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //返回 AST#statement#Left AST#return_statement#Left return AST#expression#Left request AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 构建响应对象 * @param request 请求 * @param isSecurity 是否开启证书校验 * @param loading 是否临时控制Loading * @returns */ AST#method_declaration#Left private static async buildResponse AST#type_parameters#Left < AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Request AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cls ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ClassConstructor AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E 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 securityCfg ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . securityCfg AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loading ? : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left EfRcpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E 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#if_statement#Left if ( AST#expression#Left securityCfg AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . configuration AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left securityCfg 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#member_expression#Left AST#expression#Left request AST#expression#Right . configuration AST#member_expression#Right AST#expression#Right . security AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfRcpClientApi AST#expression#Right . buildSecurity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left securityCfg 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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left securityCfg 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 request AST#expression#Right . configuration AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left security AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfRcpClientApi AST#expression#Right . buildSecurity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left securityCfg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //发送请求 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response = 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#await_expression#Left await AST#expression#Left efRcp AST#expression#Right AST#await_expression#Right AST#expression#Right . builder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fetch 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left if ( AST#expression#Left loading AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left loading AST#expression#Right AST#ERROR#Left : loading AST#ERROR#Right == AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#ERROR#Left loading : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . loading . enable AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) { AST#ERROR#Right //关闭loading 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 RcpLoadingUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . closeLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#Right } AST#block_statement#Right AST#try_statement#Right AST#statement#Right //此处需要处理如果返回的data为null则页面端无任何提示 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . toJSON 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 result AST#expression#Right ) AST#block_statement#Left { //response.toJSON后的数据为Object类型,此处考虑转换为E类型 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left cls AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clsObj = AST#expression#Left AST#call_expression#Left AST#expression#Left plainToInstance AST#expression#Right AST#argument_list#Left ( AST#expression#Left cls AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . toJSON 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 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 clsObj 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 else 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#as_expression#Left AST#expression#Left result AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right AST#as_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#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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 response AST#expression#Right . statusCode AST#member_expression#Right AST#expression#Right == AST#expression#Left 200 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . body AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right AST#as_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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left errStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'efRcp解析【' AST#expression#Right + AST#expression#Left request AST#expression#Right AST#binary_expression#Right AST#expression#Right . method AST#member_expression#Right AST#expression#Right + AST#expression#Left '】结果异常~' AST#expression#Right AST#binary_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 efRcpConfig AST#expression#Right . isConvertError 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 errStr = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response 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 as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_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#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EfRcpError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . statusCode AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . method AST#member_expression#Right AST#expression#Right + AST#expression#Left '请求异常提醒' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left errStr AST#expression#Right ) AST#argument_list#Right AST#call_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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left catch AST#parameter_list#Left ( AST#parameter#Left e AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#ERROR#Left if ( AST#expression#Left loading AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left loading AST#expression#Right AST#ERROR#Left : loading AST#ERROR#Right == AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#ERROR#Left loading : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . loading . enable AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) { AST#ERROR#Right //关闭loading AST#ERROR#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 AST#await_expression#Left await AST#expression#Left RcpLoadingUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . closeLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left ; } //此处进行实例化操作后,接口调用处可使用内部封装的一系列方法 if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right instanceof AST#expression#Left EfRcpError AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right { let efRcpError = AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EfRcpError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . stack AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#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 Promise AST#expression#Right . reject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left efRcpError 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#property_declaration#Left let AST#ERROR#Left b AST#ERROR#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left e AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BusinessError AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Object 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#property_declaration#Right AST#method_declaration#Left if AST#parameter_list#Left ( AST#parameter#Left b AST#parameter#Right AST#ERROR#Left . data AST#ERROR#Right ) 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 b AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . data AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_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 AST#property_declaration#Left let AST#ERROR#Left efRcpError AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EfRcpError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . message AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . stack AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right //抛出 AST#method_declaration#Left return AST#ERROR#Left Promise . reject AST#ERROR#Right AST#parameter_list#Left ( AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left error AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : efRcpError } ) ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class EfRcpClientApi { private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders { let addHead: rcp.RequestHeaders = {}; if (efRcpConfig.token.tokenValue) { if (efRcpConfig.token.tokenName && efRcpConfig.token.tokenName != 'authorization') { addHead[efRcpConfig.token.tokenName] = efRcpConfig.token.tokenValue; } else { addHead.authorization = efRcpConfig.token.tokenValue; } } let cfg = efRcp.builder().configuration; if (cfg && cfg.headers) { Object.entries(cfg.headers).forEach((row) => { addHead[row[0]] = row[1]; }); } if (headers) { Object.entries(headers).forEach((row) => { addHead[row[0]] = row[1]; }); } if (!addHead["content-type"]) { addHead['content-type'] = "application/json"; } return addHead; } private static buildCookies(cookies?: Record<string, string>): rcp.RequestCookies { let addCookie: rcp.RequestCookies = {}; let cfg = efRcp.builder().configuration; if (cfg && cfg.cookies) { Object.entries(cfg.cookies).forEach((row) => { addCookie[row[0]] = row[1]; }); } if (cookies) { Object.entries(cookies).forEach((row) => { addCookie[row[0]] = row[1]; }); } return addCookie; } private static buildSecurity(security: efRcpConfig.securityCfg): rcp.SecurityConfiguration { let securityCfg: rcp.SecurityConfiguration = { remoteValidation: security.remoteValidation, serverAuthentication: security.serverAuthentication, certificate: security.certificate } return securityCfg; } private static async buildRequest(url: string, method: string, headers?: Record<string, string>, cookies?: Record<string, string>, loadingTxt?: string, baseURL?: string, loading?: boolean, loadingColor?: string): Promise<rcp.Request> { if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { await RcpLoadingUtil.showLoading({ content: loadingTxt ? loadingTxt : efRcpConfig.loading.content, imgLayout: RcpImgLayout.TOP, layoutShape: RcpLoadingShape.SQUARE, winBgColor: loadingColor ? loadingColor : '#aa000000' }); } if (baseURL) { url = baseURL + url } let request = new rcp.Request(url, method, EfRcpClientApi.buildHeaders(headers), undefined, EfRcpClientApi.buildCookies(cookies)); return request; } private static async buildResponse<E>(request: rcp.Request, cls?: ClassConstructor<E>, securityCfg?: efRcpConfig.securityCfg, loading?: boolean): Promise<EfRcpResponse<E>> { try { if (securityCfg) { if (request.configuration) { if (securityCfg) { request.configuration.security = EfRcpClientApi.buildSecurity(securityCfg) } } else { if (securityCfg) { request.configuration = { security: EfRcpClientApi.buildSecurity(securityCfg) } } } } let response = await efRcp.builder().fetch(request); if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { await RcpLoadingUtil.closeLoading(); } let result = response.toJSON(); if (result) { if (cls) { let clsObj = plainToInstance(cls, response.toJSON()) return { data: clsObj }; } else { return { data: result as E }; } } else { if (response.statusCode == 200) { return { data: response.body as E }; } let errStr = 'efRcp解析【' + request.method + '】结果异常~'; if (efRcpConfig.isConvertError) { errStr = response.toString() as string; } return { error: new EfRcpError(response.statusCode, request.method + '请求异常提醒', errStr) }; } } catch (e) { if (loading ? loading : loading == false ? loading : efRcpConfig.loading.enable) { await RcpLoadingUtil.closeLoading(); } if (e instanceof EfRcpError) { let efRcpError = new EfRcpError(e.code, e.name, e.message, e.stack); return Promise.reject(efRcpError); } let b = e as BusinessError<Object>; if (b.data) { b.message = b.data as string; } let efRcpError = new EfRcpError(b.code, b.name, b.message, b.stack); return Promise.reject({ error: efRcpError }); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L39-L221
f4ca35591e7bb8e01ac0709cc2beb3ba5fd62b76
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/collections/set_002_F.ets
arkts
Introduction 集合-集合类型
export function set_002_F(taint_src : Set<string>) { let _t = taint_src; let _clean = new Set<string>(); _clean.add("a"); taint.Sink(_clean); }
AST#export_declaration#Left export AST#function_declaration#Left function set_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _t = AST#expression#Left taint_src 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 _clean = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right 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#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 _clean AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "a" 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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left _clean 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 set_002_F(taint_src : Set<string>) { let _t = taint_src; let _clean = new Set<string>(); _clean.add("a"); taint.Sink(_clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/set_002_F.ets#L5-L10
9ccb98dd32b77ae60b97aa5c41ebd8383c8abf80
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/MoodEntry.ets
arkts
toRow
Convert to database row format
toRow(): MoodEntryData { return { date: this.date, emotion: this.emotion, intensity: this.intensity, message_count: this.messageCount, timestamp: this.timestamp }; }
AST#method_declaration#Left toRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MoodEntryData AST#primary_type#Right AST#type_annotation#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 date AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left emotion AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . emotion AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left intensity AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intensity AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message_count AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . messageCount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timestamp 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#method_declaration#Right
toRow(): MoodEntryData { return { date: this.date, emotion: this.emotion, intensity: this.intensity, message_count: this.messageCount, timestamp: this.timestamp }; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L72-L80
bca6470b6bad7efbd3e2e89242bd7e64fc69cc8f
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
resumeTimer
继续计时(从暂停状态恢复,根据当前模式决定递增或递减)
private resumeTimer() { if (this.isRunning) { return; } this.isRunning = true; this.isPaused = false; this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中..."; this.statusPromptColor = Color.Green; // 计时回调函数 // 使用ArkTS推荐的计时器实现方式 const intervalCallback = () => { if (this.isIncrementing) { this.currentSeconds += 1; } else { if (this.currentSeconds <= 0) { if (this.isTimeout === '0') { this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时已结束"; this.statusPromptColor = Color.Red; this.closeDialog(); } else if (this.isTimeout === '1') { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Orange; this.toggleMode(); } } else { this.currentSeconds -= 1; } } // 自动触发UI更新 this.getTimeDigits(this.currentSeconds); }; // 立即执行一次,避免1秒延迟 intervalCallback(); // 立即执行一次,避免1秒延迟 intervalCallback(); // 设置定时器,每秒执行一次 try { this.timerId = setInterval(intervalCallback, 1000); } catch (error) { console.error(`设置计时器失败: ${error.message}`); this.isRunning = false; } }
AST#method_declaration#Left private resumeTimer 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#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 . isRunning 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 . isPaused 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPrompt AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalSeconds AST#member_expression#Right AST#expression#Right + AST#expression#Left '秒 ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "倒计时进行中..." 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPromptColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 计时回调函数 // 使用ArkTS推荐的计时器实现方式 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left intervalCallback = 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 this AST#expression#Right . isIncrementing 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 . currentSeconds 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#block_statement#Right else 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 . currentSeconds 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#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 . isTimeout 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPrompt AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalSeconds AST#member_expression#Right AST#expression#Right + AST#expression#Left '秒 ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "倒计时已结束" 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPromptColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red 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 . closeDialog 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 else 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 . isTimeout 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPrompt AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left '超时,' AST#expression#Right + AST#expression#Left "开始正向计时" 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusPromptColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Orange 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 . toggleMode 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#if_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 . currentSeconds 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#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 this AST#expression#Right . getTimeDigits 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 . currentSeconds 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#arrow_function#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 立即执行一次,避免1秒延迟 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left intervalCallback 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 // 立即执行一次,避免1秒延迟 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left intervalCallback 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#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 . timerId 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 intervalCallback AST#expression#Right , AST#expression#Left 1000 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#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 AST#template_literal#Left ` 设置计时器失败: 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRunning 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private resumeTimer() { if (this.isRunning) { return; } this.isRunning = true; this.isPaused = false; this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中..."; this.statusPromptColor = Color.Green; const intervalCallback = () => { if (this.isIncrementing) { this.currentSeconds += 1; } else { if (this.currentSeconds <= 0) { if (this.isTimeout === '0') { this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时已结束"; this.statusPromptColor = Color.Red; this.closeDialog(); } else if (this.isTimeout === '1') { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Orange; this.toggleMode(); } } else { this.currentSeconds -= 1; } } this.getTimeDigits(this.currentSeconds); }; intervalCallback(); intervalCallback(); try { this.timerId = setInterval(intervalCallback, 1000); } catch (error) { console.error(`设置计时器失败: ${error.message}`); this.isRunning = false; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L79-L121
f1d07de565baa17c4c32015479dbf24f10cf91d5
gitee
batiluoxuanwan/MomentFlow.git
e57aa461223abca74f48893afc2ccf7c2d73e9b8
frontend/entry/src/main/ets/api/DiaryApi.ets
arkts
create
创建日记
static async create(diary: DiaryDto): Promise<Diary | null> { return request<Diary>(BASE_URL, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify(diary) }) }
AST#method_declaration#Left static async create AST#parameter_list#Left ( AST#parameter#Left diary : AST#type_annotation#Left AST#primary_type#Left DiaryDto 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 Diary 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#return_statement#Left return 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 Diary AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left BASE_URL AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' 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 extraData AST#property_name#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 diary AST#expression#Right ) 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async create(diary: DiaryDto): Promise<Diary | null> { return request<Diary>(BASE_URL, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify(diary) }) }
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/DiaryApi.ets#L68-L74
ec49fca993d74770f71fd65587d0eccdfd0aa2b9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setHoleColor
Sets the color for the hole that is drawn in the center of the PieChart (if enabled). @param color
public setHoleColor(color: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color); }
AST#method_declaration#Left public setHoleColor AST#parameter_list#Left ( AST#parameter#Left color : 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ?. getPaintHole AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 setHoleColor(color: number): void { ( this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L432-L435
4e0e2fabcc6245db4ef4a84769e07536be00a039
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/viewPageItems/fragment_simple_pie_index.ets
arkts
initPieData
初始化饼状图数据
private initPieData(count: number, range: number): PieData { let entries = new JArrayList<PieEntry>(); for (let i = 0; i < count; i++) { entries.add(new PieEntry(((Math.random() * range) + range / 5), this.parties[i % this.parties.length])) } let dataSet: PieDataSet = new PieDataSet(entries, "Election Results"); dataSet.setDrawIcons(false); dataSet.setSliceSpace(1); dataSet.setIconsOffset(new MPPointF(0, 40)); dataSet.setSelectionShift(5); // add a lot of colors let colors: JArrayList<number> = new JArrayList(); for (let index = 0; index < ColorTemplate.VORDIPLOM_COLORS.length; index++) { colors.add(ColorTemplate.VORDIPLOM_COLORS[index]); } for (let index = 0; index < ColorTemplate.JOYFUL_COLORS.length; index++) { colors.add(ColorTemplate.JOYFUL_COLORS[index]); } for (let index = 0; index < ColorTemplate.COLORFUL_COLORS.length; index++) { colors.add(ColorTemplate.COLORFUL_COLORS[index]); } for (let index = 0; index < ColorTemplate.LIBERTY_COLORS.length; index++) { colors.add(ColorTemplate.LIBERTY_COLORS[index]); } for (let index = 0; index < ColorTemplate.PASTEL_COLORS.length; index++) { colors.add(ColorTemplate.PASTEL_COLORS[index]); } colors.add(ColorTemplate.getHoloBlue()); dataSet.setColorsByList(colors); return new PieData(dataSet) }
AST#method_declaration#Left private initPieData AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left range : 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 PieData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left entries = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieEntry 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entries AST#expression#Right . add 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 PieEntry AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#parenthesized_expression#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 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 * AST#expression#Left range AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left range AST#expression#Right / AST#expression#Left 5 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parties AST#member_expression#Right AST#expression#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 i AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . parties AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataSet : AST#type_annotation#Left AST#primary_type#Left PieDataSet 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 PieDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entries AST#expression#Right , AST#expression#Left "Election Results" 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 dataSet AST#expression#Right . setDrawIcons AST#member_expression#Right 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setSliceSpace 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#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 dataSet AST#expression#Right . setIconsOffset 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 MPPointF AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 40 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setSelectionShift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // add a lot of colors AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList 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#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 ColorTemplate AST#expression#Right AST#binary_expression#Right AST#expression#Right . VORDIPLOM_COLORS 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . VORDIPLOM_COLORS AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right 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 ColorTemplate AST#expression#Right AST#binary_expression#Right AST#expression#Right . JOYFUL_COLORS 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . JOYFUL_COLORS AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right 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 ColorTemplate AST#expression#Right AST#binary_expression#Right AST#expression#Right . COLORFUL_COLORS 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . COLORFUL_COLORS AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right 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 ColorTemplate AST#expression#Right AST#binary_expression#Right AST#expression#Right . LIBERTY_COLORS 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . LIBERTY_COLORS AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right 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 ColorTemplate AST#expression#Right AST#binary_expression#Right AST#expression#Right . PASTEL_COLORS 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . PASTEL_COLORS AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#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 colors AST#expression#Right . add 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 ColorTemplate AST#expression#Right . getHoloBlue 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 AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setColorsByList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left colors 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PieData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSet 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
private initPieData(count: number, range: number): PieData { let entries = new JArrayList<PieEntry>(); for (let i = 0; i < count; i++) { entries.add(new PieEntry(((Math.random() * range) + range / 5), this.parties[i % this.parties.length])) } let dataSet: PieDataSet = new PieDataSet(entries, "Election Results"); dataSet.setDrawIcons(false); dataSet.setSliceSpace(1); dataSet.setIconsOffset(new MPPointF(0, 40)); dataSet.setSelectionShift(5); let colors: JArrayList<number> = new JArrayList(); for (let index = 0; index < ColorTemplate.VORDIPLOM_COLORS.length; index++) { colors.add(ColorTemplate.VORDIPLOM_COLORS[index]); } for (let index = 0; index < ColorTemplate.JOYFUL_COLORS.length; index++) { colors.add(ColorTemplate.JOYFUL_COLORS[index]); } for (let index = 0; index < ColorTemplate.COLORFUL_COLORS.length; index++) { colors.add(ColorTemplate.COLORFUL_COLORS[index]); } for (let index = 0; index < ColorTemplate.LIBERTY_COLORS.length; index++) { colors.add(ColorTemplate.LIBERTY_COLORS[index]); } for (let index = 0; index < ColorTemplate.PASTEL_COLORS.length; index++) { colors.add(ColorTemplate.PASTEL_COLORS[index]); } colors.add(ColorTemplate.getHoloBlue()); dataSet.setColorsByList(colors); return new PieData(dataSet) }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/viewPageItems/fragment_simple_pie_index.ets#L50-L84
51b18ce9585394fc7fc4b66bfb49a28a9ab02ef2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
deleteTodo
删除代办事项
async deleteTodo(id: string): Promise<boolean> { try { const index = this.todos.findIndex(todo => todo.id === id); if (index === -1) { return false; } const deletedTodo = this.todos[index]; this.todos.splice(index, 1); this.recordOperation('delete', id, undefined, `删除代办事项: ${deletedTodo.title}`); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Deleted todo: ${id}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to delete todo: ${error}`); throw new Error('Failed to delete todo'); } }
AST#method_declaration#Left async deleteTodo 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 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 index = 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 . todos AST#member_expression#Right AST#expression#Right . findIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left todo => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left todo AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left id 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 index AST#expression#Right === AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 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#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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left deletedTodo = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todos AST#member_expression#Right AST#expression#Right [ AST#expression#Left index 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#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 . todos AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index 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#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 'delete' 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 deletedTodo 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#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 ` Deleted todo: 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#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 ( 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 delete todo: 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 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 'Failed to delete todo' 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#method_declaration#Right
async deleteTodo(id: string): Promise<boolean> { try { const index = this.todos.findIndex(todo => todo.id === id); if (index === -1) { return false; } const deletedTodo = this.todos[index]; this.todos.splice(index, 1); this.recordOperation('delete', id, undefined, `删除代办事项: ${deletedTodo.title}`); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Deleted todo: ${id}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to delete todo: ${error}`); throw new Error('Failed to delete todo'); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L266-L284
a51f3e090c8d129b522c7b66936d9686823948a8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets
arkts
setDataChangeListener
Set the data change listening function. @param callback Callback.
setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void { if (this.kvStore === undefined) { Logger.error('KvStoreModel', 'setDataChangeListener kvStore is null'); return; } try { this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL, (data: distributedKVStore.ChangeNotification) => { if ((data.updateEntries.length > 0) || (data.insertEntries.length > 0)) { callback(data); } }); } catch (error) { Logger.error('KvStoreModel', `setDataChangeListener on('dataChange') failed, err=${JSON.stringify(error)}`); } }
AST#method_declaration#Left setDataChangeListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . ChangeNotification 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#function_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#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 . kvStore AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'KvStoreModel' AST#expression#Right , AST#expression#Left 'setDataChangeListener kvStore is null' 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . kvStore AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'dataChange' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distributedKVStore AST#expression#Right . SubscribeType AST#member_expression#Right AST#expression#Right . SUBSCRIBE_TYPE_ALL AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . ChangeNotification 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_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 data AST#expression#Right . updateEntries 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#parenthesized_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_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 data AST#expression#Right . insertEntries 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#parenthesized_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 callback 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 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#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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'KvStoreModel' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` setDataChangeListener on('dataChange') failed, err= AST#template_substitution#Left $ { 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 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#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
setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void { if (this.kvStore === undefined) { Logger.error('KvStoreModel', 'setDataChangeListener kvStore is null'); return; } try { this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL, (data: distributedKVStore.ChangeNotification) => { if ((data.updateEntries.length > 0) || (data.insertEntries.length > 0)) { callback(data); } }); } catch (error) { Logger.error('KvStoreModel', `setDataChangeListener on('dataChange') failed, err=${JSON.stringify(error)}`); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets#L104-L121
256177fd28baf0b13f0e6b8a957a6bc516473bd0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
connectSocketAndOnClose
TCP或TLS连接 服务端或对端
connectSocketAndOnClose(): void { this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => { this.receiveMessage(data); }) // 连接同时订阅关闭连接回调 this.socketController?.onClose(() => { CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback); }) }
AST#method_declaration#Left connectSocketAndOnClose 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 . socketController AST#member_expression#Right AST#expression#Right ?. connectSocket AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left oppositeAddress AST#expression#Right , AST#expression#Left oppositePort AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : 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 this AST#expression#Right . receiveMessage 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 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#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 . socketController AST#member_expression#Right AST#expression#Right ?. onClose AST#member_expression#Right 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 CommonEvent AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . COMM_EVENT_HANGUP_FROM_HOST AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . publishCallback 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#arrow_function#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
connectSocketAndOnClose(): void { this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => { this.receiveMessage(data); }) this.socketController?.onClose(() => { CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L110-L120
a34cca2e10541ad4b2545b24c69411ff27db2c86
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareLink
优化版链接分享(严格遵循systemShare规范) @param url - 分享链接(必填) @param title - 分享标题(必填) @param summary - 分享描述(必填)
static shareLink( url: string, title?: string, summary?: string ): void { // 1. 创建主分享数据(必须设置HYPERLINK类型) const data = new systemShare.SharedData({ utd: utd.UniformDataType.HYPERLINK, // 统一类型描述符,标识为超链接类型 content: url, // 链接地址作为主内容 title: title || '网页分享', // 标题(不传时显示默认文本) description: summary || '' // 描述(不传时显示空字符串) }); // 2. 添加明确的链接记录(确保微信能识别) data.addRecord({ utd: utd.UniformDataType.HYPERLINK, content: url, title: title, description: summary, // 添加微信专用的元数据标识,提高兼容性 extraData: { 'wechat.extra': 'url', // 微信专用标识 'android.intent.extra.SUBJECT': title || '', // 安卓标准标题字段 'android.intent.extra.TEXT': (summary || '') + ' ' + url // 安卓标准文本字段 } }); // 3. 添加纯文本记录作为备用(提高跨平台兼容性) data.addRecord({ utd: utd.UniformDataType.PLAIN_TEXT, // 纯文本类型 content: `${title || ''}\n${summary || ''}\n${url}`, // 合并所有信息 title: title, description: summary }); // 显示分享面板 ShareUtils.showSharePanel(data); }
AST#method_declaration#Left static shareLink AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left summary ? : 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 void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 1. 创建主分享数据(必须设置HYPERLINK类型) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data = 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 systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . SharedData 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 utd AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . HYPERLINK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 统一类型描述符,标识为超链接类型 AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left url AST#expression#Right AST#property_assignment#Right , // 链接地址作为主内容 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#expression#Right || AST#expression#Left '网页分享' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , // 标题(不传时显示默认文本) AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left summary AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_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 // 2. 添加明确的链接记录(确保微信能识别) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . addRecord 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 utd AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . HYPERLINK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left url AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left title AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left summary AST#expression#Right AST#property_assignment#Right , // 添加微信专用的元数据标识,提高兼容性 AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'wechat.extra' AST#property_name#Right : AST#expression#Left 'url' AST#expression#Right AST#property_assignment#Right , // 微信专用标识 AST#property_assignment#Left AST#property_name#Left 'android.intent.extra.SUBJECT' AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , // 安卓标准标题字段 AST#property_assignment#Left AST#property_name#Left 'android.intent.extra.TEXT' AST#property_name#Right : AST#expression#Left AST#binary_expression#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 summary AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left ' ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left url AST#expression#Right AST#binary_expression#Right 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 3. 添加纯文本记录作为备用(提高跨平台兼容性) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . addRecord 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 utd AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . PLAIN_TEXT AST#member_expression#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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right \n AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left summary AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right \n AST#template_substitution#Left $ { AST#expression#Left url 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 title AST#property_name#Right : AST#expression#Left title AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left summary 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#member_expression#Left AST#expression#Left ShareUtils AST#expression#Right . showSharePanel 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 AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static shareLink( url: string, title?: string, summary?: string ): void { const data = new systemShare.SharedData({ utd: utd.UniformDataType.HYPERLINK, content: url, title: title || '网页分享', description: summary || '' }); data.addRecord({ utd: utd.UniformDataType.HYPERLINK, content: url, title: title, description: summary, extraData: { 'wechat.extra': 'url', 'android.intent.extra.SUBJECT': title || '', 'android.intent.extra.TEXT': (summary || '') + ' ' + url } }); data.addRecord({ utd: utd.UniformDataType.PLAIN_TEXT, content: `${title || ''}\n${summary || ''}\n${url}`, title: title, description: summary }); ShareUtils.showSharePanel(data); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L155-L193
dfbee9c1f2ed216fbeb84ebf2a3be78049c00459
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
通知辅助者 @since 2022-06-05
export class NotificationHelper implements INotify { /** * 跳转信息--跳转到搜包页面 */ private checkWantAgentInfo = { wants: [{ bundleName: PACKAGE_NAME, abilityName: 'ServiceExtAbility', action: Action.NOTIFICATION_CHECK }], operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], }; /** * 跳转信息--下载中拉起界面 */ private downloadingWantAgentInfo = { wants: [{ bundleName: PACKAGE_NAME, abilityName: 'ServiceExtAbility', action: Action.NOTIFICATION_DETAIL }], operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], }; /** * 下载进度通知 * * @param version 版本号 * @param progress 进度 * @param context 上下文 */ async showDownloading(version, progress, context): Promise<void> { let templateName: string = 'downloadTemplate'; if (!globalThis.isSupportTemplate) { globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { this.logError('showDownloading isSupportTemplate failed because ' + JSON.stringify(err)); return false; }); } if (!globalThis.isSupportTemplate) { this.logError('showDownloading is not supportTemplate'); return; } var notificationRequest = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.software_update').id), text: await context.resourceManager.getString($r('app.string.software_download_progress').id) }, }, template: { name: 'downloadTemplate', data: { title: await context.resourceManager.getString($r('app.string.software_download_progress').id), fileName: version, progressValue: progress } }, wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), id: 5, label: '111', slotType: notification.SlotType.SERVICE_INFORMATION, deliveryTime: new Date().getTime() } await notification.publish(notificationRequest).catch((err) => { this.logError('showDownloading notification publish failed because ' + JSON.stringify(err)); }); } /** * 下载进度通知 * * @param version 版本号 * @param progress 进度 * @param context 上下文 */ async showInstalling(version, progress, context): Promise<void> { let templateName: string = 'installTemplate'; if (!globalThis.isSupportTemplate) { globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { this.logError('showInstalling isSupportTemplate failed because ' + JSON.stringify(err)); return false; }); } if (!globalThis.isSupportTemplate) { this.logError('showInstalling is not supportTemplate'); return; } var notificationRequest = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.software_update').id), text: await context.resourceManager.getString($r('app.string.software_install_progress').id) }, }, template: { name: 'installTemplate', data: { title: await context.resourceManager.getString($r('app.string.software_install_progress').id), fileName: version, progressValue: progress } }, wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), id: 5, label: '111', slotType: notification.SlotType.SERVICE_INFORMATION, deliveryTime: new Date().getTime() } await notification.publish(notificationRequest).catch((err) => { this.logError('showInstalling publish failed because ' + JSON.stringify(err)); }); } /** * 弹安装失败通知 * * @param context 实上下文 */ async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_fail_message').id), text: versionName } }, wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), id: 3, slotType: notification.SlotType.SERVICE_INFORMATION } await notification.publish(request).then(() => { this.logInfo('showUpgradeFailed publish promise success.'); }).catch((err) => { this.logError('showUpgradeFailed publish promise failed because ' + JSON.stringify(err)); }); } /** * 弹安装成功通知 * * @param context 实上下文 */ async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message').id), text: versionName } }, wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), id: 4, slotType: notification.SlotType.SERVICE_INFORMATION } await notification.publish(request).then(() => { this.logInfo('showUpgradeSuccess publish promise success.'); }).catch((err) => { this.logError('showUpgradeSuccess publish promise failed because ' + JSON.stringify(err)); }); } /** * 取消所有通知 */ async cancelAll(): Promise<void> { await notification.cancelAll().then(() => { this.logInfo('cancelAll notification success'); }); } /** * 检查notification服务是否启动 */ async isServiceReady(): Promise<void> { const retryTimes: number = 10; let count: number = 0; let isReady: boolean = false; while (count < retryTimes) { try { await notification.isDistributedEnabled().then(() => { this.logInfo('notification service is ready'); isReady = true; }); if (isReady) { break; } count++; await new Promise<void>((resolve) => setTimeout(() => resolve(), 1000)); this.logError('notification service is not ready'); } catch (err) { count++; this.logError('notification service throw abnormal'); continue; } }; } /** * info级别日志打印 * * @param message 日志内容 */ logInfo(message: string): void { LogUtils.info('NotificationHelper', message); } /** * error级别日志打印 * * @param message 日志内容 */ logError(message: string): void { LogUtils.error('NotificationHelper', message); } }
AST#export_declaration#Left export AST#class_declaration#Left class NotificationHelper AST#implements_clause#Left implements INotify AST#implements_clause#Right AST#class_body#Left { /** * 跳转信息--跳转到搜包页面 */ AST#property_declaration#Left private checkWantAgentInfo = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left PACKAGE_NAME AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'ServiceExtAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Action AST#expression#Right . NOTIFICATION_CHECK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left operationType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgentFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . CONSTANT_FLAG AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 跳转信息--下载中拉起界面 */ AST#property_declaration#Left private downloadingWantAgentInfo = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left PACKAGE_NAME AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'ServiceExtAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Action AST#expression#Right . NOTIFICATION_DETAIL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left operationType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgentFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . CONSTANT_FLAG AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 下载进度通知 * * @param version 版本号 * @param progress 进度 * @param context 上下文 */ AST#method_declaration#Left async showDownloading AST#parameter_list#Left ( AST#parameter#Left version AST#parameter#Right , AST#parameter#Left progress AST#parameter#Right , AST#parameter#Left context 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#variable_declaration#Left let AST#variable_declarator#Left templateName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'downloadTemplate' 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 globalThis AST#expression#Right AST#unary_expression#Right AST#expression#Right . isSupportTemplate 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 globalThis AST#expression#Right . isSupportTemplate 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#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . isSupportTemplate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left templateName 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 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 this AST#expression#Right . logError 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 'showDownloading isSupportTemplate failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#boolean_literal#Left false AST#boolean_literal#Right 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#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left globalThis AST#expression#Right AST#unary_expression#Right AST#expression#Right . isSupportTemplate 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 this AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showDownloading is not supportTemplate' 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#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_update' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_download_progress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left template AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'downloadTemplate' AST#expression#Right AST#property_assignment#Right , 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 title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_download_progress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileName AST#property_name#Right : AST#expression#Left version AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left progressValue AST#property_name#Right : AST#expression#Left progress 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#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 wantAgent AST#expression#Right AST#await_expression#Right AST#expression#Right . getWantAgent 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 . downloadingWantAgentInfo AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left '111' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . SERVICE_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deliveryTime 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 . getTime 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#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#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest 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#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 . logError 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 'showDownloading notification publish failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#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 /** * 下载进度通知 * * @param version 版本号 * @param progress 进度 * @param context 上下文 */ AST#method_declaration#Left async showInstalling AST#parameter_list#Left ( AST#parameter#Left version AST#parameter#Right , AST#parameter#Left progress AST#parameter#Right , AST#parameter#Left context 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#variable_declaration#Left let AST#variable_declarator#Left templateName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'installTemplate' 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 globalThis AST#expression#Right AST#unary_expression#Right AST#expression#Right . isSupportTemplate 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 globalThis AST#expression#Right . isSupportTemplate 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#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . isSupportTemplate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left templateName 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 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 this AST#expression#Right . logError 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 'showInstalling isSupportTemplate failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#boolean_literal#Left false AST#boolean_literal#Right 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#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left globalThis AST#expression#Right AST#unary_expression#Right AST#expression#Right . isSupportTemplate 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 this AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showInstalling is not supportTemplate' 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#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_update' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_install_progress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left template AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'installTemplate' AST#expression#Right AST#property_assignment#Right , 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 title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.software_install_progress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileName AST#property_name#Right : AST#expression#Left version AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left progressValue AST#property_name#Right : AST#expression#Left progress 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#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 wantAgent AST#expression#Right AST#await_expression#Right AST#expression#Right . getWantAgent 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 . downloadingWantAgentInfo AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left '111' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . SERVICE_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deliveryTime 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 . getTime 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#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#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest 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#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 . logError 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 'showInstalling publish failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#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 /** * 弹安装失败通知 * * @param context 实上下文 */ AST#method_declaration#Left async showUpgradeFailed AST#parameter_list#Left ( AST#parameter#Left versionName : AST#type_annotation#Left AST#primary_type#Left string 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 . Context 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 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#variable_declaration#Left let AST#variable_declarator#Left request = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.install_fail_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left versionName 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#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 wantAgent AST#expression#Right AST#await_expression#Right AST#expression#Right . getWantAgent 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 . checkWantAgentInfo AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . SERVICE_INFORMATION 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#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 AST#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . publish 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 . 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_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 . logInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showUpgradeFailed publish promise success.' 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 . 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#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 . logError 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 'showUpgradeFailed publish promise failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#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 /** * 弹安装成功通知 * * @param context 实上下文 */ AST#method_declaration#Left async showUpgradeSuccess AST#parameter_list#Left ( AST#parameter#Left versionName : AST#type_annotation#Left AST#primary_type#Left string 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 . Context 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 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#variable_declaration#Left let AST#variable_declarator#Left request = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title 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 AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.install_success_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left versionName 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#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 wantAgent AST#expression#Right AST#await_expression#Right AST#expression#Right . getWantAgent 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 . checkWantAgentInfo AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . SERVICE_INFORMATION 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#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 AST#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . publish 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 . 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_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 . logInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showUpgradeSuccess publish promise success.' 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 . 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#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 . logError 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 'showUpgradeSuccess publish promise failed because ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right 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#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 /** * 取消所有通知 */ AST#method_declaration#Left async cancelAll 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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_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 . logInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'cancelAll notification success' 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#builder_function_body#Right AST#method_declaration#Right /** * 检查notification服务是否启动 */ AST#method_declaration#Left async isServiceReady 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#variable_declaration#Left const AST#variable_declarator#Left retryTimes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 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 count : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isReady : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right < AST#expression#Left retryTimes AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . isDistributedEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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_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 . logInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'notification service is ready' 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 isReady = 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#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#if_statement#Left if ( AST#expression#Left isReady AST#expression#Right ) AST#block_statement#Left { 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left count AST#expression#Right ++ AST#update_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 AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#await_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left resolve 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#expression#Left 1000 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#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 . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'notification service is not ready' 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#update_expression#Left AST#expression#Left count AST#expression#Right ++ AST#update_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 . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'notification service throw abnormal' 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#continue_statement#Left continue ; AST#continue_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#while_statement#Right AST#statement#Right AST#ERROR#Left ; AST#ERROR#Right } AST#block_statement#Right AST#method_declaration#Right /** * info级别日志打印 * * @param message 日志内容 */ AST#method_declaration#Left logInfo AST#parameter_list#Left ( 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_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 LogUtils AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NotificationHelper' 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#builder_function_body#Right AST#method_declaration#Right /** * error级别日志打印 * * @param message 日志内容 */ AST#method_declaration#Left logError AST#parameter_list#Left ( 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_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 LogUtils AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NotificationHelper' 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#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class NotificationHelper implements INotify { private checkWantAgentInfo = { wants: [{ bundleName: PACKAGE_NAME, abilityName: 'ServiceExtAbility', action: Action.NOTIFICATION_CHECK }], operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], }; private downloadingWantAgentInfo = { wants: [{ bundleName: PACKAGE_NAME, abilityName: 'ServiceExtAbility', action: Action.NOTIFICATION_DETAIL }], operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG], }; async showDownloading(version, progress, context): Promise<void> { let templateName: string = 'downloadTemplate'; if (!globalThis.isSupportTemplate) { globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { this.logError('showDownloading isSupportTemplate failed because ' + JSON.stringify(err)); return false; }); } if (!globalThis.isSupportTemplate) { this.logError('showDownloading is not supportTemplate'); return; } var notificationRequest = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.software_update').id), text: await context.resourceManager.getString($r('app.string.software_download_progress').id) }, }, template: { name: 'downloadTemplate', data: { title: await context.resourceManager.getString($r('app.string.software_download_progress').id), fileName: version, progressValue: progress } }, wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), id: 5, label: '111', slotType: notification.SlotType.SERVICE_INFORMATION, deliveryTime: new Date().getTime() } await notification.publish(notificationRequest).catch((err) => { this.logError('showDownloading notification publish failed because ' + JSON.stringify(err)); }); } async showInstalling(version, progress, context): Promise<void> { let templateName: string = 'installTemplate'; if (!globalThis.isSupportTemplate) { globalThis.isSupportTemplate = await notification.isSupportTemplate(templateName).catch(err => { this.logError('showInstalling isSupportTemplate failed because ' + JSON.stringify(err)); return false; }); } if (!globalThis.isSupportTemplate) { this.logError('showInstalling is not supportTemplate'); return; } var notificationRequest = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.software_update').id), text: await context.resourceManager.getString($r('app.string.software_install_progress').id) }, }, template: { name: 'installTemplate', data: { title: await context.resourceManager.getString($r('app.string.software_install_progress').id), fileName: version, progressValue: progress } }, wantAgent: await wantAgent.getWantAgent(this.downloadingWantAgentInfo), id: 5, label: '111', slotType: notification.SlotType.SERVICE_INFORMATION, deliveryTime: new Date().getTime() } await notification.publish(notificationRequest).catch((err) => { this.logError('showInstalling publish failed because ' + JSON.stringify(err)); }); } async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_fail_message').id), text: versionName } }, wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), id: 3, slotType: notification.SlotType.SERVICE_INFORMATION } await notification.publish(request).then(() => { this.logInfo('showUpgradeFailed publish promise success.'); }).catch((err) => { this.logError('showUpgradeFailed publish promise failed because ' + JSON.stringify(err)); }); } async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message').id), text: versionName } }, wantAgent: await wantAgent.getWantAgent(this.checkWantAgentInfo), id: 4, slotType: notification.SlotType.SERVICE_INFORMATION } await notification.publish(request).then(() => { this.logInfo('showUpgradeSuccess publish promise success.'); }).catch((err) => { this.logError('showUpgradeSuccess publish promise failed because ' + JSON.stringify(err)); }); } async cancelAll(): Promise<void> { await notification.cancelAll().then(() => { this.logInfo('cancelAll notification success'); }); } async isServiceReady(): Promise<void> { const retryTimes: number = 10; let count: number = 0; let isReady: boolean = false; while (count < retryTimes) { try { await notification.isDistributedEnabled().then(() => { this.logInfo('notification service is ready'); isReady = true; }); if (isReady) { break; } count++; await new Promise<void>((resolve) => setTimeout(() => resolve(), 1000)); this.logError('notification service is not ready'); } catch (err) { count++; this.logError('notification service throw abnormal'); continue; } }; } logInfo(message: string): void { LogUtils.info('NotificationHelper', message); } logError(message: string): void { LogUtils.error('NotificationHelper', message); } }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L28-L252
7b70f1b0a22231d46ce3ffa72ea36f0a7969233a
gitee
xixi-cquer/BiJiDaiBan.git
206dc33a837acbe6fc837feff848427e83946534
entry/src/main/ets/viewmodel/DataModel.ets
arkts
Saving and manipulating data displayed on the page.
export class DataModel { /** * Saved Data. */ private tasks: Array<Array<string>> = CommonConstants.TODO_DATA; /** * Get the data. */ getData(): Array<Array<string>> { function ascend(x,y){ return x[1] - y[1]; //按照数组的第4个值升序排列 } this.tasks=this.tasks.sort(ascend); return this.tasks; } cheData(data:Array<string>):Array<Array<string>>{ let index = this.tasks.indexOf(data); if(data[1]==='0'){ data.splice(1,1,'1') this.tasks.splice(index,1,data) }else { data.splice(1,1,'0') this.tasks.splice(index,1,data) } function ascend(x,y){ return x[1] - y[1]; //按照数组的第4个值升序排列 } this.tasks=this.tasks.sort(ascend); return this.tasks; } setData(data:string):Array<Array<string>>{ this.tasks.unshift([data,'0']) return this.tasks; } delData(index:number):Array<Array<string>>{ this.tasks.splice(index, 1); return this.tasks; } }
AST#export_declaration#Left export AST#class_declaration#Left class DataModel AST#class_body#Left { /** * Saved Data. */ AST#property_declaration#Left private tasks : 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#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#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TODO_DATA AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * Get the data. */ AST#method_declaration#Left getData 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 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#function_expression#Left function ascend AST#parameter_list#Left ( AST#parameter#Left x AST#parameter#Right , AST#parameter#Left y 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#subscript_expression#Left AST#expression#Left x AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left AST#subscript_expression#Left AST#expression#Left y AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //按照数组的第4个值升序排列 } AST#block_statement#Right AST#function_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 . tasks AST#member_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 . tasks AST#member_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ascend 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left cheData AST#parameter_list#Left ( AST#parameter#Left data : 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 Array 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#variable_declaration#Left let AST#variable_declarator#Left index = 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 . tasks AST#member_expression#Right AST#expression#Right . indexOf 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#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#subscript_expression#Left AST#expression#Left data AST#expression#Right [ AST#expression#Left 1 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 data AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 1 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#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 . tasks AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left data 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 data AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left '0' 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 . tasks AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left data 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#function_expression#Left function ascend AST#parameter_list#Left ( AST#parameter#Left x AST#parameter#Right , AST#parameter#Left y 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#subscript_expression#Left AST#expression#Left x AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left AST#subscript_expression#Left AST#expression#Left y AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //按照数组的第4个值升序排列 } AST#block_statement#Right AST#function_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 . tasks AST#member_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 . tasks AST#member_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ascend 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left setData AST#parameter_list#Left ( AST#parameter#Left data : 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 Array 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#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 . tasks AST#member_expression#Right AST#expression#Right . unshift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left data AST#expression#Right , AST#expression#Left '0' AST#expression#Right ] 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left delData 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_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 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#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 . tasks AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks 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 DataModel { private tasks: Array<Array<string>> = CommonConstants.TODO_DATA; getData(): Array<Array<string>> { function ascend(x,y){ return x[1] - y[1]; } this.tasks=this.tasks.sort(ascend); return this.tasks; } cheData(data:Array<string>):Array<Array<string>>{ let index = this.tasks.indexOf(data); if(data[1]==='0'){ data.splice(1,1,'1') this.tasks.splice(index,1,data) }else { data.splice(1,1,'0') this.tasks.splice(index,1,data) } function ascend(x,y){ return x[1] - y[1]; } this.tasks=this.tasks.sort(ascend); return this.tasks; } setData(data:string):Array<Array<string>>{ this.tasks.unshift([data,'0']) return this.tasks; } delData(index:number):Array<Array<string>>{ this.tasks.splice(index, 1); return this.tasks; } }
https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/viewmodel/DataModel.ets#L21-L61
fddb04b17b70983aa7bbffef7e1270f72d02fc76
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/DictSelectModal.ets
arkts
构建字典选择弹窗 @returns {void} 无返回值
build(): void { BottomModal({ visible: this.visible, title: this.title, onDismiss: this.onDismiss, containerColor: $r("app.color.bg_grey"), content: (): void => this.ModalContentNetWorkLayout() }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left BottomModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . visible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onDismiss AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left containerColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_grey" AST#expression#Right ) AST#resource_expression#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 . ModalContentNetWorkLayout 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#build_body#Right AST#build_method#Right
build(): void { BottomModal({ visible: this.visible, title: this.title, onDismiss: this.onDismiss, containerColor: $r("app.color.bg_grey"), content: (): void => this.ModalContentNetWorkLayout() }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L80-L88
4f0c0a7073f6ffd4ce11fef32862e646dc30f484
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
deletePreferences
从缓存中移出指定的Preferences实例,若Preferences实例有对应的持久化文件,则同时删除其持久化文件。 @param context @param name Preferences 实例的名称。
static async deletePreferences(context: Context, name: string): Promise<void> { return dataPreferences.deletePreferences(context, name); }
AST#method_declaration#Left static async deletePreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataPreferences AST#expression#Right . deletePreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left name 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 deletePreferences(context: Context, name: string): Promise<void> { return dataPreferences.deletePreferences(context, name); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L263-L265
76f74152de970444df198e0bc7726067640d2d6a
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringMapUtility.ets
arkts
removedDuplications
/ 按指定的分隔符split之后去除重复项 / 返回的结果是按原来的seperator合并的
public static removedDuplications( srcStr : string, seperator : string ): string { return StringMapUtility.removedDuplicationsWithTrim(srcStr, seperator, true); }
AST#method_declaration#Left public static removedDuplications AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : 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 StringMapUtility AST#expression#Right . removedDuplicationsWithTrim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcStr AST#expression#Right , AST#expression#Left seperator AST#expression#Right , 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static removedDuplications( srcStr : string, seperator : string ): string { return StringMapUtility.removedDuplicationsWithTrim(srcStr, seperator, true); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringMapUtility.ets#L8-L13
90e6fef3f4b62973b50cf3ae55dc77f73dd72b2a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_asynchronous.ets
arkts
encryptMessagePromise
加密消息
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let cipherData = await cipher.doFinal(plainText); return cipherData; }
AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( 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 plainText : 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES128|ECB|PKCS7' 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#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init 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 cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_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#variable_declaration#Left let AST#variable_declarator#Left cipherData = 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 cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left plainText 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 cipherData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let cipherData = await cipher.doFinal(plainText); return cipherData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_asynchronous.ets#L21-L26
3e59adcf2d9281d1db8b44588d8a25188f676a14
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
用户积分记录接口
export interface PointsRecord { id: string; userId: string; action: GameAction; points: number; reason: string; metadata: Record<string, any>; timestamp: string; multiplier?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PointsRecord AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left action : AST#type_annotation#Left AST#primary_type#Left GameAction AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left points : 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 reason : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left metadata : 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 any 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#type_member#Left timestamp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left multiplier ? : AST#type_annotation#Left AST#primary_type#Left number 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 PointsRecord { id: string; userId: string; action: GameAction; points: number; reason: string; metadata: Record<string, any>; timestamp: string; multiplier?: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L131-L140
562e63658eda2ce65c2765b15065b0c44ee09328
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets
arkts
setCrossAxis
设置交叉轴位置
setCrossAxis(event: GestureEvent) { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue; let listOffset: number = Math.abs(this.imageListOffset); if (listOffset > this.moveMaxOffset) { this.isMoveCrossAxis = false; } if (this.isMoveCrossAxis && isScale) { // 获取交叉轴方向 let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'Y' : 'X'; // 获取交叉轴中对应的是 width 还是 height let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH; // 获取手指在主轴移动偏移量 let offset = event[`offset${direction}`]; // 获取图片最后一次在主轴移动的数据 let lastOffset = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; // 计算当前移动后偏移量结果 let calculatedOffset = lastOffset + offset; // 设置交叉轴数据 this.setCurrentOffsetXY(imageWH, calculatedOffset); } }
AST#method_declaration#Left setCrossAxis AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isScale : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue 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 listOffset : 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 Math AST#expression#Right . abs 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 . imageListOffset 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 listOffset AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . moveMaxOffset 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 . isMoveCrossAxis 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#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 this AST#expression#Right . isMoveCrossAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left isScale 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 direction AST#ERROR#Left : 'X' | 'Y' AST#ERROR#Right = AST#expression#Left AST#conditional_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 . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left 'Y' AST#expression#Right : AST#expression#Left 'X' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取交叉轴中对应的是 width 还是 height AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageWH = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_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 . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right : AST#expression#Left ImageFitType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . TYPE_WIDTH 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 offset = AST#expression#Left AST#subscript_expression#Left AST#expression#Left event AST#expression#Right [ AST#expression#Left AST#template_literal#Left ` offset AST#template_substitution#Left $ { AST#expression#Left direction AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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#variable_declaration#Left let AST#variable_declarator#Left lastOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left imageWH AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastX AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastY 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 calculatedOffset = AST#expression#Left AST#binary_expression#Left AST#expression#Left lastOffset AST#expression#Right + AST#expression#Left offset AST#expression#Right AST#binary_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 this AST#expression#Right . setCurrentOffsetXY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageWH AST#expression#Right , AST#expression#Left calculatedOffset 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#method_declaration#Right
setCrossAxis(event: GestureEvent) { let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue; let listOffset: number = Math.abs(this.imageListOffset); if (listOffset > this.moveMaxOffset) { this.isMoveCrossAxis = false; } if (this.isMoveCrossAxis && isScale) { let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'Y' : 'X'; let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH; let offset = event[`offset${direction}`]; let lastOffset = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; let calculatedOffset = lastOffset + offset; this.setCurrentOffsetXY(imageWH, calculatedOffset); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L248-L269
d4a1ab6f7b4d02f6fa0cf2dfb5a95b7c31ee51d9
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
from
Creates an ArkTS array from an array-like object, and uses a custom function to process each array element. The type of the elements in the array-like object can be different from that of the array elements. @param { ArrayLike<U> | Iterable<U> } arrayLike - Array-like object. @param { ArrayFromMapFn<U, T> } mapFn - Functions used to process the array elements. @returns { Array<T> } A new Array instance @throws { BusinessError } 401 - Parameter error: Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. @static @syscap SystemCapability.Utils.Lang @atomicservice @since 18
static from<U, T>(arrayLike: ArrayLike<U> | Iterable<U>, mapFn: ArrayFromMapFn<U, T>): Array<T>;
AST#method_declaration#Left static from AST#type_parameters#Left < AST#type_parameter#Left U AST#type_parameter#Right , AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arrayLike : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left ArrayLike AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Iterable AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mapFn : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ArrayFromMapFn AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left T 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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#method_declaration#Right
static from<U, T>(arrayLike: ArrayLike<U> | Iterable<U>, mapFn: ArrayFromMapFn<U, T>): Array<T>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L536-L536
2bb02c108e7dc13c5df789e896f9dc40a2eef6e5
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ZipTool.ets
arkts
decompress
解压ZIP文件到指定目录 @param zipFile ZIP文件路径(沙箱路径) @param destDir 目标目录路径(沙箱路径) @returns Promise<boolean> 操作是否成功
static async decompress( zipFile: string, destDir: string ): Promise<boolean> { try { // 1. 验证ZIP文件是否存在[1](@ref) if (!fs.accessSync(zipFile)) { throw new Error(`ZIP file not found: ${zipFile}`); } // 2. 创建目标目录(如果不存在)[2](@ref) if (!fs.accessSync(destDir)) { fs.mkdirSync(destDir, true); } // 3. 执行解压(无配置参数方案)[1,7](@ref) await zlib.decompressFile(zipFile, destDir); return true; } catch (err) { const error = err as BusinessError; console.error(`解压失败: [${error.code}] ${error.message}`); return false; } }
AST#method_declaration#Left static async decompress AST#parameter_list#Left ( AST#parameter#Left zipFile : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left destDir : 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 { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 1. 验证ZIP文件是否存在[1](@ref) 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 fs AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left zipFile 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#template_literal#Left ` ZIP file not found: AST#template_substitution#Left $ { AST#expression#Left zipFile 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 // 2. 创建目标目录(如果不存在)[2](@ref) 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 fs AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left destDir 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 fs AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left destDir AST#expression#Right , 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#block_statement#Right AST#if_statement#Right AST#statement#Right // 3. 执行解压(无配置参数方案)[1,7](@ref) 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 zlib AST#expression#Right AST#await_expression#Right AST#expression#Right . decompressFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left zipFile AST#expression#Right , AST#expression#Left destDir 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 ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const 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 console AST#expression#Right . error 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 error AST#expression#Right . code 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 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#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 decompress( zipFile: string, destDir: string ): Promise<boolean> { try { if (!fs.accessSync(zipFile)) { throw new Error(`ZIP file not found: ${zipFile}`); } if (!fs.accessSync(destDir)) { fs.mkdirSync(destDir, true); } await zlib.decompressFile(zipFile, destDir); return true; } catch (err) { const error = err as BusinessError; console.error(`解压失败: [${error.code}] ${error.message}`); return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ZipTool.ets#L134-L157
8e4ecd374daafc027811159358372b6a0c749272
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleOfflineManager.ets
arkts
saveOfflineOperations
保存离线操作
private async saveOfflineOperations(): Promise<void> { try { await StorageUtils.putObject('simple_offline_operations', this.offlineOperations); hilog.info(0x0000, 'SimpleOfflineManager', 'Saved offline operations'); } catch (error) { hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to save offline operations'); } }
AST#method_declaration#Left private async saveOfflineOperations 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 AST#await_expression#Left await AST#expression#Left StorageUtils AST#expression#Right AST#await_expression#Right AST#expression#Right . putObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'simple_offline_operations' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offlineOperations 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'SimpleOfflineManager' AST#expression#Right , AST#expression#Left 'Saved offline operations' 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 0x0000 AST#expression#Right , AST#expression#Left 'SimpleOfflineManager' AST#expression#Right , AST#expression#Left 'Failed to save offline operations' 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 saveOfflineOperations(): Promise<void> { try { await StorageUtils.putObject('simple_offline_operations', this.offlineOperations); hilog.info(0x0000, 'SimpleOfflineManager', 'Saved offline operations'); } catch (error) { hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to save offline operations'); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L57-L64
6d997ad81231b71be6b0ca77c838bad0dc816f59
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets
arkts
ecdh
ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns ECC256共享密钥
static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding); }
AST#method_declaration#Left static ecdh AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_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_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 DynamicSyncUtil AST#expression#Right . dynamicKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'ECC256' AST#expression#Right , AST#expression#Left 256 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding 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 ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets#L35-L38
d9e3702c71c515a39de15830ec90fe011f67a65f
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/url.ets
arkts
URL
==================== 导出 ====================
export { URL, URLSearchParams, parseURL, urlParse };
AST#export_declaration#Left export { URL , URLSearchParams , parseURL , urlParse } ; AST#export_declaration#Right
export { URL, URLSearchParams, parseURL, urlParse };
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L888-L888
23ec606b3fa2a5515ddab13886c8deb52e7e84cc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
继承自BasicDataSource的子类,重写了方法 @class SecondDataSource @extends {BasicDataSource}
export class PanelDataSource extends BasicDataSource { private dataArray: PanelDataType[] = []; /** * 获取数组长度 * @returns {number} 返回数组长度 */ public totalCount(): number { return this.dataArray.length; } /** * 获取指定索引数据 * @param {number} index - 索引值 * @returns {PanelDataType} 返回指定索引数据 */ public getData(index: number): PanelDataType { return this.dataArray[index]; } /** * 改变单个数据 * @param {number} index - 索引值 * @param {PanelDataType} data - 修改后的值 */ public addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); } /** * 添加数据 * @param {PanelDataType} data - 需要添加的数据 */ public pushData(data: PanelDataType | PanelDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); } }
AST#export_declaration#Left export AST#class_declaration#Left class PanelDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PanelDataType [ ] 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 /** * 获取数组长度 * @returns {number} 返回数组长度 */ AST#method_declaration#Left public totalCount 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#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right 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 /** * 获取指定索引数据 * @param {number} index - 索引值 * @returns {PanelDataType} 返回指定索引数据 */ AST#method_declaration#Left public getData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left PanelDataType AST#primary_type#Right AST#type_annotation#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 . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 改变单个数据 * @param {number} index - 索引值 * @param {PanelDataType} data - 修改后的值 */ AST#method_declaration#Left public addData 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 PanelDataType 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#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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left data 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 this AST#expression#Right . notifyDataAdd 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 /** * 添加数据 * @param {PanelDataType} data - 需要添加的数据 */ AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PanelDataType AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left PanelDataType [ ] AST#array_type#Right AST#primary_type#Right AST#union_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . isArray 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#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 . dataArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left data AST#expression#Right AST#spread_element#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray 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 } 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 . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#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 . dataArray AST#member_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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class PanelDataSource extends BasicDataSource { private dataArray: PanelDataType[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): PanelDataType { return this.dataArray[index]; } public addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); } public pushData(data: PanelDataType | PanelDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L188-L230
e1e9dfed447af62ade150fc5be7154048267ffa6
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
addToCart
添加到购物车
async addToCart(productId: string, productName: string, image: string, price: number, quantity: number = 1): Promise<void> { const existingItem = this.cartItems.find(item => item.productId === productId); if (existingItem) { existingItem.quantity += quantity; } else { this.cartItems.push({ productId, productName, image, price, quantity }); } await this.saveCart(); Logger.info('CartService', `Added ${productName} to cart`); }
AST#method_declaration#Left async addToCart AST#parameter_list#Left ( AST#parameter#Left productId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left productName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left quantity : 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_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#variable_declaration#Left const AST#variable_declarator#Left existingItem = 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 . cartItems AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . productId AST#member_expression#Right AST#expression#Right === AST#expression#Left productId 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 existingItem 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 existingItem AST#expression#Right . quantity AST#member_expression#Right += AST#expression#Left quantity 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartItems AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left productId AST#property_assignment#Right , AST#property_assignment#Left productName AST#property_assignment#Right , AST#property_assignment#Left image AST#property_assignment#Right , AST#property_assignment#Left price AST#property_assignment#Right , AST#property_assignment#Left quantity 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#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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveCart 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'CartService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Added AST#template_substitution#Left $ { AST#expression#Left productName AST#expression#Right } AST#template_substitution#Right to cart ` 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#method_declaration#Right
async addToCart(productId: string, productName: string, image: string, price: number, quantity: number = 1): Promise<void> { const existingItem = this.cartItems.find(item => item.productId === productId); if (existingItem) { existingItem.quantity += quantity; } else { this.cartItems.push({ productId, productName, image, price, quantity }); } await this.saveCart(); Logger.info('CartService', `Added ${productName} to cart`); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L74-L89
0fa7f14deda56c6f157b63979cd5ed5863e4b224
github
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleE/entry/src/main/ets/pages/takeaway/Business.ets
arkts
aboutToAppear
纬度
aboutToAppear() { Logger.info(TAG, 'aboutToAppear begin'); this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => { Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`); this.businessList = res; }).catch((err: BusinessError) => { Logger.info(TAG, `aboutToAppear catch err= ${JSON.stringify(err)}`); }) }
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#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 'aboutToAppear begin' 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 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 . businessController AST#member_expression#Right AST#expression#Right . getBusinessList 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 . longitude AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . latitude AST#member_expression#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 AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BusinessInfo [ ] AST#array_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#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#template_literal#Left ` aboutToAppear then res= AST#template_substitution#Left $ { 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 res 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#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 . businessList AST#member_expression#Right = AST#expression#Left res 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 . 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 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#template_literal#Left ` aboutToAppear catch err= AST#template_substitution#Left $ { 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#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#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() { Logger.info(TAG, 'aboutToAppear begin'); this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => { Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`); this.businessList = res; }).catch((err: BusinessError) => { Logger.info(TAG, `aboutToAppear catch err= ${JSON.stringify(err)}`); }) }
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleE/entry/src/main/ets/pages/takeaway/Business.ets#L49-L57
7d5849098ce1b64fc8223e01903625daf83b66fc
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets
arkts
download2Stream
下载到流
download2Stream() { let localFilePath = getContext(this).tempDir + "/demo.txt" let fileStream = fs.createStreamSync(localFilePath, "w") const streamData: rcp.SyncWriteStream = { writeSync(buffer: ArrayBuffer) { fileStream.writeSync(buffer) } }; let downloadToStream: rcp.DownloadToStream = { kind: 'stream', stream: streamData, //这里stream属性传递fileStream或者streamData都可以运行成功 } as rcp.DownloadToStream const session = rcp.createSession(); session.downloadToStream(this.downloadUrl, downloadToStream).then(() => { fileStream.flushSync() fileStream.closeSync() this.msgHistory += "下载成功\r\n" this.showFileContent(localFilePath) }).catch((err: BusinessError) => { this.msgHistory += `下载失败, err.code = ${err.code}, err.message = ${err.message}\r\n`; }); }
AST#method_declaration#Left download2Stream AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localFilePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . tempDir AST#member_expression#Right AST#expression#Right + AST#expression#Left "/demo.txt" AST#expression#Right AST#binary_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 fileStream = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . createStreamSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left localFilePath AST#expression#Right , AST#expression#Left "w" 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 streamData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . SyncWriteStream AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left writeSync AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer 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 fileStream AST#expression#Right . writeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buffer 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#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 let AST#variable_declarator#Left downloadToStream : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . DownloadToStream AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left kind AST#property_name#Right : AST#expression#Left 'stream' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left stream AST#property_name#Right : AST#expression#Left streamData AST#expression#Right AST#property_assignment#Right , //这里stream属性传递fileStream或者streamData都可以运行成功 } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . DownloadToStream AST#qualified_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 session = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rcp AST#expression#Right . createSession 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#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 session AST#expression#Right . downloadToStream 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 . downloadUrl AST#member_expression#Right AST#expression#Right , AST#expression#Left downloadToStream 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_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 fileStream 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileStream AST#expression#Right . closeSync 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 . msgHistory AST#member_expression#Right += AST#expression#Left "下载成功\r\n" 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 . showFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left localFilePath 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 . 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` 下载失败, err.code = 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 , err.message = 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 \r \n ` AST#template_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#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
download2Stream() { let localFilePath = getContext(this).tempDir + "/demo.txt" let fileStream = fs.createStreamSync(localFilePath, "w") const streamData: rcp.SyncWriteStream = { writeSync(buffer: ArrayBuffer) { fileStream.writeSync(buffer) } }; let downloadToStream: rcp.DownloadToStream = { kind: 'stream', stream: streamData, } as rcp.DownloadToStream const session = rcp.createSession(); session.downloadToStream(this.downloadUrl, downloadToStream).then(() => { fileStream.flushSync() fileStream.closeSync() this.msgHistory += "下载成功\r\n" this.showFileContent(localFilePath) }).catch((err: BusinessError) => { this.msgHistory += `下载失败, err.code = ${err.code}, err.message = ${err.message}\r\n`; }); }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets#L101-L124
8dfdf9cc820bf4b947dee541521abb624f6fbd2b
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinJ.ets
arkts
SpinJ
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinJ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSize = this.spinSize * 0.75; } build() { Stack() { Grid() { GridItem() { Canvas().chunkStyle() }.translate({ x: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: -this.tran1 }) GridItem() { Canvas().chunkStyle() } GridItem() { Canvas().chunkStyle() }.translate({ y: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: -this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: -this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: -this.tran1 }) } .rowsTemplate('1fr 1fr 1fr') .columnsTemplate('1fr 1fr 1fr') .width(this.scaleSize) .height(this.scaleSize) } .width(this.oldSize) .height(this.oldSize) .alignContent(Alignment.Center) .onAppear(() => { this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, [ { duration: 500, curve: Curve.EaseInOut, event: () => { this.tran1 = 0 this.scaleSize = this.oldSize * 1.1 } }, { duration: 190, curve: Curve.Linear, event: () => { this.tran1 = this.oldSize / 3 } }, { duration: 0, curve: Curve.Linear, event: () => { this.tran1 = 0 } }, { duration: 10, curve: Curve.Linear, event: () => { } }, { duration: 500, curve: Curve.EaseIn, event: () => { this.scaleSize = this.oldSize * 0.75 this.tran1 = 0 } } ]) }) } @Styles chunkStyle(){ .width(this.oldSize * 0.25) .height(this.oldSize * 0.25) .backgroundColor(this.spinColor) .shadow(ShadowStyle.OUTER_DEFAULT_XS) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinJ AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 36 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scaleSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.75 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right tran1 : 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 private oldSize : 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 this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize 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 this AST#expression#Right . scaleSize AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.75 AST#expression#Right AST#binary_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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#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 . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#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 . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#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 . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) 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 . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#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 . tran1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#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 . rowsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleSize AST#member_expression#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 . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo 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 iterations 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#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 500 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleSize AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 1.1 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#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 duration AST#property_name#Right : AST#expression#Left 190 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right / AST#expression#Left 3 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#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 duration AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 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#arrow_function#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 duration AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#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 duration AST#property_name#Right : AST#expression#Left 500 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseIn AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleSize AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.75 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tran1 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#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] 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#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#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right chunkStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.25 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.25 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#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#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct SpinJ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSize = this.spinSize * 0.75; } build() { Stack() { Grid() { GridItem() { Canvas().chunkStyle() }.translate({ x: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: -this.tran1 }) GridItem() { Canvas().chunkStyle() } GridItem() { Canvas().chunkStyle() }.translate({ y: this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ y: -this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: -this.tran1 }) GridItem() { Canvas().chunkStyle() }.translate({ x: -this.tran1 }) } .rowsTemplate('1fr 1fr 1fr') .columnsTemplate('1fr 1fr 1fr') .width(this.scaleSize) .height(this.scaleSize) } .width(this.oldSize) .height(this.oldSize) .alignContent(Alignment.Center) .onAppear(() => { this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, [ { duration: 500, curve: Curve.EaseInOut, event: () => { this.tran1 = 0 this.scaleSize = this.oldSize * 1.1 } }, { duration: 190, curve: Curve.Linear, event: () => { this.tran1 = this.oldSize / 3 } }, { duration: 0, curve: Curve.Linear, event: () => { this.tran1 = 0 } }, { duration: 10, curve: Curve.Linear, event: () => { } }, { duration: 500, curve: Curve.EaseIn, event: () => { this.scaleSize = this.oldSize * 0.75 this.tran1 = 0 } } ]) }) } @Styles chunkStyle(){ .width(this.oldSize * 0.25) .height(this.oldSize * 0.25) .backgroundColor(this.spinColor) .shadow(ShadowStyle.OUTER_DEFAULT_XS) } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinJ.ets#L25-L136
b3f0990e4bab71f1a36f9bdad25f576efcb2ca21
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets
arkts
SetupVpn
设置VPN网络配置的方法
SetupVpn() { console.info('xdw step3'); Logger.info('developTag', '%{public}s', 'vpn SetupVpn'); class Address { public address: string; public family: number; constructor(address: string, family: number) { this.address = address; this.family = family; } }
AST#method_declaration#Left SetupVpn AST#parameter_list#Left ( ) 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'xdw step3' 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'developTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'vpn SetupVpn' 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 class AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left Address AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left public AST#property_name#Right AST#ERROR#Left address AST#ERROR#Right : AST#expression#Left string AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left public AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left family 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_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left constructor ( AST#expression#Left address AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left family 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#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 . address AST#member_expression#Right = AST#expression#Left address 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 . family AST#member_expression#Right = AST#expression#Left family AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#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
SetupVpn() { console.info('xdw step3'); Logger.info('developTag', '%{public}s', 'vpn SetupVpn'); class Address { public address: string; public family: number; constructor(address: string, family: number) { this.address = address; this.family = family; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets#L109-L120
323f71844ca4c7f6a60e0babd01c926306671d33
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey 公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns 验签结果OutDTO对象,其中Msg为验签结果
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding, false); }
AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : 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 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_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 . verify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left signStr AST#expression#Right , AST#expression#Left verifyStr AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left 'ECC256' AST#expression#Right , AST#expression#Left 'ECC256|SHA256' AST#expression#Right , AST#expression#Left 256 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left dataCoding AST#expression#Right , 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding, false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets#L59-L62
43cb09d666116ca560aec5fc3a1dd831c10c9a1f
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/FileUtils.ets
arkts
deleteFileSync
删除文件 @param path 文件绝对路径及文件名
deleteFileSync(path: string): boolean { try { let fileExist = fs.accessSync(path); if (fileExist) { fs.unlinkSync(path); } return true } catch (err) { LogUtil.error('FileUtils deleteFileSync failed: err msg=' + err.message + ' err code=' + err.code); return false } }
AST#method_declaration#Left deleteFileSync 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 boolean 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 fileExist = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . accessSync AST#member_expression#Right 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#if_statement#Left if ( AST#expression#Left fileExist 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 fs AST#expression#Right . unlinkSync AST#member_expression#Right 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#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 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 ( 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 LogUtil 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 AST#binary_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 'FileUtils deleteFileSync failed: err msg=' AST#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left ' err code=' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right . code 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#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
deleteFileSync(path: string): boolean { try { let fileExist = fs.accessSync(path); if (fileExist) { fs.unlinkSync(path); } return true } catch (err) { LogUtil.error('FileUtils deleteFileSync failed: err msg=' + err.message + ' err code=' + err.code); return false } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L42-L53
2bb75a3adeb4430a322148f6609b60ec7a835b89
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets
arkts
aboutToAppear
图片原始宽高比
aboutToAppear(): void { this.initCurrentImageInfo(); }
AST#method_declaration#Left aboutToAppear 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 this AST#expression#Right . initCurrentImageInfo 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
aboutToAppear(): void { this.initCurrentImageInfo(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets#L40-L42
f54e9e6830ca63b1ac4efcaeb67da0abcb925351
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/workers/History_indexer.ets
arkts
rebuild_full_history_index_sync
Builds index for all history and saves (overwrites) the index file onto disk. THIS IS A SYNC FUNCTION
function rebuild_full_history_index_sync(context_filesDir: string) { let s = Date.now(); console.log(host.log_head_worker() + ' Start rebuilding full index! Start: ' + new Date(s).toString() + '.') // Clear all previous index try { fs.rmdirSync(context_filesDir + "/history-index"); fs.mkdirSync(context_filesDir + "/history-index", true); } catch (e) { } // Get all months let months = get_history_months_no_create_this_month(context_filesDir); // Read month by month for (let index = 0; index < months.length; index++) { host.clear(); // Index const year_month = months[index]; // bunch_of_history_index.add_index_history_file(file_path, context_filesDir); host.index_from_history_month_file(year_month[0], year_month[1], context_filesDir); // Save to disk console.log(host.log_head_worker() + ' Indexing month: ' + year_month.toString() + '. Map size: ' + host.index_map.size.toString() + '.'); let month_field: string = year_month[1].toString(); if (year_month[1].toString().length == 1) { // is a single digit // This works until human have over 99 months a year, perhaps. month_field = "0" + year_month[1].toString(); } save_index_ext("index_" + year_month[0] + "_" + month_field + "_00_00_00_00_000.txt", host.index_map, context_filesDir); // Report status const progress = index / months.length * 100; workerPort.postMessage((Date.now() - s).toString() + " ms, " + progress.toFixed(2) + "%"); // console.log("[Meow][bunch_of_history_index] Index progress: " + progress.toFixed(2) + "%"); } // save indexer version for future use // perhaps? sandbox_save('last_indexer_version.txt', "1", context_filesDir); // Timer & logs console.log(host.log_head_worker() + ' Finish full index! Time used: ' + ((Date.now() - s) / 1000).toString() + "s.") workerPort.postMessage((Date.now() - s).toString() + " ms, 100%"); }
AST#function_declaration#Left function rebuild_full_history_index_sync AST#parameter_list#Left ( AST#parameter#Left context_filesDir : 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 let AST#variable_declarator#Left s = 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#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 . log 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 AST#call_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 host AST#expression#Right . log_head_worker 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 ' Start rebuilding full index! Start: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left s AST#expression#Right ) AST#argument_list#Right AST#call_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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // Clear all previous index 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 fs AST#expression#Right . rmdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left context_filesDir AST#expression#Right + AST#expression#Left "/history-index" 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 AST#member_expression#Left AST#expression#Left fs AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left context_filesDir AST#expression#Right + AST#expression#Left "/history-index" AST#expression#Right AST#binary_expression#Right AST#expression#Right , 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#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // Get all months AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left months = AST#expression#Left AST#call_expression#Left AST#expression#Left get_history_months_no_create_this_month AST#expression#Right AST#argument_list#Left ( AST#expression#Left context_filesDir 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 // Read month by month 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#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left months 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 index 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 host 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 // Index AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year_month = AST#expression#Left AST#subscript_expression#Left AST#expression#Left months AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // bunch_of_history_index.add_index_history_file(file_path, context_filesDir); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left host AST#expression#Right . index_from_history_month_file AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left context_filesDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Save to disk 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#call_expression#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 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#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 host AST#expression#Right . log_head_worker 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 ' Indexing month: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left year_month AST#expression#Right AST#binary_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 '. Map size: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left host AST#expression#Right AST#binary_expression#Right AST#expression#Right . index_map AST#member_expression#Right AST#expression#Right . size 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#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 month_field : AST#type_annotation#Left AST#primary_type#Left string 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#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 . 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 { // is a single digit // This works until human have over 99 months a year, perhaps. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left month_field = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "0" AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_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#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 save_index_ext 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 "index_" AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left year_month AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "_" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left month_field AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "_00_00_00_00_000.txt" AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left host AST#expression#Right . index_map AST#member_expression#Right AST#expression#Right , AST#expression#Left context_filesDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Report status AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left progress = AST#expression#Left AST#binary_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 months AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_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 workerPort AST#expression#Right . postMessage 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 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#parenthesized_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 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#expression#Left s AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_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 " ms, " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left progress AST#expression#Right AST#binary_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // console.log("[Meow][bunch_of_history_index] Index progress: " + progress.toFixed(2) + "%"); } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // save indexer version for future use // perhaps? AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_save AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'last_indexer_version.txt' AST#expression#Right , AST#expression#Left "1" AST#expression#Right , AST#expression#Left context_filesDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Timer & logs 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left host AST#expression#Right . log_head_worker 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 ' Finish full index! Time used: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#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 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#expression#Left s AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_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 "s." 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 AST#member_expression#Left AST#expression#Left workerPort AST#expression#Right . postMessage 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 AST#parenthesized_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 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#expression#Left s AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_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 " ms, 100%" 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#block_statement#Right AST#function_declaration#Right
function rebuild_full_history_index_sync(context_filesDir: string) { let s = Date.now(); console.log(host.log_head_worker() + ' Start rebuilding full index! Start: ' + new Date(s).toString() + '.') try { fs.rmdirSync(context_filesDir + "/history-index"); fs.mkdirSync(context_filesDir + "/history-index", true); } catch (e) { } let months = get_history_months_no_create_this_month(context_filesDir); for (let index = 0; index < months.length; index++) { host.clear(); const year_month = months[index]; host.index_from_history_month_file(year_month[0], year_month[1], context_filesDir); console.log(host.log_head_worker() + ' Indexing month: ' + year_month.toString() + '. Map size: ' + host.index_map.size.toString() + '.'); let month_field: string = year_month[1].toString(); if (year_month[1].toString().length == 1) { month_field = "0" + year_month[1].toString(); } save_index_ext("index_" + year_month[0] + "_" + month_field + "_00_00_00_00_000.txt", host.index_map, context_filesDir); const progress = index / months.length * 100; workerPort.postMessage((Date.now() - s).toString() + " ms, " + progress.toFixed(2) + "%"); } sandbox_save('last_indexer_version.txt', "1", context_filesDir); console.log(host.log_head_worker() + ' Finish full index! Time used: ' + ((Date.now() - s) / 1000).toString() + "s.") workerPort.postMessage((Date.now() - s).toString() + " ms, 100%"); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/workers/History_indexer.ets#L50-L98
25144fc52c2c9a4e651739c6aa6fb1466592f6fd
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/MessageUtil.ets
arkts
icon
左侧icon样式 @param icon 用户自定义 @param defaultIcon 默认
@Extend(Image) function icon() { .width(UiConst.VP_15) .height(UiConst.VP_15) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function icon AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
@Extend(Image) function icon() { .width(UiConst.VP_15) .height(UiConst.VP_15) }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L137-L141
335c8f1df5e997160f9e807cf3dfe7cbe586bd1f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets
arkts
Comment
List子项评论属性
@Observed export class Comment { id?: string; // 评论id avatar?: Resource; // 评论人头像 name?: string; // 评论人昵称 commentContent?: string; // 评论内容 timeAgo?: string; // 评论时间 address?: string; // 评论地址 likeCount?: string; // 评论的点赞人数 }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Comment 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#property_declaration#Right // 评论id AST#property_declaration#Left avatar ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#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#property_declaration#Right // 评论人昵称 AST#property_declaration#Left commentContent ? : 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 timeAgo ? : 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 address ? : 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 likeCount ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 评论的点赞人数 } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export class Comment { id?: string; avatar?: Resource; name?: string; commentContent?: string; timeAgo?: string; address?: string; likeCount?: string; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets#L20-L29
23dcc2863b8166ea87c447a1d0cee240892d954d
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
从文件读取二进制内容
export function readArrayBufferContentFromFile(fileUri: string): ArrayBuffer { let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let fsStat = fs.statSync(file.fd); let buf = new ArrayBuffer(fsStat.size); fs.readSync(file.fd, buf); fs.fsyncSync(file.fd) fs.closeSync(file); return buf }
AST#export_declaration#Left export AST#function_declaration#Left function readArrayBufferContentFromFile AST#parameter_list#Left ( AST#parameter#Left fileUri : 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 ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileUri AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_ONLY 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#variable_declaration#Left let AST#variable_declarator#Left fsStat = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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#variable_declaration#Left let AST#variable_declarator#Left buf = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left fsStat AST#expression#Right . size 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 fs AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left buf 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 fs AST#expression#Right . fsyncSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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 fs AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file 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 buf AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function readArrayBufferContentFromFile(fileUri: string): ArrayBuffer { let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let fsStat = fs.statSync(file.fd); let buf = new ArrayBuffer(fsStat.size); fs.readSync(file.fd, buf); fs.fsyncSync(file.fd) fs.closeSync(file); return buf }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L61-L69
82005f9157ea657b18b848cd48a224dfc15e943d
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/api/FinVideoApi.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2025/7/6 23:17 @Version V1.0 @Description Video Fin Api
export interface FinVideoApi extends FinApi { /** * 获取恢复播放列表 * @returns */ getResumeItems(): Promise<Array<FinItem>> /** * 获取继续播放列表 * @param seriesId * @returns */ getNextUp(seriesId?: string): Promise<Array<FinItem>> /** * 获取媒体库列表 * @returns */ getLibraryList(): Promise<Array<FinItem>> /** * 获取最近 * @param id * @returns */ getLatestItems(id?: string): Promise<Array<FinItem>> /** * 获取媒体列表 * @param id * @param types * @returns */ getItemList(id: string, types: Array<FinItemType>, recursive: boolean, index?: number): Promise<FinPage> /** * 获取电影 * @param id * @returns */ getMovie(id: string): Promise<FinItem> /** * 获取剧集 * @param id * @returns */ getShow(id: string): Promise<FinItem> /** * 获取季信息 * @param seriesId * @returns */ getSeasons(seriesId: string): Promise<Array<FinItem>> /** * 获取季的剧集列表 * @param seriesId * @param seasonId * @returns */ getEpisodes(seriesId: string, seasonId: string): Promise<Array<FinItem>> /** * 获取集的信息 * @param episodeId * @returns */ getEpisode(episodeId: string): Promise<FinItem> /** * 获取item的数据 * @param id * @returns */ getItemData(id: string): Promise<FinItemData> /** * 获取媒体数据源 * @param id * @param sourceInfo * @returns */ getItemSource(id: string): Promise<FinItemSource> /** * 获取收藏 * @param types * @returns */ getFavourite(types?: Array<FinItemType>): Promise<Array<FinItem>> /** * 搜索 * @param keyword * @returns */ search(keyword: string): Promise<Array<FinItem>> /** * 播放开始 * @param id * @returns */ onPlaybackStart(id: string): Promise<void> /** * 播放进度 * @param id * @param position * @param playing * @returns */ onPlaybackProgress(id: string, position: number, playing: boolean): Promise<void> /** * 播放停止 * @param id * @param position * @returns */ onPlaybackStopped(id: string, position: number): Promise<void> }
AST#export_declaration#Left export AST#interface_declaration#Left interface FinVideoApi AST#extends_clause#Left extends FinApi AST#extends_clause#Right AST#object_type#Left { /** * 获取恢复播放列表 * @returns */ AST#type_member#Left getResumeItems 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 seriesId * @returns */ AST#type_member#Left getNextUp AST#parameter_list#Left ( AST#parameter#Left seriesId ? : 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 getLibraryList 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 * @returns */ AST#type_member#Left getLatestItems 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 * @param types * @returns */ AST#type_member#Left getItemList 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#Left types : 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 FinItemType 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 recursive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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_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 FinPage 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 * @returns */ AST#type_member#Left getMovie 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 FinItem 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 * @returns */ AST#type_member#Left getShow 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 FinItem 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 seriesId * @returns */ AST#type_member#Left getSeasons AST#parameter_list#Left ( AST#parameter#Left seriesId : 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 seriesId * @param seasonId * @returns */ AST#type_member#Left getEpisodes AST#parameter_list#Left ( AST#parameter#Left seriesId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seasonId : 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 episodeId * @returns */ AST#type_member#Left getEpisode AST#parameter_list#Left ( AST#parameter#Left episodeId : 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 FinItem 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 /** * 获取item的数据 * @param id * @returns */ AST#type_member#Left getItemData 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 FinItemData 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 * @param sourceInfo * @returns */ AST#type_member#Left getItemSource 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 FinItemSource 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 types * @returns */ AST#type_member#Left getFavourite AST#parameter_list#Left ( AST#parameter#Left types ? : 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 FinItemType 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 FinItem 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 keyword * @returns */ AST#type_member#Left search AST#parameter_list#Left ( AST#parameter#Left keyword : 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem 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 * @returns */ AST#type_member#Left onPlaybackStart 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 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#type_member#Right /** * 播放进度 * @param id * @param position * @param playing * @returns */ AST#type_member#Left onPlaybackProgress 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#Left position : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left playing : 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 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#type_member#Right /** * 播放停止 * @param id * @param position * @returns */ AST#type_member#Left onPlaybackStopped 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#Left position : 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 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#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface FinVideoApi extends FinApi { getResumeItems(): Promise<Array<FinItem>> getNextUp(seriesId?: string): Promise<Array<FinItem>> getLibraryList(): Promise<Array<FinItem>> getLatestItems(id?: string): Promise<Array<FinItem>> getItemList(id: string, types: Array<FinItemType>, recursive: boolean, index?: number): Promise<FinPage> getMovie(id: string): Promise<FinItem> getShow(id: string): Promise<FinItem> getSeasons(seriesId: string): Promise<Array<FinItem>> getEpisodes(seriesId: string, seasonId: string): Promise<Array<FinItem>> getEpisode(episodeId: string): Promise<FinItem> getItemData(id: string): Promise<FinItemData> getItemSource(id: string): Promise<FinItemSource> getFavourite(types?: Array<FinItemType>): Promise<Array<FinItem>> search(keyword: string): Promise<Array<FinItem>> onPlaybackStart(id: string): Promise<void> onPlaybackProgress(id: string, position: number, playing: boolean): Promise<void> onPlaybackStopped(id: string, position: number): Promise<void> }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/api/FinVideoApi.ets#L13-L138
93e09b75881f43ed8755685abac987642c62d2ac
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets
arkts
loadSavedCredentials
加载已保存的账号密码 @returns {Promise<void>} Promise<void>
private async loadSavedCredentials(): Promise<void> { const savedAccount: string = await this.accountStoreRepository.loadAccount(); const savedPassword: string = await this.accountStoreRepository.loadPassword(); if (savedAccount) { this.account = savedAccount; } if (savedPassword) { this.password = savedPassword; } }
AST#method_declaration#Left private async loadSavedCredentials 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#variable_declaration#Left const AST#variable_declarator#Left savedAccount : AST#type_annotation#Left AST#primary_type#Left string 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . accountStoreRepository AST#member_expression#Right AST#expression#Right . loadAccount 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 savedPassword : AST#type_annotation#Left AST#primary_type#Left string 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . accountStoreRepository AST#member_expression#Right AST#expression#Right . loadPassword 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 savedAccount 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 . account AST#member_expression#Right = AST#expression#Left savedAccount 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#if_statement#Left if ( AST#expression#Left savedPassword 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 . password AST#member_expression#Right = AST#expression#Left savedPassword 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#method_declaration#Right
private async loadSavedCredentials(): Promise<void> { const savedAccount: string = await this.accountStoreRepository.loadAccount(); const savedPassword: string = await this.accountStoreRepository.loadPassword(); if (savedAccount) { this.account = savedAccount; } if (savedPassword) { this.password = savedPassword; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L98-L107
7d9764cc2c194d8dd68ac506bef11427247ae2c8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
数据库记录接口
export interface DbRecord { id: string; content: string; style: string; occasion: string; language: string; tags: string; isCustom: number; usageCount: number; rating: number; authorId: string; isPublic: number; metadata: string; createdAt: string; updatedAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DbRecord AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left style : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left occasion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tags : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isCustom : 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 usageCount : 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 rating : 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 authorId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isPublic : 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 metadata : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left updatedAt : 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 DbRecord { id: string; content: string; style: string; occasion: string; language: string; tags: string; isCustom: number; usageCount: number; rating: number; authorId: string; isPublic: number; metadata: string; createdAt: string; updatedAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L267-L282
87716cd7e10f04e4db0ae5c1e68095edd984cbc3
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/MusicMyComponent.ets
arkts
favoriteBuilder
@author: wuwenqiang @description: 收藏夹 @date: 2024-07-01 21:45
@Builder favoriteBuilder(){ Column(){ Row(){ Blank() .width(size.smallIconSize) .height(size.smallIconSize) .margin({right:size.pagePadding}) Text('创建收藏夹') .padding(size.pagePadding) .textAlign(TextAlign.Center) .border({ width: { bottom: 1 }, color: { bottom: colors.borderColor }, style: { bottom: BorderStyle.Solid } }).layoutWeight(1) Image($r("app.media.icon_close")) .width(size.smallIconSize) .height(size.smallIconSize) .opacity(0.5) .onClick(()=>{ this.favoriteDialogController.close() }).margin({right:size.pagePadding}) }.justifyContent(FlexAlign.Center) CreateFavoriteDirectory({ onCreateDirectory:(favoriteDirectory:FavoriteDirectoryInterface)=>{ this.favoriteDialogController.close(); this.myFavoriteDirectoryList.unshift(favoriteDirectory); }, onCancleCreateDirectory:()=>{ this.favoriteDialogController.close() } }) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right favoriteBuilder 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_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 . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . smallIconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . smallIconSize 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 right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . pagePadding 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 Text ( AST#expression#Left '创建收藏夹' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . pagePadding AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1 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 color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Right . borderColor AST#member_expression#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 style AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right 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#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_close" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . smallIconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . smallIconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . favoriteDialogController AST#member_expression#Right AST#expression#Right . close 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#Left . margin ( 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 size AST#expression#Right . pagePadding 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#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 . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#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 CreateFavoriteDirectory ( AST#component_parameters#Left { AST#component_parameter#Left onCreateDirectory : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left favoriteDirectory : AST#type_annotation#Left AST#primary_type#Left FavoriteDirectoryInterface 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . favoriteDialogController AST#member_expression#Right AST#expression#Right . close 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . myFavoriteDirectoryList AST#member_expression#Right AST#expression#Right . unshift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left favoriteDirectory 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#component_parameter#Right , AST#component_parameter#Left onCancleCreateDirectory : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . favoriteDialogController AST#member_expression#Right AST#expression#Right . close 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder favoriteBuilder(){ Column(){ Row(){ Blank() .width(size.smallIconSize) .height(size.smallIconSize) .margin({right:size.pagePadding}) Text('创建收藏夹') .padding(size.pagePadding) .textAlign(TextAlign.Center) .border({ width: { bottom: 1 }, color: { bottom: colors.borderColor }, style: { bottom: BorderStyle.Solid } }).layoutWeight(1) Image($r("app.media.icon_close")) .width(size.smallIconSize) .height(size.smallIconSize) .opacity(0.5) .onClick(()=>{ this.favoriteDialogController.close() }).margin({right:size.pagePadding}) }.justifyContent(FlexAlign.Center) CreateFavoriteDirectory({ onCreateDirectory:(favoriteDirectory:FavoriteDirectoryInterface)=>{ this.favoriteDialogController.close(); this.myFavoriteDirectoryList.unshift(favoriteDirectory); }, onCancleCreateDirectory:()=>{ this.favoriteDialogController.close() } }) } }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L80-L114
9f0affc3a8b5922cb3a8008a2e3d25b6a7585e23
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
addItem
在指定索引位置增加一个元素 @param index
public addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]); this.notifyDataAdd(index); }
AST#method_declaration#Left public addItem 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_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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right 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 this AST#expression#Right . notifyDataAdd 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 addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L139-L142
46790f8c92fcf5a342da818102d7c67e46606276
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CommonConstantsInfo.ets
arkts
Common constants info
export default class CommonConstantsInfo { dbName?: string = ''; tableName?: string = ''; columns?: Array<string> = []; }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstantsInfo AST#class_body#Left { AST#property_declaration#Left dbName ? : 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 tableName ? : 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 columns ? : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class CommonConstantsInfo { dbName?: string = ''; tableName?: string = ''; columns?: Array<string> = []; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CommonConstantsInfo.ets#L19-L23
b081d04db908335f27682ad6a960fd3fbc0e6f81
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildBirthdayCard
构建生日卡片
@Builder buildBirthdayCard(metadata: Record<string, any>) { Column({ space: 8 }) { Row({ space: 12 }) { Image($r('app.media.ic_cake')) .width(24) .height(24) .fillColor('#FF5722') Text(`${metadata.name}的生日`) .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) } .width('100%') Text(`${metadata.date} (还有${metadata.daysLeft}天)`) .fontSize(12) .fontColor($r('app.color.text_secondary')) Button('发送祝福') .type(ButtonType.Normal) .backgroundColor('#FF5722') .fontColor(Color.White) .fontSize(12) .width(80) .height(28) .onClick(() => { this.sendGreeting(metadata.contactId); }) } .width('100%') .padding(8) .backgroundColor($r('app.color.surface')) .borderRadius(8) .alignItems(HorizontalAlign.Start) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayCard AST#parameter_list#Left ( AST#parameter#Left metadata : 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 any 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 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#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_cake' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#FF5722' 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 Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left metadata AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 的生日 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#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#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#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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left metadata AST#expression#Right . date 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 metadata AST#expression#Right . daysLeft AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 天) ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '发送祝福' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FF5722' 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 . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 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 . sendGreeting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left metadata AST#expression#Right . contactId 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#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#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.surface' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#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#builder_function_body#Right AST#method_declaration#Right
@Builder buildBirthdayCard(metadata: Record<string, any>) { Column({ space: 8 }) { Row({ space: 12 }) { Image($r('app.media.ic_cake')) .width(24) .height(24) .fillColor('#FF5722') Text(`${metadata.name}的生日`) .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) } .width('100%') Text(`${metadata.date} (还有${metadata.daysLeft}天)`) .fontSize(12) .fontColor($r('app.color.text_secondary')) Button('发送祝福') .type(ButtonType.Normal) .backgroundColor('#FF5722') .fontColor(Color.White) .fontSize(12) .width(80) .height(28) .onClick(() => { this.sendGreeting(metadata.contactId); }) } .width('100%') .padding(8) .backgroundColor($r('app.color.surface')) .borderRadius(8) .alignItems(HorizontalAlign.Start) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets#L291-L327
53385c12086b3d78dac1be2cd64cd7f5128138ea
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isTypedArray
检查是否为TypedArray类型。TypedArray类型,包括Int8Array、Int16Array、Int32Array、Uint8Array、Uint8ClampedArray、Uint16Array、Uint32Array、Float32Array、Float64Array、BigInt64Array、BigUint64Array。 @param value @returns
static isTypedArray(value: Object): boolean { return new util.types().isTypedArray(value); }
AST#method_declaration#Left static isTypedArray AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object 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#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#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . types AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . isTypedArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 isTypedArray(value: Object): boolean { return new util.types().isTypedArray(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L229-L231
fe6ece0093fbb4258b0af9f87ea41386eec3ccf9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
RefundInfoTitle
退款信息标题 @returns {void} 无返回值
@Builder private RefundInfoTitle() { TitleWithLine({ text: $r("app.string.refund_info") }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RefundInfoTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.refund_info" AST#expression#Right ) AST#resource_expression#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 RefundInfoTitle() { TitleWithLine({ text: $r("app.string.refund_info") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L273-L278
05499a525625f561e8c5ed3d1974bda2bd384704
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the senior (S) version number, which increases with any updates to the partial architecture or major features. <p>The S version number monotonically increases from 0 to 99. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get seniorVersion(): int;
AST#method_declaration#Left static get AST#ERROR#Left seniorVersion AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get seniorVersion(): int;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L258-L258
758e6a78e38f9ab7c30b69a8a1bbfdfba6327e20
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
getIconFont
解析iconFont字符 @param iconfont iconFont字符(e631) @returns
static getIconFont(iconFont: string): string { return String.fromCharCode(parseInt(iconFont, 16)) }
AST#method_declaration#Left static getIconFont AST#parameter_list#Left ( AST#parameter#Left iconFont : 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 String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left iconFont AST#expression#Right , AST#expression#Left 16 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getIconFont(iconFont: string): string { return String.fromCharCode(parseInt(iconFont, 16)) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L147-L149
462f8be0a92314803858f2650408d03dc7c1c6fc
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/XComponentVideo.ets
arkts
aboutToAppear
列表当前索引值
async aboutToAppear() { // 视频列表数据初始化 NEWS_LIST_DATA.forEach((news: NewsItem) => { this.newsList.pushData(news); }) // 获取列表的长度 this.arrayLength = this.newsList.totalCount() if (this.index === 0 || this.index === this.arrayLength) { this.startOrEnd = true; } // 设置播放状态 this.setCompleteCallback(() => { logger.info('completed state called'); this.isPlaying = !this.isPlaying; }); // 时间上报函数 this.setTimeUpdateCallback((time) => { this.currentTime = time; }); }
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) 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 NEWS_LIST_DATA 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 news : AST#type_annotation#Left AST#primary_type#Left NewsItem 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . newsList AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left news 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arrayLength AST#member_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 . newsList AST#member_expression#Right AST#expression#Right . totalCount 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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . index 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 . index AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . arrayLength 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 . startOrEnd 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setCompleteCallback AST#member_expression#Right 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'completed state called' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlaying 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 . isPlaying 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#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 this AST#expression#Right . setTimeUpdateCallback 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 time 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 . currentTime 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#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#builder_function_body#Right AST#method_declaration#Right
async aboutToAppear() { NEWS_LIST_DATA.forEach((news: NewsItem) => { this.newsList.pushData(news); }) this.arrayLength = this.newsList.totalCount() if (this.index === 0 || this.index === this.arrayLength) { this.startOrEnd = true; } this.setCompleteCallback(() => { logger.info('completed state called'); this.isPlaying = !this.isPlaying; }); this.setTimeUpdateCallback((time) => { this.currentTime = time; }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L57-L76
c756358907b6d1f9772b4cddfe188c08cfcc2386
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileUtility.ets
arkts
deleteDirectoryAt
递归删除目录
static deleteDirectoryAt(path: string | null): boolean { if (!path) return false; let dirPath = path.endsWith('/') ? path : path + '/'; try { const stat = fs.statSync(dirPath); if (!stat.isDirectory) return false; const files = fs.listFileSync(dirPath); let success = true; files.forEach(file => { const fullPath = dirPath + file; const fileStat = fs.statSync(fullPath); if (fileStat.isFile()) { if (!FileUtility.deleteFileAt(fullPath)) success = false; } else if (fileStat.isDirectory()) { if (!FileUtility.deleteDirectoryAt(fullPath)) success = false; } }); if (success) { fs.rmdirSync(dirPath) } return success } catch (e) { return false; } }
AST#method_declaration#Left static deleteDirectoryAt AST#parameter_list#Left ( AST#parameter#Left path : 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#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#unary_expression#Left ! AST#expression#Left path AST#expression#Right AST#unary_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#ERROR#Left let dirPath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left path AST#expression#Right . endsWith 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 ? path : path + '/' ; AST#ERROR#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left stat = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath 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 stat AST#expression#Right AST#unary_expression#Right AST#expression#Right . isDirectory AST#member_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 const AST#variable_declarator#Left files = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath 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 success = AST#expression#Left AST#boolean_literal#Left true AST#boolean_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 files AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left file => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fullPath = AST#expression#Left AST#binary_expression#Left AST#expression#Left dirPath AST#expression#Right + AST#expression#Left file AST#expression#Right AST#binary_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 fileStat = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullPath 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#member_expression#Left AST#expression#Left fileStat AST#expression#Right . isFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#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 AST#unary_expression#Left ! AST#expression#Left FileUtility AST#expression#Right AST#unary_expression#Right AST#expression#Right . deleteFileAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left success = 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#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileStat AST#expression#Right . isDirectory AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#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 AST#unary_expression#Left ! AST#expression#Left FileUtility AST#expression#Right AST#unary_expression#Right AST#expression#Right . deleteDirectoryAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left success = 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#if_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#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#if_statement#Left if ( AST#expression#Left success 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 fs AST#expression#Right . rmdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath 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 success 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#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 deleteDirectoryAt(path: string | null): boolean { if (!path) return false; let dirPath = path.endsWith('/') ? path : path + '/'; try { const stat = fs.statSync(dirPath); if (!stat.isDirectory) return false; const files = fs.listFileSync(dirPath); let success = true; files.forEach(file => { const fullPath = dirPath + file; const fileStat = fs.statSync(fullPath); if (fileStat.isFile()) { if (!FileUtility.deleteFileAt(fullPath)) success = false; } else if (fileStat.isDirectory()) { if (!FileUtility.deleteDirectoryAt(fullPath)) success = false; } }); if (success) { fs.rmdirSync(dirPath) } return success } catch (e) { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L43-L73
bb4a86734bd7fbc06c15181d20f4147247adfc10
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringDealUtility.ets
arkts
getJoinedTextsFromList
/ 合并字符串列表
public static getJoinedTextsFromList( list : Array<string> | null, seperator : string ): string | null { if (list === null) { return null; } let result: string = ''; for (let i = 0; i < list.length; i++) { if (i !== 0) { result += seperator; } result += list[i]; } return result; }
AST#method_declaration#Left public static getJoinedTextsFromList AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#union_type#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#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : 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#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left list 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#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#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' 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 list 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i 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#assignment_expression#Left result += AST#expression#Left seperator 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 result += AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_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#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static getJoinedTextsFromList( list : Array<string> | null, seperator : string ): string | null { if (list === null) { return null; } let result: string = ''; for (let i = 0; i < list.length; i++) { if (i !== 0) { result += seperator; } result += list[i]; } return result; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L36-L53
e3d29420b03249c4f8845f3394aba9e9c5390aaa
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/SectionDatas.ets
arkts
allSections
========== 查询 ==========
allSections(): K[] { return this.sectionOrder; }
AST#method_declaration#Left allSections AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left K [ ] AST#array_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#member_expression#Left AST#expression#Left this AST#expression#Right . sectionOrder AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
allSections(): K[] { return this.sectionOrder; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/SectionDatas.ets#L50-L52
9163a3aa13234e55e646deec96cd4d2983b91868
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
getContrastColor
获取主题对比色
getContrastColor(backgroundColor: string): string { return '#000000'; // 临时返回黑色 }
AST#method_declaration#Left getContrastColor AST#parameter_list#Left ( AST#parameter#Left backgroundColor : 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 '#000000' AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 临时返回黑色 } AST#block_statement#Right AST#method_declaration#Right
getContrastColor(backgroundColor: string): string { return '#000000'; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L246-L248
98ea00fd94bfcffe66b518cc9a0afbd14734adf4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets
arkts
ListVideo
轮播样式
@Builder ListVideo() { Column() { Text($r('app.string.pip_window_list_video_text')) .width($r('app.string.pip_window_full_width')) Row() { List({ space: 20, scroller: this.scrollerForList }) { ForEach(this.arr, (index: number) => { ListItem() { Image($r(`app.media.pip_window_preview` + (index + 1))) .margin({ right: $r('app.integer.pip_window_list_video_image_margin_right'), bottom: $r('app.integer.pip_window_list_video_image_margin_bottom') }) .width($r('app.integer.pip_window_list_video_image_width')) .height($r('app.integer.pip_window_list_video_image_height')) .borderRadius($r('app.integer.pip_window_list_video_image_border')) } }) } .listDirection(Axis.Horizontal) .width($r('app.string.pip_window_full_width')) .height($r('app.string.pip_window_full_width')) } .margin({ bottom: $r('app.integer.pip_window_list_video_list_margin_bottom'), top: $r('app.integer.pip_window_list_video_list_margin_top') }) } .margin($r('app.integer.pip_window_list_video_margin')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ListVideo 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 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.pip_window_list_video_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pip_window_full_width' 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scrollerForList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arr AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left 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_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) 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#resource_expression#Left $r ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` app.media.pip_window_preview ` AST#template_literal#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_list_video_image_margin_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.pip_window_list_video_image_margin_bottom' 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#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_list_video_image_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_list_video_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_list_video_image_border' AST#expression#Right ) AST#resource_expression#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pip_window_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pip_window_full_width' AST#expression#Right ) AST#resource_expression#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#container_content_body#Right AST#ui_component#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.pip_window_list_video_list_margin_bottom' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.pip_window_list_video_list_margin_top' 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_list_video_margin' 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#builder_function_body#Right AST#method_declaration#Right
@Builder ListVideo() { Column() { Text($r('app.string.pip_window_list_video_text')) .width($r('app.string.pip_window_full_width')) Row() { List({ space: 20, scroller: this.scrollerForList }) { ForEach(this.arr, (index: number) => { ListItem() { Image($r(`app.media.pip_window_preview` + (index + 1))) .margin({ right: $r('app.integer.pip_window_list_video_image_margin_right'), bottom: $r('app.integer.pip_window_list_video_image_margin_bottom') }) .width($r('app.integer.pip_window_list_video_image_width')) .height($r('app.integer.pip_window_list_video_image_height')) .borderRadius($r('app.integer.pip_window_list_video_image_border')) } }) } .listDirection(Axis.Horizontal) .width($r('app.string.pip_window_full_width')) .height($r('app.string.pip_window_full_width')) } .margin({ bottom: $r('app.integer.pip_window_list_video_list_margin_bottom'), top: $r('app.integer.pip_window_list_video_list_margin_top') }) } .margin($r('app.integer.pip_window_list_video_margin')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets#L204-L234
b814ca7288af03b68b6a95158439b096b763a34f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets
arkts
getPixelMapFromMedia
从指定的媒体资源中获取PixelMap @param {Resource} resource - 要获取图像的媒体资源,包含资源的 bundle 名称、模块名称和 ID。
private async getPixelMapFromMedia(resource: Resource) { let unit8Array = await getContext(this).resourceManager.getMediaContent({ bundleName: resource.bundleName, moduleName: resource.moduleName, id: resource.id }); let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)); this.imagePixelMap = await imageSource.createPixelMap({ desiredPixelFormat: image.PixelMapFormat.RGBA_8888 }); }
AST#method_declaration#Left private async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource 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 unit8Array = 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#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getContext AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaContent 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 bundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left resource AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left moduleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left resource AST#expression#Right . moduleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left resource AST#expression#Right . id 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#variable_declaration#Left let AST#variable_declarator#Left imageSource = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource 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#member_expression#Left AST#expression#Left unit8Array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right . slice 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 AST#member_expression#Left AST#expression#Left unit8Array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right . byteLength 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#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 . imagePixelMap 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 imageSource AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap 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 desiredPixelFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . PixelMapFormat AST#member_expression#Right AST#expression#Right . RGBA_8888 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async getPixelMapFromMedia(resource: Resource) { let unit8Array = await getContext(this).resourceManager.getMediaContent({ bundleName: resource.bundleName, moduleName: resource.moduleName, id: resource.id }); let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)); this.imagePixelMap = await imageSource.createPixelMap({ desiredPixelFormat: image.PixelMapFormat.RGBA_8888 }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets#L100-L110
6dc27a16d0edbd73ad2b7d29920d26b0117f372d
gitee
cuilanxin/ArkTs-demo.git
3764799bb38e1f316055f57dae20822e215cb6f9
features/quickstart/src/main/ets/view/EnablementView.ets
arkts
private title: string = 'HarmonyOS第一课' private brief: string = '基于真实的开发场景,提供向导式学习,多维度融合课程等内容,给开发者提供全新的学习体验'
build() { Column(){ Image($r(this.enablementItem.imageSrc)) .width('100%') .borderRadius({topLeft: 16, topRight: 16}) .height(96) .objectFit(ImageFit.Cover) Text(this.enablementItem.title) .height(19) .width('100%') .fontSize(14) .textAlign(TextAlign.Start) .textOverflow({overflow: TextOverflow.Ellipsis}) .maxLines(1) .padding({left: 12, right: 12}) .margin({top:8}) Text(this.enablementItem.brief) .height(32) .width('100%') .fontSize(12) .textAlign(TextAlign.Start) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(2) .fontWeight(400) .fontColor('rgba(0, 0, 0, 0.6)') .padding({ left: 12, right: 12 }) .margin({ top: 2 }) } .borderRadius(16) .backgroundColor(Color.White) .width(160) .height(169) }
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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . enablementItem AST#member_expression#Right AST#expression#Right . imageSrc AST#member_expression#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 96 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . enablementItem AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 19 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 top AST#property_name#Right : AST#expression#Left 8 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#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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . enablementItem AST#member_expression#Right AST#expression#Right . brief AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 400 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0, 0, 0, 0.6)' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 top AST#property_name#Right : AST#expression#Left 2 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#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . width ( AST#expression#Left 160 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 169 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#build_body#Right AST#build_method#Right
build() { Column(){ Image($r(this.enablementItem.imageSrc)) .width('100%') .borderRadius({topLeft: 16, topRight: 16}) .height(96) .objectFit(ImageFit.Cover) Text(this.enablementItem.title) .height(19) .width('100%') .fontSize(14) .textAlign(TextAlign.Start) .textOverflow({overflow: TextOverflow.Ellipsis}) .maxLines(1) .padding({left: 12, right: 12}) .margin({top:8}) Text(this.enablementItem.brief) .height(32) .width('100%') .fontSize(12) .textAlign(TextAlign.Start) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(2) .fontWeight(400) .fontColor('rgba(0, 0, 0, 0.6)') .padding({ left: 12, right: 12 }) .margin({ top: 2 }) } .borderRadius(16) .backgroundColor(Color.White) .width(160) .height(169) }
https://github.com/cuilanxin/ArkTs-demo.git/blob/3764799bb38e1f316055f57dae20822e215cb6f9/features/quickstart/src/main/ets/view/EnablementView.ets#L10-L42
b8e6ab4798c7a3c581763c26cd5516de9c412f7a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets
arkts
this
手指移动,绘制移动轨迹
this.currentNodeDraw.path.lineTo(positionX, positionY);
AST#method_declaration#Left this AST#ERROR#Left . currentNodeDraw . path . l in eTo AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left positionX AST#parameter#Right , AST#parameter#Left positionY AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.currentNodeDraw.path.lineTo(positionX, positionY);
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L300-L300
6f6e8736a30e7cf571b237d46aa569ccf3dc8476
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
arkts
encodeGCM
加密-GCM模式 @param str 待加密的字符串 @param aesKey AES密钥 @returns
static async encodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> { //转换key let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建加密器 let cipher = crypto.createCipher('AES256|GCM|PKCS7'); //初始化加密 await cipher.init(mode, symKey, AES.gcmParams); //封装加密所需数据 let encode = new util.TextEncoder(); let a = encode.encodeInto(str); //开始加密 let updateOutput = await cipher.update({ data: encode.encodeInto(str) }); //拼接 let finalOutput = await cipher.doFinal(null); if (finalOutput != null) { AES.gcmParams.authTag = finalOutput; } //转换字符串 let result = StrAndUintUtil.unitArray2String(updateOutput.data); //返回 return OutDTO.OKByDataRow<string>('AES-GCM加密成功~', result); }
AST#method_declaration#Left static async encodeGCM 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_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 { //转换key AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = 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 CryptoUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aesKey AST#expression#Right , AST#expression#Left 'AES256' AST#expression#Right , AST#expression#Left 256 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 mode = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE 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 cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES256|GCM|PKCS7' 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#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mode AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AES AST#expression#Right . gcmParams 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#variable_declaration#Left let AST#variable_declarator#Left encode = 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 util AST#expression#Right AST#new_expression#Right AST#expression#Right . TextEncoder 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 let AST#variable_declarator#Left a = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encode AST#expression#Right . encodeInto 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //开始加密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = 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 cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . update 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 encode AST#expression#Right . encodeInto 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 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#variable_declaration#Left let AST#variable_declarator#Left finalOutput = 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 cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_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 AST#binary_expression#Left AST#expression#Left finalOutput 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#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 AES AST#expression#Right . gcmParams AST#member_expression#Right AST#expression#Right . authTag AST#member_expression#Right = AST#expression#Left finalOutput 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#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left 'AES-GCM加密成功~' AST#expression#Right , AST#expression#Left result 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 encodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> { let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto.createCipher('AES256|GCM|PKCS7'); await cipher.init(mode, symKey, AES.gcmParams); let encode = new util.TextEncoder(); let a = encode.encodeInto(str); let updateOutput = await cipher.update({ data: encode.encodeInto(str) }); let finalOutput = await cipher.doFinal(null); if (finalOutput != null) { AES.gcmParams.authTag = finalOutput; } let result = StrAndUintUtil.unitArray2String(updateOutput.data); return OutDTO.OKByDataRow<string>('AES-GCM加密成功~', result); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L85-L108
d7554fe461f9ab7596c10546b31a9fa9908598f2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets
arkts
startRecording
===================== 录音核心方法 =====================
private async startRecording(): Promise<void> { await this.stopRecording() if (this.isRecording) return; try { // 1. 创建录音文件并获取文件描述符 ✅ const filePath = this.getRecordedFilePath(); this.recordFile = await fs.open(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); // 2. 创建录音器 this.avRecorder = await media.createAVRecorder(); // 3. 配置录音参数(关键修正:使用 fd 格式) const avConfig: media.AVRecorderConfig = { audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, profile: { audioBitrate: 100000, audioChannels: 1, audioCodec: media.CodecMimeType.AUDIO_AAC, audioSampleRate: 11025, fileFormat: media.ContainerFormatType.CFT_MPEG_4A // 容器格式需为 m4a }, url: `fd://${this.recordFile.fd}` // ✅ 关键修正:文件描述符格式 }; await awaitDelay(500) // 4. 准备并开始录音 await this.avRecorder.prepare(avConfig); await this.avRecorder.start(); this.isRecording = true; // 5. 启动说话检测 this.startTalkingDetection(); } catch (err) { console.error(`录音启动失败: ${JSON.stringify(err)}`); // 异常时关闭文件 if (this.recordFile?.fd) await fs.close(this.recordFile.fd); } }
AST#method_declaration#Left private async startRecording 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#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 . stopRecording 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRecording 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#try_statement#Left try AST#block_statement#Left { // 1. 创建录音文件并获取文件描述符 ✅ AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getRecordedFilePath 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 this AST#expression#Right . recordFile 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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE 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 // 2. 创建录音器 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 . avRecorder 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 media AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVRecorder 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 // 3. 配置录音参数(关键修正:使用 fd 格式) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avConfig : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVRecorderConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left audioSourceType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . AudioSourceType AST#member_expression#Right AST#expression#Right . AUDIO_SOURCE_TYPE_MIC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left profile AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left audioBitrate AST#property_name#Right : AST#expression#Left 100000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left audioChannels AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left audioCodec AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . CodecMimeType AST#member_expression#Right AST#expression#Right . AUDIO_AAC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left audioSampleRate AST#property_name#Right : AST#expression#Left 11025 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left media AST#expression#Right . ContainerFormatType AST#member_expression#Right AST#expression#Right . CFT_MPEG_4A AST#member_expression#Right AST#expression#Right AST#property_assignment#Right // 容器格式需为 m4a } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` fd:// 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 . recordFile AST#member_expression#Right AST#expression#Right . fd AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_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#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left awaitDelay AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 4. 准备并开始录音 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 . avRecorder AST#member_expression#Right AST#expression#Right . prepare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left avConfig 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . avRecorder 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 . isRecording 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 // 5. 启动说话检测 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 . startTalkingDetection 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#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 console AST#expression#Right . error 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#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#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#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 . recordFile AST#member_expression#Right AST#expression#Right ?. fd AST#member_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#await_expression#Left await AST#expression#Left fs AST#expression#Right AST#await_expression#Right AST#expression#Right . close 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 . recordFile AST#member_expression#Right AST#expression#Right . fd 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#if_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 startRecording(): Promise<void> { await this.stopRecording() if (this.isRecording) return; try { const filePath = this.getRecordedFilePath(); this.recordFile = await fs.open(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); this.avRecorder = await media.createAVRecorder(); const avConfig: media.AVRecorderConfig = { audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, profile: { audioBitrate: 100000, audioChannels: 1, audioCodec: media.CodecMimeType.AUDIO_AAC, audioSampleRate: 11025, fileFormat: media.ContainerFormatType.CFT_MPEG_4A }, url: `fd://${this.recordFile.fd}` }; await awaitDelay(500) await this.avRecorder.prepare(avConfig); await this.avRecorder.start(); this.isRecording = true; this.startTalkingDetection(); } catch (err) { console.error(`录音启动失败: ${JSON.stringify(err)}`); if (this.recordFile?.fd) await fs.close(this.recordFile.fd); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L90-L129
85f7aff4af4dab7bc5dfcb8c8853c4d426f2000a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Contact.ets
arkts
Copyright (c) 2022 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 default class Contact { name: string destinationHost: string constructor
AST#export_declaration#Left export AST#ERROR#Left default class Contact { name AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left dest in ationHost AST#ERROR#Right : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export default class Contact { name: string destinationHost: string constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Contact.ets#L16-L20
8f3c9b193b9e59e6073796b92648b15c61d6d2e4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
@file 订单退款页面 ViewModel @author Joker.X
@ObservedV2 export default class OrderRefundViewModel extends BaseNetWorkViewModel<Order> { /** * 订单仓库 */ private readonly repository: OrderRepository = new OrderRepository(); /** * 公共仓库 */ private readonly commonRepository: CommonRepository = new CommonRepository(); /** * 路由参数 */ private readonly routeParam: OrderIdParam | undefined = getRouteParams<OrderIdParam>(OrderRoutes.Refund); /** * 订单 ID */ private readonly orderId: number = this.routeParam?.orderId ?? 0; /** * 订单商品列表(购物车结构) */ @Trace cartList: Cart[] = []; /** * 退款原因弹窗显示状态 */ @Trace refundModalVisible: boolean = false; /** * 退款原因弹窗网络状态 */ @Trace refundReasonsUiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING; /** * 退款原因列表 */ @Trace refundReasonList: DictItem[] = []; /** * 选中的退款原因 */ @Trace selectedRefundReason: DictItem | null = null; /** * 请求订单详情数据 * @returns {Promise<NetworkResponse<Order>>} 网络请求 Promise */ protected requestRepository(): Promise<NetworkResponse<Order>> { return this.repository.getOrderInfo(this.orderId); } /** * 请求成功回调 * @param {Order} data - 订单数据 * @returns {void} 无返回值 */ protected onRequestSuccess(data: Order): void { this.cartList = this.convertOrderGoodsToCart(data); super.onRequestSuccess(data); } /** * 显示退款原因选择弹窗 * @returns {void} 无返回值 */ showRefundModal(): void { this.refundModalVisible = true; this.loadRefundReasons(); } /** * 隐藏退款原因选择弹窗 * @returns {void} 无返回值 */ hideRefundModal(): void { this.refundModalVisible = false; } /** * 选择退款原因 * @param {DictItem | null} reason - 退款原因 * @returns {void} 无返回值 */ selectRefundReason(reason: DictItem | null): void { this.selectedRefundReason = reason; } /** * 加载退款原因字典数据 * @returns {void} 无返回值 */ loadRefundReasons(): void { if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) { return; } const params: DictDataRequest = new DictDataRequest(); params.types = ["orderRefundReason"]; RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params)) .toast(false) .start((): void => { this.refundReasonsUiState = BaseNetWorkUiState.LOADING; }) .execute() .then((data: DictDataResponse): void => { this.refundReasonList = data.orderRefundReason ?? []; this.refundReasonsUiState = BaseNetWorkUiState.SUCCESS; }) .catch((): void => { this.refundReasonList = []; this.refundReasonsUiState = BaseNetWorkUiState.ERROR; }); } /** * 提交退款申请 * @returns {void} 无返回值 */ submitRefundApplication(): void { if (!this.selectedRefundReason) { return; } const params: RefundOrderRequest = new RefundOrderRequest(); params.orderId = this.orderId; params.reason = this.selectedRefundReason.name ?? ""; RequestHelper.repository<boolean>(this.repository.refundOrder(params)) .loading(true) .execute() .then((): void => { const result: RefreshResult = { refresh: true }; navigateBackWithResult(result); }); } /** * 将订单商品列表转换为购物车结构 * @param {Order} order - 订单数据 * @returns {Cart[]} 购物车列表 */ private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; } /** * 构建购物车列表 * @param {OrderGoods[]} goodsList - 订单商品列表 * @returns {Cart[]} 购物车列表 */ private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goodsId, [goods]); } } const result: Cart[] = []; groupedMap.forEach((items: OrderGoods[], goodsId: number) => { const firstItem = items[0]; const cart = new Cart(); cart.goodsId = goodsId; cart.goodsName = firstItem.goodsInfo?.title ?? ""; cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? ""; const allSpecs: CartGoodsSpec[] = []; for (const orderGoods of items) { if (orderGoods.spec) { const cartSpec = new CartGoodsSpec(); cartSpec.id = orderGoods.spec.id; cartSpec.goodsId = orderGoods.spec.goodsId; cartSpec.name = orderGoods.spec.name; cartSpec.price = orderGoods.spec.price; cartSpec.stock = orderGoods.spec.stock; cartSpec.count = orderGoods.count; cartSpec.images = orderGoods.spec.images; allSpecs.push(cartSpec); } } cart.spec = allSpecs; result.push(cart); }); return result; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderRefundViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Order 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#class_body#Left { /** * 订单仓库 */ AST#property_declaration#Left private readonly repository : AST#type_annotation#Left AST#primary_type#Left OrderRepository 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 OrderRepository 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 readonly commonRepository : AST#type_annotation#Left AST#primary_type#Left CommonRepository 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 CommonRepository 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 readonly routeParam : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left OrderIdParam 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 getRouteParams AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left OrderIdParam 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 OrderRoutes AST#expression#Right . Refund AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 订单 ID */ AST#property_declaration#Left private readonly orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = 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 . routeParam AST#member_expression#Right AST#expression#Right ?. orderId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 订单商品列表(购物车结构) */ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right cartList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] 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 AST#decorator#Left @ Trace AST#decorator#Right refundModalVisible : 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 /** * 退款原因弹窗网络状态 */ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right refundReasonsUiState : AST#type_annotation#Left AST#primary_type#Left BaseNetWorkUiState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 退款原因列表 */ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right refundReasonList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DictItem [ ] 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 AST#decorator#Left @ Trace AST#decorator#Right selectedRefundReason : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DictItem 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 /** * 请求订单详情数据 * @returns {Promise<NetworkResponse<Order>>} 网络请求 Promise */ AST#method_declaration#Left protected requestRepository 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 Order 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 . repository AST#member_expression#Right AST#expression#Right . getOrderInfo 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 . orderId AST#member_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 /** * 请求成功回调 * @param {Order} data - 订单数据 * @returns {void} 无返回值 */ AST#method_declaration#Left protected onRequestSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Order 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartList 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 . convertOrderGoodsToCart 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#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 super AST#expression#Right . onRequestSuccess 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 } AST#builder_function_body#Right AST#method_declaration#Right /** * 显示退款原因选择弹窗 * @returns {void} 无返回值 */ AST#method_declaration#Left showRefundModal 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundModalVisible 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadRefundReasons 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 /** * 隐藏退款原因选择弹窗 * @returns {void} 无返回值 */ AST#method_declaration#Left hideRefundModal 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundModalVisible 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#builder_function_body#Right AST#method_declaration#Right /** * 选择退款原因 * @param {DictItem | null} reason - 退款原因 * @returns {void} 无返回值 */ AST#method_declaration#Left selectRefundReason AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DictItem AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedRefundReason AST#member_expression#Right = AST#expression#Left reason AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 加载退款原因字典数据 * @returns {void} 无返回值 */ AST#method_declaration#Left loadRefundReasons 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#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 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 this AST#expression#Right . refundReasonsUiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . refundReasonList 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#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#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left DictDataRequest 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 DictDataRequest 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . types AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "orderRefundReason" AST#expression#Right ] 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#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 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 RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#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 . commonRepository AST#member_expression#Right AST#expression#Right . getDictData 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#argument_list#Right AST#call_expression#Right AST#expression#Right . toast AST#member_expression#Right 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 . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#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 . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING 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#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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#type_annotation#Left AST#primary_type#Left DictDataResponse 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundReasonList AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . orderRefundReason 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#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 . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . SUCCESS 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#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_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundReasonList 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . ERROR 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#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 /** * 提交退款申请 * @returns {void} 无返回值 */ AST#method_declaration#Left submitRefundApplication 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#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 . selectedRefundReason AST#member_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#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left RefundOrderRequest 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 RefundOrderRequest 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . orderId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderId 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 params AST#expression#Right . reason AST#member_expression#Right = 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 . selectedRefundReason AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right 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#argument_list#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 . repository AST#member_expression#Right AST#expression#Right . refundOrder 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#argument_list#Right AST#call_expression#Right AST#expression#Right . loading AST#member_expression#Right 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 . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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_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 result : AST#type_annotation#Left AST#primary_type#Left RefreshResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left refresh 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#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 navigateBackWithResult 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#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 /** * 将订单商品列表转换为购物车结构 * @param {Order} order - 订单数据 * @returns {Cart[]} 购物车列表 */ AST#method_declaration#Left private convertOrderGoodsToCart AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order 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 Cart [ ] AST#array_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#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left order AST#expression#Right . goodsList AST#member_expression#Right AST#expression#Right ?. length AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildCartList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left order AST#expression#Right . goodsList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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 /** * 构建购物车列表 * @param {OrderGoods[]} goodsList - 订单商品列表 * @returns {Cart[]} 购物车列表 */ AST#method_declaration#Left private buildCartList AST#parameter_list#Left ( AST#parameter#Left goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_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#array_type#Left Cart [ ] 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 groupedMap = 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 OrderGoods [ ] 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#for_statement#Left for ( const goods of AST#expression#Left goodsList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left existingList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap 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 goods AST#expression#Right . goodsId 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 existingList 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 existingList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goods 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 groupedMap 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 goods AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left goods AST#expression#Right ] 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#block_statement#Right AST#for_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 Cart [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap 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 items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left goodsId : 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#variable_declaration#Left const AST#variable_declarator#Left firstItem = AST#expression#Left AST#subscript_expression#Left AST#expression#Left items AST#expression#Right [ AST#expression#Left 0 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#variable_declaration#Left const AST#variable_declarator#Left cart = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Cart 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left goodsId 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 cart AST#expression#Right . goodsName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. title AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsMainPic AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. mainPic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" 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#variable_declaration#Left const AST#variable_declarator#Left allSpecs : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartGoodsSpec [ ] 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 ( const orderGoods of AST#expression#Left items AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cartSpec = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CartGoodsSpec 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_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 cartSpec AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . goodsId 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 cartSpec AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_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 cartSpec AST#expression#Right . price AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . price 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 cartSpec AST#expression#Right . stock AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . stock 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 cartSpec AST#expression#Right . count AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . count 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 cartSpec AST#expression#Right . images AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderGoods AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . images 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 allSpecs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cartSpec 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#for_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 cart AST#expression#Right . spec AST#member_expression#Right = AST#expression#Left allSpecs 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 result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cart 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#return_statement#Left return AST#expression#Left result 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#decorated_export_declaration#Right
@ObservedV2 export default class OrderRefundViewModel extends BaseNetWorkViewModel<Order> { private readonly repository: OrderRepository = new OrderRepository(); private readonly commonRepository: CommonRepository = new CommonRepository(); private readonly routeParam: OrderIdParam | undefined = getRouteParams<OrderIdParam>(OrderRoutes.Refund); private readonly orderId: number = this.routeParam?.orderId ?? 0; @Trace cartList: Cart[] = []; @Trace refundModalVisible: boolean = false; @Trace refundReasonsUiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING; @Trace refundReasonList: DictItem[] = []; @Trace selectedRefundReason: DictItem | null = null; protected requestRepository(): Promise<NetworkResponse<Order>> { return this.repository.getOrderInfo(this.orderId); } protected onRequestSuccess(data: Order): void { this.cartList = this.convertOrderGoodsToCart(data); super.onRequestSuccess(data); } showRefundModal(): void { this.refundModalVisible = true; this.loadRefundReasons(); } hideRefundModal(): void { this.refundModalVisible = false; } selectRefundReason(reason: DictItem | null): void { this.selectedRefundReason = reason; } loadRefundReasons(): void { if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) { return; } const params: DictDataRequest = new DictDataRequest(); params.types = ["orderRefundReason"]; RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params)) .toast(false) .start((): void => { this.refundReasonsUiState = BaseNetWorkUiState.LOADING; }) .execute() .then((data: DictDataResponse): void => { this.refundReasonList = data.orderRefundReason ?? []; this.refundReasonsUiState = BaseNetWorkUiState.SUCCESS; }) .catch((): void => { this.refundReasonList = []; this.refundReasonsUiState = BaseNetWorkUiState.ERROR; }); } submitRefundApplication(): void { if (!this.selectedRefundReason) { return; } const params: RefundOrderRequest = new RefundOrderRequest(); params.orderId = this.orderId; params.reason = this.selectedRefundReason.name ?? ""; RequestHelper.repository<boolean>(this.repository.refundOrder(params)) .loading(true) .execute() .then((): void => { const result: RefreshResult = { refresh: true }; navigateBackWithResult(result); }); } private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; } private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goodsId, [goods]); } } const result: Cart[] = []; groupedMap.forEach((items: OrderGoods[], goodsId: number) => { const firstItem = items[0]; const cart = new Cart(); cart.goodsId = goodsId; cart.goodsName = firstItem.goodsInfo?.title ?? ""; cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? ""; const allSpecs: CartGoodsSpec[] = []; for (const orderGoods of items) { if (orderGoods.spec) { const cartSpec = new CartGoodsSpec(); cartSpec.id = orderGoods.spec.id; cartSpec.goodsId = orderGoods.spec.goodsId; cartSpec.name = orderGoods.spec.name; cartSpec.price = orderGoods.spec.price; cartSpec.stock = orderGoods.spec.stock; cartSpec.count = orderGoods.count; cartSpec.images = orderGoods.spec.images; allSpecs.push(cartSpec); } } cart.spec = allSpecs; result.push(cart); }); return result; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L22-L214
709310c461ccf63dbdb187fd1bb1a9c175623ddd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets
arkts
setWindowStage
缓存windowStage @param windowStage 当前WindowStage实例 @returns {void}
setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; }
AST#method_declaration#Left setWindowStage AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage 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#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 . windowStage AST#member_expression#Right = AST#expression#Left windowStage AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L50-L52
95f6bb11c6eed44ef2c300ae9ab601a216ae804e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AudioToVideoSync/entry/src/main/ets/common/CommonConstants.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 class CommonConstants { /** * Index page Tag. */ public static readonly INDEX_TAG: string = 'INDEX'; /** * PX. */ public static readonly PX: string = 'px'; /** * Default value. */ public static readonly DEFAULT_VALUE: number = 0; /** * Default width. */ public static readonly DEFAULT_WIDTH: number = 1920; /** * Default height. */ public static readonly DEFAULT_HEIGHT: number = 1080; /** * Duration. */ public static readonly DURATION: number = 2000; /** * The distance between toast dialog box and the bottom of screen. */ public static readonly BOTTOM: number = 80; /** * Full size. */ public static readonly FULL_SIZE: string = '100%'; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Index page Tag. */ AST#property_declaration#Left public static readonly INDEX_TAG : 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 /** * PX. */ AST#property_declaration#Left public static readonly PX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'px' AST#expression#Right ; AST#property_declaration#Right /** * Default value. */ AST#property_declaration#Left public static readonly DEFAULT_VALUE : 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 /** * Default width. */ AST#property_declaration#Left public static readonly DEFAULT_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1920 AST#expression#Right ; AST#property_declaration#Right /** * Default height. */ AST#property_declaration#Left public static readonly DEFAULT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1080 AST#expression#Right ; AST#property_declaration#Right /** * Duration. */ AST#property_declaration#Left public static readonly DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2000 AST#expression#Right ; AST#property_declaration#Right /** * The distance between toast dialog box and the bottom of screen. */ AST#property_declaration#Left public static readonly BOTTOM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right ; AST#property_declaration#Right /** * Full size. */ AST#property_declaration#Left public static readonly FULL_SIZE : 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { public static readonly INDEX_TAG: string = 'INDEX'; public static readonly PX: string = 'px'; public static readonly DEFAULT_VALUE: number = 0; public static readonly DEFAULT_WIDTH: number = 1920; public static readonly DEFAULT_HEIGHT: number = 1080; public static readonly DURATION: number = 2000; public static readonly BOTTOM: number = 80; public static readonly FULL_SIZE: string = '100%'; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AudioToVideoSync/entry/src/main/ets/common/CommonConstants.ets#L16-L56
41a4e8430a572ca43aac2bcffebde80223a50b02
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets
arkts
旋转中心点参数y,表示垂直方向上旋转起始位置
build() { // TODO: 知识点: 创建文本组件。创建时添加rotate属性,用来控制组件旋转。 Text(`${this.pageNum}`) .fontSize($r('app.integer.page_turning_animation_font_size')) .fontColor(Color.White) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Center) .backgroundColor($r('app.color.page_turning_animation_color_dark_blue')) .width($r('app.string.page_turning_animation_text_width')) .height($r('app.string.page_turning_animation_text_height')) .borderRadius($r('app.integer.page_turning_animation_border_radius')) .rotate({ // 使用rotate属性控制旋转 x: 0, y: 1, // 指定y轴作为旋转轴 z: 0, angle: this.rotateAngle, centerX: this.positionX, centerY: this.positionY, }) }
AST#build_method#Left build ( ) AST#build_body#Left { // TODO: 知识点: 创建文本组件。创建时添加rotate属性,用来控制组件旋转。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageNum AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.page_turning_animation_font_size' AST#expression#Right ) AST#resource_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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.page_turning_animation_color_dark_blue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.page_turning_animation_text_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.page_turning_animation_text_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.page_turning_animation_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { // 使用rotate属性控制旋转 AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 指定y轴作为旋转轴 AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotateAngle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionY 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#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#build_body#Right AST#build_method#Right
build() { Text(`${this.pageNum}`) .fontSize($r('app.integer.page_turning_animation_font_size')) .fontColor(Color.White) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Center) .backgroundColor($r('app.color.page_turning_animation_color_dark_blue')) .width($r('app.string.page_turning_animation_text_width')) .height($r('app.string.page_turning_animation_text_height')) .borderRadius($r('app.integer.page_turning_animation_border_radius')) .rotate({ x: 0, y: 1, z: 0, angle: this.rotateAngle, centerX: this.positionX, centerY: this.positionY, }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets#L26-L46
dedc472cf5efa6a73079ceefc791a266c34f22e9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
hmac
消息认证码计算,异步 @param data 传入的消息 @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512)。 @param symKey 共享对称密钥。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
static async hmac(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.hmac(data, algName, symKey, resultCoding); }
AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . SHA AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SHA256' AST#expression#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#expression#Left AST#member_expression#Left AST#expression#Left SHA AST#expression#Right . symKey AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' 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 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 { 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 . hmac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left resultCoding 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 hmac(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.hmac(data, algName, symKey, resultCoding); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L89-L92
2e8189fe83563210ccd2ddf5f147636c0124441a
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieDataSet.ets
arkts
copy
@Override public DataSet<PieEntry> copy() { List<PieEntry> entries = new ArrayList<>(); for (int i = 0; i < mEntries.size(); i++) { entries.add(mEntries.get(i).copy()); } PieDataSet copied = new PieDataSet(entries, getLabel()); copy(copied); return copied; } protected void copy(PieDataSet pieDataSet) { super.copy(pieDataSet); }
public copy(): DataSet<PieEntry> { let entries = new JArrayList<PieEntry>(); if (this.mEntries != null) { for (let i = 0; i < this.mEntries.size(); i++) { entries.add(this.mEntries.get(i).copy()); } } let copied = new PieDataSet(entries, this.getLabel()); this.copyTo(copied); return copied; }
AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieEntry 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 entries = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieEntry 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#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 . mEntries 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#block_statement#Left { 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#call_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 i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mEntries 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 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 entries AST#expression#Right . add 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mEntries AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . copy 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#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left copied = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PieDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entries AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLabel 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 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 . copyTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left copied 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 copied AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public copy(): DataSet<PieEntry> { let entries = new JArrayList<PieEntry>(); if (this.mEntries != null) { for (let i = 0; i < this.mEntries.size(); i++) { entries.add(this.mEntries.get(i).copy()); } } let copied = new PieDataSet(entries, this.getLabel()); this.copyTo(copied); return copied; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L64-L74
34921b30b0591b7e36f25e4e5c345d1ed6cc45a8
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/model/DataModel.ets
arkts
Video data structure.
export interface VideoData { video: Resource | string; name: string; description: string; time: string; controller: VideoController; auto: boolean; head: Resource; likeCount: string; commentCount: string; favoriteCount: string; shareCount: string; hotspot: string; play: boolean; index: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface VideoData AST#object_type#Left { AST#type_member#Left video : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string 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#type_member#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left controller : AST#type_annotation#Left AST#primary_type#Left VideoController AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left auto : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left head : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left likeCount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left commentCount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left favoriteCount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left shareCount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left hotspot : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left play : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left index : AST#type_annotation#Left AST#primary_type#Left number 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 VideoData { video: Resource | string; name: string; description: string; time: string; controller: VideoController; auto: boolean; head: Resource; likeCount: string; commentCount: string; favoriteCount: string; shareCount: string; hotspot: string; play: boolean; index: number; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/DataModel.ets#L19-L34
d1ea11bf3611cc77ac23ea84b735d6d6137dc1cd
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/listener/ShadowListener.ets
arkts
设备影子监听器,用于设备向平台获取设备影子数据
export interface ShadowListener { /** * * @param requestId 请求id * @param shadowDataList 服务影子数据 */ onShadow: (requestId: string, shadowDataList?: ShadowData[]) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShadowListener AST#object_type#Left { /** * * @param requestId 请求id * @param shadowDataList 服务影子数据 */ AST#type_member#Left onShadow : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left requestId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left shadowDataList ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ShadowData [ ] AST#array_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#function_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ShadowListener { onShadow: (requestId: string, shadowDataList?: ShadowData[]) => void; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/listener/ShadowListener.ets#L20-L27
00a9d56864f3e286a354a1a793bb4aa673b0b48d
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets
arkts
getPriorityText
获取优先级文本
getPriorityText(priority: number): string { switch (priority) { case 1: return '最高'; case 2: return '高'; case 3: return '中'; case 4: return '低'; case 5: return '最低'; default: return '中'; } }
AST#method_declaration#Left getPriorityText AST#parameter_list#Left ( AST#parameter#Left priority : 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 string 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 switch ( AST#expression#Left priority AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 1 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '最高' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 2 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '高' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 3 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '中' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 4 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '低' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 5 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '最低' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '中' AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#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
getPriorityText(priority: number): string { switch (priority) { case 1: return '最高'; case 2: return '高'; case 3: return '中'; case 4: return '低'; case 5: return '最低'; default: return '中'; } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L598-L613
cf009282e1f9f214cf4d1580915e4558b08fdfb4
github
buqiuz/game-puzzle.git
605dc0fac0738466db308a8ba255b5e9094c52ac
entry/src/main/ets/model/ImageModel.ets
arkts
splitPic
图片划分
async splitPic(index: number,splitCount: number): Promise<PictureItem[]> { let imagesData: Array<photoAccessHelper.PhotoAsset> = await this.getAllImg(); let imagePackerApi = image.createImagePacker(); let file=await fileIo.open(imagesData[index].uri, fileIo.OpenMode.READ_ONLY) let imagePixelMap: PictureItem[] = []; let fd: number = file.fd; let imageSource = image.createImageSource(fd); let imageInfo = await imageSource.getImageInfo(); Logger.info(TAG, `sizeImg createImageSource ${JSON.stringify(imageSource)}`); let height = imageInfo.size.height / splitCount; let width = imageInfo.size.width / splitCount; for (let i = 0; i < splitCount; i++) { for (let j = 0; j < splitCount; j++) { let picItem: PictureItem; if (i === splitCount - 1 && j === splitCount - 1) { picItem = new PictureItem(splitCount*splitCount-1, {} as image.PixelMap); imagePixelMap.push(picItem); } else { Logger.info(TAG, `sizeImg x = ${width} y = ${height}`); let decodingOptions: image.DecodingOptions = { desiredRegion: { size: { height: height, width: width }, x: j * width, y: i * height } } imagePixelMap.push( new PictureItem(i * splitCount + j, await imageSource.createPixelMap(decodingOptions))); } } } imagePackerApi.release(); fileIo.closeSync(fd); return imagePixelMap; }
AST#method_declaration#Left async splitPic 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 splitCount : 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 AST#array_type#Left PictureItem [ ] 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 let AST#variable_declarator#Left imagesData : 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#qualified_type#Left photoAccessHelper . PhotoAsset 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#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 . getAllImg 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 let AST#variable_declarator#Left imagePackerApi = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImagePacker 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 let AST#variable_declarator#Left file = 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 fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left imagesData AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . uri AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_ONLY 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#variable_declaration#Left let AST#variable_declarator#Left imagePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] 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 fd : 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 file AST#expression#Right . fd 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 imageSource = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fd 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 imageInfo = 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 imageSource AST#expression#Right AST#await_expression#Right AST#expression#Right . getImageInfo 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 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#template_literal#Left ` sizeImg createImageSource AST#template_substitution#Left $ { 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 imageSource 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left splitCount AST#expression#Right AST#binary_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 width = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left splitCount AST#expression#Right AST#binary_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 splitCount 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = 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 j AST#expression#Right < AST#expression#Left splitCount AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left j 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 picItem : AST#type_annotation#Left AST#primary_type#Left PictureItem AST#primary_type#Right AST#type_annotation#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 i AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left splitCount AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left splitCount AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#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#assignment_expression#Left picItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PictureItem AST#expression#Right AST#new_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 splitCount AST#expression#Right * AST#expression#Left splitCount AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 imagePixelMap AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left picItem 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 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#template_literal#Left ` sizeImg x = AST#template_substitution#Left $ { AST#expression#Left width AST#expression#Right } AST#template_substitution#Right y = AST#template_substitution#Left $ { AST#expression#Left height 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#variable_declaration#Left let AST#variable_declarator#Left decodingOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions 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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left desiredRegion AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left height AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left width 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 x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right * AST#expression#Left width AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right * AST#expression#Left height AST#expression#Right AST#binary_expression#Right 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#ERROR#Left imagePixelMap AST#ERROR#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 PictureItem AST#expression#Right AST#new_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 i AST#expression#Right * AST#expression#Left splitCount AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left j 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 AST#await_expression#Left await AST#expression#Left imageSource AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decodingOptions 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#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#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 imagePackerApi AST#expression#Right . release 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 fileIo AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fd 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 imagePixelMap AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async splitPic(index: number,splitCount: number): Promise<PictureItem[]> { let imagesData: Array<photoAccessHelper.PhotoAsset> = await this.getAllImg(); let imagePackerApi = image.createImagePacker(); let file=await fileIo.open(imagesData[index].uri, fileIo.OpenMode.READ_ONLY) let imagePixelMap: PictureItem[] = []; let fd: number = file.fd; let imageSource = image.createImageSource(fd); let imageInfo = await imageSource.getImageInfo(); Logger.info(TAG, `sizeImg createImageSource ${JSON.stringify(imageSource)}`); let height = imageInfo.size.height / splitCount; let width = imageInfo.size.width / splitCount; for (let i = 0; i < splitCount; i++) { for (let j = 0; j < splitCount; j++) { let picItem: PictureItem; if (i === splitCount - 1 && j === splitCount - 1) { picItem = new PictureItem(splitCount*splitCount-1, {} as image.PixelMap); imagePixelMap.push(picItem); } else { Logger.info(TAG, `sizeImg x = ${width} y = ${height}`); let decodingOptions: image.DecodingOptions = { desiredRegion: { size: { height: height, width: width }, x: j * width, y: i * height } } imagePixelMap.push( new PictureItem(i * splitCount + j, await imageSource.createPixelMap(decodingOptions))); } } } imagePackerApi.release(); fileIo.closeSync(fd); return imagePixelMap; }
https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/model/ImageModel.ets#L118-L158
345600d07f7f8bfce266fd9f279a2f823b101282
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoResult.ets
arkts
@file Demo 模块导航返回结果定义 @author Joker.X Demo 返回结果
export interface DemoResult { /** * 标题 */ title: string; /** * 说明 */ description: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DemoResult AST#object_type#Left { /** * 标题 */ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 说明 */ AST#type_member#Left description : 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 DemoResult { title: string; description: string; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoResult.ets#L9-L18
5b76e53919ca8c271128c57f711af3332d6cd8c4
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/MyMath.ets
arkts
toDegrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0. Params: angrad – an angle, in radians
public static toDegrees(ang: number) { return ang * MyMath.radians }
AST#method_declaration#Left public static toDegrees AST#parameter_list#Left ( AST#parameter#Left ang : 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ang AST#expression#Right * AST#expression#Left MyMath AST#expression#Right AST#binary_expression#Right AST#expression#Right . radians AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static toDegrees(ang: number) { return ang * MyMath.radians }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MyMath.ets#L47-L49
8fb12c16b07c44d483d1b109b93fe4cb41e928eb
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/viewmodel/WindowViewModel.ets
arkts
窗口管理ViewModel - 提供验证码数据 Binds verify data to components and provides interfaces.
export class WindowViewModel { /** * 获取验证码集合 * Get verify items map. * * @return {Map<number, VerifyItem>} verifyMap - 验证码映射表 */ getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); // Source: 从 WindowManager 项目迁移的验证码数据 verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; } }
AST#export_declaration#Left export AST#class_declaration#Left class WindowViewModel AST#class_body#Left { /** * 获取验证码集合 * Get verify items map. * * @return {Map<number, VerifyItem>} verifyMap - 验证码映射表 */ AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map 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 VerifyItem 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 verifyMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map 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 VerifyItem 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#new_expression#Left new AST#expression#Left Map 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 // Source: 从 WindowManager 项目迁移的验证码数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifyMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VerifyItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_verity_character1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'XYZK' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifyMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VerifyItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_verity_character2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'LHBR' 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 verifyMap 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 WindowViewModel { getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/WindowViewModel.ets#L22-L37
651aa7531630e501ed36840f3bcf100086a4d3d9
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ColumnInfo.ets
arkts
Column Info.
export default class ColumnInfo { name: string; type: string; length?: number; nullable?: boolean; primary?: boolean; autoincrement?: boolean; constructor(name: string, type: string, length?: number, nullable?: boolean, primary?: boolean, autoincrement?: boolean) { this.name = name; this.type = type; this.primary = primary; this.length = length; this.nullable = nullable; this.autoincrement = autoincrement; } }
AST#export_declaration#Left export default AST#class_declaration#Left class ColumnInfo AST#class_body#Left { AST#property_declaration#Left name : 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 type : 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 length ? : 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 nullable ? : 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 primary ? : 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 autoincrement ? : 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 name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 length ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left nullable ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left primary ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left autoincrement ? : 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 . name AST#member_expression#Right = AST#expression#Left name 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 . primary AST#member_expression#Right = AST#expression#Left primary 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 . length AST#member_expression#Right = AST#expression#Left length 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 . nullable AST#member_expression#Right = AST#expression#Left nullable 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 . autoincrement AST#member_expression#Right = AST#expression#Left autoincrement 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 default class ColumnInfo { name: string; type: string; length?: number; nullable?: boolean; primary?: boolean; autoincrement?: boolean; constructor(name: string, type: string, length?: number, nullable?: boolean, primary?: boolean, autoincrement?: boolean) { this.name = name; this.type = type; this.primary = primary; this.length = length; this.nullable = nullable; this.autoincrement = autoincrement; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ColumnInfo.ets#L20-L37
77b54da84db8a5bb03ce76087d6436d9ff6da06a
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
登录返回数据结构
export interface IUserDao { userInfo: IUserInfo; token: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IUserDao AST#object_type#Left { AST#type_member#Left userInfo : AST#type_annotation#Left AST#primary_type#Left IUserInfo AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left token : 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 IUserDao { userInfo: IUserInfo; token: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L57-L60
ab5ada8e767f657ad87eb5d41c6c713d2f55317f
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhToast.ets
arkts
showLoadingText
/ 加载中 - 系统样式
public static showLoadingText(loadingText = '加载中...') { JhToast._showToast(loadingText, _ToastType.loading) }
AST#method_declaration#Left public static showLoadingText AST#parameter_list#Left ( AST#parameter#Left loadingText = AST#expression#Left '加载中...' AST#expression#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 JhToast AST#expression#Right . _showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left loadingText AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left _ToastType AST#expression#Right . loading AST#member_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
public static showLoadingText(loadingText = '加载中...') { JhToast._showToast(loadingText, _ToastType.loading) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L64-L66
39662f9e9fc1b564b1b1feb84e059e8d2e05074e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
arkts
ActionSheetDialogBuilder
ActionSheetDialog @param options
@Builder export function ActionSheetDialogBuilder(options: BottomSheetOptions) { ActionSheetDialogView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ActionSheetDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left ActionSheetDialogView ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left options AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function ActionSheetDialogBuilder(options: BottomSheetOptions) { ActionSheetDialogView({ options: options }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L167-L170
6d1a76a317680eaea78c376b7b5add61123f81fa
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIService.ets
arkts
initializeDefaultConfigs
初始化默认模型配置
private initializeDefaultConfigs(): void { this.modelConfigs = [ { id: 'zhipu_default', name: '智谱AI (GLM-4)', provider: AIProvider.CUSTOM, apiKey: '', apiUrl: 'https://open.bigmodel.cn/api/paas/v4/chat/completions', model: 'glm-4', maxTokens: 2000, temperature: 0.8, topP: 0.8, isDefault: true, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }, { id: 'openai_gpt35', name: 'OpenAI GPT-3.5', provider: AIProvider.OPENAI, apiKey: '', apiUrl: 'https://api.openai.com/v1/chat/completions', model: 'gpt-3.5-turbo', maxTokens: 1500, temperature: 0.7, topP: 0.9, isDefault: false, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }, { id: 'baidu_ernie', name: '百度文心一言', provider: AIProvider.BAIDU, apiKey: '', apiUrl: 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions', model: 'ERNIE-Bot-turbo', maxTokens: 1500, temperature: 0.8, isDefault: false, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() } ]; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Initialized ${this.modelConfigs.length} default AI model configs`); }
AST#method_declaration#Left private initializeDefaultConfigs 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modelConfigs AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 'zhipu_default' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '智谱AI (GLM-4)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left provider AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AIProvider AST#expression#Right . CUSTOM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiKey AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiUrl AST#property_name#Right : AST#expression#Left 'https://open.bigmodel.cn/api/paas/v4/chat/completions' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left model AST#property_name#Right : AST#expression#Left 'glm-4' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxTokens AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left 0.8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topP AST#property_name#Right : AST#expression#Left 0.8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isDefault AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled 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 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 'openai_gpt35' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'OpenAI GPT-3.5' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left provider AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AIProvider AST#expression#Right . OPENAI AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiKey AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiUrl AST#property_name#Right : AST#expression#Left 'https://api.openai.com/v1/chat/completions' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left model AST#property_name#Right : AST#expression#Left 'gpt-3.5-turbo' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxTokens AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left 0.7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topP AST#property_name#Right : AST#expression#Left 0.9 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isDefault 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 enabled 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 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 'baidu_ernie' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '百度文心一言' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left provider AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AIProvider AST#expression#Right . BAIDU AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiKey AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiUrl AST#property_name#Right : AST#expression#Left 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left model AST#property_name#Right : AST#expression#Left 'ERNIE-Bot-turbo' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxTokens AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left 0.8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isDefault 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 enabled 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 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#array_literal#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 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 ` Initialized 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 . modelConfigs AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right default AI model configs ` AST#template_literal#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
private initializeDefaultConfigs(): void { this.modelConfigs = [ { id: 'zhipu_default', name: '智谱AI (GLM-4)', provider: AIProvider.CUSTOM, apiKey: '', apiUrl: 'https://open.bigmodel.cn/api/paas/v4/chat/completions', model: 'glm-4', maxTokens: 2000, temperature: 0.8, topP: 0.8, isDefault: true, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }, { id: 'openai_gpt35', name: 'OpenAI GPT-3.5', provider: AIProvider.OPENAI, apiKey: '', apiUrl: 'https://api.openai.com/v1/chat/completions', model: 'gpt-3.5-turbo', maxTokens: 1500, temperature: 0.7, topP: 0.9, isDefault: false, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }, { id: 'baidu_ernie', name: '百度文心一言', provider: AIProvider.BAIDU, apiKey: '', apiUrl: 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions', model: 'ERNIE-Bot-turbo', maxTokens: 1500, temperature: 0.8, isDefault: false, enabled: false, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() } ]; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Initialized ${this.modelConfigs.length} default AI model configs`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIService.ets#L56-L105
de6f85c57f502679f3cbf60decc3d3a0c9e0a774
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/NavigationResult.ets
arkts
@file 公共导航返回结果定义 @author Joker.X 刷新返回结果
export interface RefreshResult { /** * 是否需要刷新 */ refresh?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RefreshResult AST#object_type#Left { /** * 是否需要刷新 */ AST#type_member#Left refresh ? : AST#type_annotation#Left AST#primary_type#Left boolean 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 RefreshResult { refresh?: boolean; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationResult.ets#L9-L14
e176a9cf5d17e7be92600e877a6a5d87c086eed8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/GetDate.ets
arkts
日历表上周六对应的序列号,从周日开始算起,取值0~6 根据指定年份和月份获取该月在日历表上的日期排布数据 @param {number} specifiedMonth - 指定月份 @param {number} specifiedYear - 指定年份
export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] { let currentFirstWeekDay: number = 0; // 初始化指定月的第一天是周几 let currentLastWeekDay: number = 0; // 初始化指定月的最后一天是周几 let currentAllDay: number[] = []; // 初始化指定月的日期排列数组 let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate(); // 初始化指定月总天数 currentFirstWeekDay = new Date(specifiedYear, specifiedMonth - 1, 1).getDay(); // 获取指定月的第一天是周几 currentLastWeekDay = new Date(specifiedYear, specifiedMonth - 1, totalDays).getDay(); // 获取指定月的最后一天是周几 // 将月份中显示上个月日期的内容置0 for (let item = 0; item < currentFirstWeekDay; item++) { currentAllDay.push(0); } // 将本月日期内容存入数组 for (let item = 1; item <= totalDays; item++) { currentAllDay.push(item); } // 将月份中显示下个月日期的内容置0 for (let item = 0; item < SATURDAY - currentLastWeekDay; item++) { currentAllDay.push(0); } return currentAllDay; }
AST#export_declaration#Left export AST#function_declaration#Left function getMonthDate AST#parameter_list#Left ( AST#parameter#Left specifiedMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specifiedYear : 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#array_type#Left number [ ] AST#array_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 currentFirstWeekDay : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 初始化指定月的第一天是周几 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentLastWeekDay : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 初始化指定月的最后一天是周几 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentAllDay : 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#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 totalDays = 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#expression#Left specifiedYear AST#expression#Right , AST#expression#Left specifiedMonth AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 初始化指定月总天数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left currentFirstWeekDay = 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#expression#Left specifiedYear AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left specifiedMonth 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#argument_list#Right AST#call_expression#Right AST#expression#Right . getDay 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#assignment_expression#Left currentLastWeekDay = 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#expression#Left specifiedYear AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left specifiedMonth AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left totalDays AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDay 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 // 获取指定月的最后一天是周几 // 将月份中显示上个月日期的内容置0 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left item = 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 item AST#expression#Right < AST#expression#Left currentFirstWeekDay AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left item 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 currentAllDay AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left item = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left item AST#expression#Right <= AST#expression#Left totalDays AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left item 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 currentAllDay 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#for_statement#Right AST#statement#Right // 将月份中显示下个月日期的内容置0 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left item = 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 item AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left SATURDAY AST#expression#Right - AST#expression#Left currentLastWeekDay AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left item 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 currentAllDay AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 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#return_statement#Left return AST#expression#Left currentAllDay AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] { let currentFirstWeekDay: number = 0; let currentLastWeekDay: number = 0; let currentAllDay: number[] = []; let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate(); currentFirstWeekDay = new Date(specifiedYear, specifiedMonth - 1, 1).getDay(); currentLastWeekDay = new Date(specifiedYear, specifiedMonth - 1, totalDays).getDay(); for (let item = 0; item < currentFirstWeekDay; item++) { currentAllDay.push(0); } for (let item = 1; item <= totalDays; item++) { currentAllDay.push(item); } for (let item = 0; item < SATURDAY - currentLastWeekDay; item++) { currentAllDay.push(0); } return currentAllDay; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/GetDate.ets#L60-L80
ca4a887381375c15535ec7109b298594c9e3e54f
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/adapter/WindowAdapter.ets
arkts
getDisplayId
获取当前窗口的 displayId @returns {number | undefined} displayId
private getDisplayId(): number | undefined { return this.windowClass?.getWindowProperties().displayId; }
AST#method_declaration#Left private getDisplayId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number 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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right ?. getWindowProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . displayId AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getDisplayId(): number | undefined { return this.windowClass?.getWindowProperties().displayId; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L225-L227
99ba2bc196739011679d2ecabcc5fb002a7813ae
github