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
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
TabBuilder
自定义Tab标签
@Builder TabBuilder(index: number, title: string, icon: string) { Column({ space: 4 }) { SymbolGlyph($r(`sys.symbol.${icon}`)) .fontSize(24) .fontColor([this.selectedTab === index ? '#007DFF' : '#999999']) Text(title) .fontSize(12) .fontColor(this.selectedTab === index ? '#007DFF' : '#999999') } .width('100%') .height(56) .justifyContent(FlexAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder 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 title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : 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#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 4 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 SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#template_literal#Left ` sys.symbol. AST#template_substitution#Left $ { AST#expression#Left icon AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedTab AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#007DFF' AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedTab AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#007DFF' AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#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#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 TabBuilder(index: number, title: string, icon: string) { Column({ space: 4 }) { SymbolGlyph($r(`sys.symbol.${icon}`)) .fontSize(24) .fontColor([this.selectedTab === index ? '#007DFF' : '#999999']) Text(title) .fontSize(12) .fontColor(this.selectedTab === index ? '#007DFF' : '#999999') } .width('100%') .height(56) .justifyContent(FlexAlign.Center) }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L126-L140
6ac7e13e163ad5daabfed1850c945e028ce40e23
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/utils.ets
arkts
将一个数字或数字字符串格式化成保留两位小数的数字。 @param value - 要格式化的数字或数字字符串 @returns 格式化后的数字,保留两位小数
export function formatToDecimal(value: number | string, decimal: number = 2): number { let num = typeof value === 'string' ? parseFloat(value) : value; if (isNaN(num)) { throw new Error("Invalid input: not a number"); } return Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal); }
AST#export_declaration#Left export AST#function_declaration#Left function formatToDecimal AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left decimal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left num = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat 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#expression#Left value AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left num 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 "Invalid input: not a number" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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 num AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . pow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right , AST#expression#Left decimal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . pow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right , AST#expression#Left decimal 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#function_declaration#Right AST#export_declaration#Right
export function formatToDecimal(value: number | string, decimal: number = 2): number { let num = typeof value === 'string' ? parseFloat(value) : value; if (isNaN(num)) { throw new Error("Invalid input: not a number"); } return Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal); }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L59-L66
c77221ad7281f38106990db25b259876c93e9dd2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets
arkts
onDestroy
[StartExclude initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
AST#method_declaration#Left onDestroy 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 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 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onDestroy' 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
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets#L33-L35
47d37399ccab7744cc3bb9da2a2aebc4dc1fd8bf
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getNowMonth
获取当前月
static getNowMonth(): number { let date = new Date(); return date.getMonth() + 1; }
AST#method_declaration#Left static getNowMonth 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#variable_declaration#Left let AST#variable_declarator#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getNowMonth(): number { let date = new Date(); return date.getMonth() + 1; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L125-L128
a5553f721cc0d19fb4e378c5633f2cb9fd35acf8
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.multimedia.avVolumePanel.d.ets
arkts
AVVolumePanel
A panel to set the system audio output volume. @syscap SystemCapability.Multimedia.Audio.Volume @atomicservice @since 12
@Component export declare struct AVVolumePanel { /** * Sets the device volume through the volume panel. * The value should be between mininum and maxinum current device volume, otherwise it will be discarded. * * @type { ?number } * @syscap SystemCapability.Multimedia.Audio.Volume * @atomicservice * @since 12 */ @Prop volumeLevel?: number; /** * Sets the custom parameters of volume panel. * * @type { ?AVVolumePanelParameter } * @syscap SystemCapability.Multimedia.Audio.Volume * @atomicservice * @since 12 */ @Prop volumeParameter?: AVVolumePanelParameter; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AVVolumePanel AST#component_body#Left { /** * Sets the device volume through the volume panel. * The value should be between mininum and maxinum current device volume, otherwise it will be discarded. * * @type { ?number } * @syscap SystemCapability.Multimedia.Audio.Volume * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right volumeLevel ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the custom parameters of volume panel. * * @type { ?AVVolumePanelParameter } * @syscap SystemCapability.Multimedia.Audio.Volume * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right volumeParameter ? : AST#type_annotation#Left AST#primary_type#Left AVVolumePanelParameter AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export declare struct AVVolumePanel { @Prop volumeLevel?: number; @Prop volumeParameter?: AVVolumePanelParameter; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.multimedia.avVolumePanel.d.ets#L46-L70
8d1b52fab311e2662cc3a8d32d416eb1b9a5b1f5
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets
arkts
selectFile
选择文件,为简单起见,选择一个不太大的文本文件
selectFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true } }).catch((e) => { this.msgHistory += 'DocumentViewPicker.select failed ' + e.message + "\r\n"; }); }
AST#method_declaration#Left selectFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker 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 documentPicker AST#expression#Right . select 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 result 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#member_expression#Left AST#expression#Left result 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uploadFilePath AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "select file: " AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . uploadFilePath AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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 . canUpload 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#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 e 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'DocumentViewPicker.select failed ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#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
selectFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true } }).catch((e) => { this.msgHistory += 'DocumentViewPicker.select failed ' + e.message + "\r\n"; }); }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets#L152-L163
c1373fe38b6db375af481d87b970fbfc6c1bf2dd
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/common/UIUtils.ets
arkts
Toast配置
export class ToastOptions { message: string = ''; duration: number = 2000; constructor(message: string, duration?: number) { this.message = message; this.duration = duration || 2000; } }
AST#export_declaration#Left export AST#class_declaration#Left class ToastOptions AST#class_body#Left { AST#property_declaration#Left message : 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 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 AST#constructor_declaration#Left constructor 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#Left duration ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left 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 . duration AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right || AST#expression#Left 2000 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#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ToastOptions { message: string = ''; duration: number = 2000; constructor(message: string, duration?: number) { this.message = message; this.duration = duration || 2000; } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L22-L30
3f54a2ec3dee904154e38bded6852643ae98a4c8
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/History.ets
arkts
getAll
查所有搜索关键字
getAll() { const obj = this.getStore().getAllSync() // { vue: vue, ts: ts, ui: ui } // ['vue', 'ts', 'ui'] return Object.keys(obj) }
AST#method_declaration#Left getAll AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left obj = 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 . getStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getAllSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // { vue: vue, ts: ts, ui: ui } // ['vue', 'ts', 'ui'] 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 Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left obj 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
getAll() { const obj = this.getStore().getAllSync() return Object.keys(obj) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L35-L40
aaf7fdb4efa13a774eefafc457d6d10fc4200961
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
计算文件的MD5码
export function computeMD5(file: string | number): Uint8Array { let md5Stream: fs.Stream if (typeof file === 'string') { md5Stream = fs.createStreamSync(file, "r"); } else { md5Stream = fs.fdopenStreamSync(file, "r") } let dataBuff: ArrayBuffer = new ArrayBuffer(4096) let mdAlgName = "MD5"; let md = cryptoFramework.createMd(mdAlgName); let readCount = md5Stream.readSync(dataBuff) while (readCount > 0) { let messageData = new Uint8Array(dataBuff.slice(0, readCount)); let updateMessageBlob: cryptoFramework.DataBlob = { data: messageData }; md.updateSync(updateMessageBlob); readCount = md5Stream.readSync(dataBuff) } let mdResult = md.digestSync(); md5Stream.closeSync() return mdResult.data }
AST#export_declaration#Left export AST#function_declaration#Left function computeMD5 AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md5Stream : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . Stream AST#qualified_type#Right 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#unary_expression#Left typeof AST#expression#Left file AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left md5Stream = 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 file AST#expression#Right , AST#expression#Left "r" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left md5Stream = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . fdopenStreamSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file AST#expression#Right , AST#expression#Left "r" 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#variable_declaration#Left let AST#variable_declarator#Left dataBuff : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer 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 ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4096 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 mdAlgName = AST#expression#Left "MD5" 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 md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mdAlgName 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 readCount = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md5Stream AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBuff 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#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left readCount AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_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 dataBuff 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 readCount 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#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left messageData 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 md AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob 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 readCount = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md5Stream AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBuff 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#while_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mdResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . digestSync 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 md5Stream 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left mdResult AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function computeMD5(file: string | number): Uint8Array { let md5Stream: fs.Stream if (typeof file === 'string') { md5Stream = fs.createStreamSync(file, "r"); } else { md5Stream = fs.fdopenStreamSync(file, "r") } let dataBuff: ArrayBuffer = new ArrayBuffer(4096) let mdAlgName = "MD5"; let md = cryptoFramework.createMd(mdAlgName); let readCount = md5Stream.readSync(dataBuff) while (readCount > 0) { let messageData = new Uint8Array(dataBuff.slice(0, readCount)); let updateMessageBlob: cryptoFramework.DataBlob = { data: messageData }; md.updateSync(updateMessageBlob); readCount = md5Stream.readSync(dataBuff) } let mdResult = md.digestSync(); md5Stream.closeSync() return mdResult.data }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L79-L102
d80d36522c79236d80ecc0027334512bb0dba13a
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
aboutToAppear
初始化日期、天气、播放器、文件夹、关系型数据库数据。
public aboutToAppear(): void { this.getToday(); this.getAVPlayer(); this.getWeather(); if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder'] as Folder; } console.debug('[hxk] MyDay folder: ' + JSON.stringify(this.folder)); this.scheduleTable.getRdbStore(() => { this.getAllSchedules(); }); }
AST#method_declaration#Left public 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 . getToday AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAVPlayer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getWeather 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams 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 'folder' AST#expression#Right ] AST#subscript_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 . folder AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams 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 'folder' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Folder 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#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 console AST#expression#Right . debug 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 '[hxk] MyDay folder: ' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . folder AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . scheduleTable AST#member_expression#Right AST#expression#Right . getRdbStore 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 . getAllSchedules 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public aboutToAppear(): void { this.getToday(); this.getAVPlayer(); this.getWeather(); if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder'] as Folder; } console.debug('[hxk] MyDay folder: ' + JSON.stringify(this.folder)); this.scheduleTable.getRdbStore(() => { this.getAllSchedules(); }); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L211-L225
e02c93fed9bbf306edb38205486b1daede4cfbed
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets
arkts
getRandomInt
获取随机整数(默认包含最小值,不包含最大值) @param min @param max @returns
static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { return RandomUtil.getRandomInt(min, max) }
AST#method_declaration#Left static getRandomInt AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left max : 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 Number AST#expression#Right . MAX_SAFE_INTEGER AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RandomUtil AST#expression#Right . getRandomInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left min AST#expression#Right , AST#expression#Left max 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 getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { return RandomUtil.getRandomInt(min, max) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets#L24-L26
95718481a1ba3256dffe8e04b219c1137b4228a6
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/action/ToastUtil.ets
arkts
showShort
弹出土司,时长为:1.5s,距离底部默认为80vp @param message 提示消息 @param options (距离屏幕底部的位置、是否显示在应用之上)
static showShort(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 1); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options.uiContext?.getPromptAction().showToast(toastOptions); } }
AST#method_declaration#Left static showShort AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left ToastOptions 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 message 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left message AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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#assignment_expression#Left options = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . initToastDefault AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right , AST#expression#Left 1 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#variable_declaration#Left let AST#variable_declarator#Left toastOptions = AST#expression#Left AST#as_expression#Left AST#expression#Left options AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left toastOptions 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#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 options AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right ?. getPromptAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions 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
static showShort(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 1); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options.uiContext?.getPromptAction().showToast(toastOptions); } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L61-L68
417746b4f6e1db8855fd14ddff25058459ddffc0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/CameraOptions.ets
arkts
相机参数类
export class CameraOptions { mediaTypes: Array<cameraPicker.PickerMediaType> = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO]; //媒体类型。 cameraPosition: camera.CameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; //相机的位置。 saveUri?: string; //保存配置信息的uri。 videoDuration?: number; //录制的最大时长。 }
AST#export_declaration#Left export AST#class_declaration#Left class CameraOptions AST#class_body#Left { AST#property_declaration#Left mediaTypes : 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 cameraPicker . PickerMediaType 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#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cameraPicker AST#expression#Right . PickerMediaType AST#member_expression#Right AST#expression#Right . PHOTO AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cameraPicker AST#expression#Right . PickerMediaType AST#member_expression#Right AST#expression#Right . VIDEO AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right //媒体类型。 AST#property_declaration#Left cameraPosition : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraPosition AST#qualified_type#Right 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 camera AST#expression#Right . CameraPosition AST#member_expression#Right AST#expression#Right . CAMERA_POSITION_BACK AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right //相机的位置。 AST#property_declaration#Left saveUri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //保存配置信息的uri。 AST#property_declaration#Left videoDuration ? : AST#type_annotation#Left AST#primary_type#Left number 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 CameraOptions { mediaTypes: Array<cameraPicker.PickerMediaType> = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO]; cameraPosition: camera.CameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; saveUri?: string; videoDuration?: number; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/CameraOptions.ets#L5-L10
10bbd1c4a9f8fc37370f58a0bdd2d129b7a3ab1b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/components/enhanced/EnhancedCard.ets
arkts
padding
链式调用方法
padding(value: 'small' | 'medium' | 'large'): EnhancedCard { this.padding = value; return this; }
AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right AST#ERROR#Left : 'small' | 'medium' | 'large' AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EnhancedCard 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 . padding 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
padding(value: 'small' | 'medium' | 'large'): EnhancedCard { this.padding = value; return this; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/enhanced/EnhancedCard.ets#L163-L166
a609cf985b6dd3f0206bd3c6cb5972b0b2018aa1
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/common/CommonUtils.ets
arkts
根据矩形区域获取填充Rect区域的文字大小。 @param context @param rect @param initFontSize 9px @returns
export function getTextMaxFontSize(context: CanvasRenderingContext2D, rect: DrawRect, initFontSize: string, txt: string): string { if (initFontSize.endsWith('px') && rect.width > 0 && rect.width > 0) { context.font = initFontSize //计算最最新价格合适的文本大小,文本过大就缩小,反之就放大。文本过大,两种情况:过宽、过高。 var heightFontMaxSizeInt: number = parseInt(initFontSize.replace('px', ''), 10) //根据宽计算一遍最合适的字体大小 var tmpTextMetrics = context.measureText(txt) var txtW = tmpTextMetrics.width if (txtW > rect.width) { while (txtW > rect.width && heightFontMaxSizeInt > 5) { heightFontMaxSizeInt -= 1 context.font = heightFontMaxSizeInt + 'px' txtW = context.measureText(txt).width } } else { while (txtW < rect.width && heightFontMaxSizeInt > 5) { heightFontMaxSizeInt += 1 context.font = heightFontMaxSizeInt + 'px' txtW = context.measureText(txt).width } } //再根据高计算一遍最合适的字体 tmpTextMetrics = context.measureText(txt) var txtH = tmpTextMetrics.height var heightMaxFont = heightFontMaxSizeInt if (txtH > rect.height) { while (txtH > rect.height && heightMaxFont > 5) { heightMaxFont -= 1 context.font = heightMaxFont + 'px' txtH = context.measureText(txt).height } } else { while (txtH < rect.height && heightMaxFont > 5) { heightMaxFont += 1 context.font = heightMaxFont + 'px' txtH = context.measureText(txt).height } } return Math.min(heightMaxFont, heightFontMaxSizeInt) + 'px' } return initFontSize }
AST#export_declaration#Left export AST#function_declaration#Left function getTextMaxFontSize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left DrawRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left initFontSize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left txt : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left initFontSize AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'px' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . width 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 context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left initFontSize AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //计算最最新价格合适的文本大小,文本过大就缩小,反之就放大。文本过大,两种情况:过宽、过高。 AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left heightFontMaxSizeInt : 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 parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left initFontSize AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'px' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left 10 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 var AST#variable_declarator#Left tmpTextMetrics = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt 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 var AST#variable_declarator#Left txtW = AST#expression#Left AST#member_expression#Left AST#expression#Left tmpTextMetrics AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left txtW AST#expression#Right > AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left txtW AST#expression#Right > AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left heightFontMaxSizeInt 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left heightFontMaxSizeInt -= AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left heightFontMaxSizeInt AST#expression#Right + AST#expression#Left 'px' 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 txtW = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width 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#while_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left txtW AST#expression#Right < AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left heightFontMaxSizeInt 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left heightFontMaxSizeInt += AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left heightFontMaxSizeInt AST#expression#Right + AST#expression#Left 'px' 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 txtW = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width 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#while_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 tmpTextMetrics = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt 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#variable_declaration#Left var AST#variable_declarator#Left txtH = AST#expression#Left AST#member_expression#Left AST#expression#Left tmpTextMetrics AST#expression#Right . height 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 var AST#variable_declarator#Left heightMaxFont = AST#expression#Left heightFontMaxSizeInt 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 txtH AST#expression#Right > AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left txtH AST#expression#Right > AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left heightMaxFont 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left heightMaxFont -= AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left heightMaxFont AST#expression#Right + AST#expression#Left 'px' 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 txtH = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height 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#while_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left txtH AST#expression#Right < AST#expression#Left rect AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left heightMaxFont 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left heightMaxFont += AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left heightMaxFont AST#expression#Right + AST#expression#Left 'px' 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 txtH = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . measureText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left txt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height 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#while_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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left heightMaxFont AST#expression#Right , AST#expression#Left heightFontMaxSizeInt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 'px' AST#expression#Right AST#binary_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 initFontSize AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getTextMaxFontSize(context: CanvasRenderingContext2D, rect: DrawRect, initFontSize: string, txt: string): string { if (initFontSize.endsWith('px') && rect.width > 0 && rect.width > 0) { context.font = initFontSize var heightFontMaxSizeInt: number = parseInt(initFontSize.replace('px', ''), 10) var tmpTextMetrics = context.measureText(txt) var txtW = tmpTextMetrics.width if (txtW > rect.width) { while (txtW > rect.width && heightFontMaxSizeInt > 5) { heightFontMaxSizeInt -= 1 context.font = heightFontMaxSizeInt + 'px' txtW = context.measureText(txt).width } } else { while (txtW < rect.width && heightFontMaxSizeInt > 5) { heightFontMaxSizeInt += 1 context.font = heightFontMaxSizeInt + 'px' txtW = context.measureText(txt).width } } tmpTextMetrics = context.measureText(txt) var txtH = tmpTextMetrics.height var heightMaxFont = heightFontMaxSizeInt if (txtH > rect.height) { while (txtH > rect.height && heightMaxFont > 5) { heightMaxFont -= 1 context.font = heightMaxFont + 'px' txtH = context.measureText(txt).height } } else { while (txtH < rect.height && heightMaxFont > 5) { heightMaxFont += 1 context.font = heightMaxFont + 'px' txtH = context.measureText(txt).height } } return Math.min(heightMaxFont, heightFontMaxSizeInt) + 'px' } return initFontSize }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/common/CommonUtils.ets#L12-L55
7ee28c60306e8c7287328bc2516e4d78ffe1e436
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
unlink
删除单个文件,使用Promise异步回调。 @param path 文件的应用沙箱路径。 @returns
static unlink(path: string): Promise<void> { return fs.unlink(path); }
AST#method_declaration#Left static unlink AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . unlink 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static unlink(path: string): Promise<void> { return fs.unlink(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L362-L364
0a4290216447e79cb6ced3ed97e2fe340b86aff3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets
arkts
connectSocket
连接Socket @param address @param port
async connectSocket(address: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls connectSocket address: ${address}`); try { if (!this.tlsSocket) { return false; } if (await this.isConnected()) { Logger.info(`${TAG} tls connectSocket sucess`); return true; } let options: socket.TLSConnectOptions = { address: { address: address, port: port, family: 1, }, secureOptions: { key: key, cert: cert, ca: [ca], protocols: [socket.Protocol.TLSv12], cipherSuite: 'ALL:@SECLEVEL=0', }, }; await this.tlsSocket.connect(options); await this.tlsSocket.setExtraOptions({}); Logger.info(`${TAG} tls connectSocket sucess`); return true; } catch (e) { Logger.error(`${TAG} tls connectSocket error ${JSON.stringify(e)}}`); } return false; }
AST#method_declaration#Left async connectSocket AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : 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 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#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 AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tls connectSocket address: AST#template_substitution#Left $ { AST#expression#Left address AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 . tlsSocket AST#member_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#if_statement#Left if ( 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 . isConnected 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#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 AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tls connectSocket sucess ` 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TLSConnectOptions 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 address AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left address AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left port AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family 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 secureOptions AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left key AST#property_name#Right : AST#expression#Left key AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cert AST#property_name#Right : AST#expression#Left cert AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ca AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left ca AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left protocols 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 socket AST#expression#Right . Protocol AST#member_expression#Right AST#expression#Right . TLSv12 AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cipherSuite AST#property_name#Right : AST#expression#Left 'ALL:@SECLEVEL=0' 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . tlsSocket AST#member_expression#Right AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . tlsSocket AST#member_expression#Right AST#expression#Right . setExtraOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { } 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 Logger AST#expression#Right . info 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 TAG AST#expression#Right } AST#template_substitution#Right tls connectSocket sucess ` 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 ( 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 Logger 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 TAG AST#expression#Right } AST#template_substitution#Right tls connectSocket error 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 e 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#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#method_declaration#Right
async connectSocket(address: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls connectSocket address: ${address}`); try { if (!this.tlsSocket) { return false; } if (await this.isConnected()) { Logger.info(`${TAG} tls connectSocket sucess`); return true; } let options: socket.TLSConnectOptions = { address: { address: address, port: port, family: 1, }, secureOptions: { key: key, cert: cert, ca: [ca], protocols: [socket.Protocol.TLSv12], cipherSuite: 'ALL:@SECLEVEL=0', }, }; await this.tlsSocket.connect(options); await this.tlsSocket.setExtraOptions({}); Logger.info(`${TAG} tls connectSocket sucess`); return true; } catch (e) { Logger.error(`${TAG} tls connectSocket error ${JSON.stringify(e)}}`); } return false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L128-L164
d0e3607c3d985b55e6dc6458b8dc80bd6be930ba
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/player/PlayerArgs.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/24 12:01 @Version V1.0 @Description
export interface PlayerArgs extends DetailArgs { type: FinItemType }
AST#export_declaration#Left export AST#interface_declaration#Left interface PlayerArgs AST#extends_clause#Left extends DetailArgs AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left FinItemType 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 PlayerArgs extends DetailArgs { type: FinItemType }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/player/PlayerArgs.ets#L11-L15
7d2f8dd243079cfde2955006c5ae0a24eadf8f58
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets
arkts
addData
向规定位置添加数据
public addData(index: number, data: FlowItemContent): void { this.momentList.splice(index, 0, data); this.notifyDataAdd(index); }
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 FlowItemContent 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 . momentList 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
public addData(index: number, data: FlowItemContent): void { this.momentList.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L85-L88
518e71638edc69e1485f274efaaed55dd9fed4c4
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
setTypeface
sets a specific Typeface for the labels @param tf
public setTypeface(tf: FontFamily /*Typeface*/ ): void { this.mTypeface = tf; }
AST#method_declaration#Left public setTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontFamily AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*Typeface*/ ) 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 . mTypeface AST#member_expression#Right = AST#expression#Left tf AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setTypeface(tf: FontFamily ): void { this.mTypeface = tf; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L113-L116
1ca3847ce4e80c4bf9f96cfac39652311b717188
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/entryability/EntryAbility.ets
arkts
importIconPack
--------------- Icon Pack Manager ---------------//
async importIconPack(uri: string) { const tempDirPath = getContext(this).tempDir; const tempArchiveName = tempDirPath + '/temp.zip'; const tempFolderPath = tempDirPath + '/temp'; try { const userFileFd = (await fs.open(uri)).fd; // check archive size if ((await fs.stat(userFileFd)).size > MAX_ICON_PACK_SIZE) { throw new Error('import-fail-file-too-large'); } // decompress to tempDir await fs.mkdir(tempFolderPath); await fs.copyFile(userFileFd, tempArchiveName); await zlib.decompressFile(tempArchiveName, tempFolderPath); // load `pack.json` const arrayBuffer = new ArrayBuffer(1*1024*1024); //1MB const tempPackFile = await fs.open(tempFolderPath + '/pack.json'); const readLen = await fs.read(tempPackFile.fd, arrayBuffer); await fs.close(tempPackFile); // move to `uuid` folder const iconPack: IconPackSchema =JSON.parse( buffer.from(arrayBuffer, 0, readLen).toString() ); const fileDirPath = getContext(this).filesDir; const targetFolderPath: string = fileDirPath + '/' + iconPack.uuid; if (await fs.access(targetFolderPath)) { throw new Error('import-fail-already-exists'); } await fs.rename(tempFolderPath, targetFolderPath); // insert into local preferences const isDefault = (this.icons.length==0); const pack: IconPackStore = { uuid: iconPack.uuid, name: iconPack.name, version: iconPack.version, icons: iconPack.icons.length, uri: targetFolderPath, isDefault, }; await this.iconManager.appendPack(pack); // promptAction.showToast({message: $r('app.string.setting_icon_pack_success'), duration: 500}); if (isDefault) { getContext(this).eventHub.emit(EVENT_ICON_PACK_APPLY_REQUEST, {uuid: iconPack.uuid, force: true}); } } catch (e) { const errorMsg = (e as Error).message; console.error(errorMsg); let message = $r('app.string.setting_icon_pack_fail_common'); if (errorMsg==='import-fail-file-too-large') { message = $r('app.string.setting_icon_pack_fail_file_too_large'); } else if (errorMsg==='import-fail-already-exists') { message = $r('app.string.setting_icon_pack_fail_already_exists'); } promptAction.showToast({message, duration: 500}); } finally { fs.unlink(tempArchiveName); fs.rmdir(tempFolderPath); } }
AST#method_declaration#Left async importIconPack AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempDirPath = 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempArchiveName = AST#expression#Left AST#binary_expression#Left AST#expression#Left tempDirPath AST#expression#Right + AST#expression#Left '/temp.zip' 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 tempFolderPath = AST#expression#Left AST#binary_expression#Left AST#expression#Left tempDirPath AST#expression#Right + AST#expression#Left '/temp' 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 const AST#variable_declarator#Left userFileFd = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_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 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 uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . fd AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // check archive size 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#parenthesized_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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . stat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userFileFd AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right > AST#expression#Left MAX_ICON_PACK_SIZE AST#expression#Right AST#binary_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 'import-fail-file-too-large' 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 // decompress to tempDir 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 . mkdir AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tempFolderPath 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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . copyFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userFileFd AST#expression#Right , AST#expression#Left tempArchiveName 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 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 tempArchiveName AST#expression#Right , AST#expression#Left tempFolderPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // load `pack.json` AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left arrayBuffer = 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right * AST#expression#Left 1024 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1024 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //1MB AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempPackFile = 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 AST#binary_expression#Left AST#expression#Left tempFolderPath AST#expression#Right + AST#expression#Left '/pack.json' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left readLen = 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 . read AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left tempPackFile AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left arrayBuffer 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 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 tempPackFile AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // move to `uuid` folder AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left iconPack : AST#type_annotation#Left AST#primary_type#Left IconPackSchema 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 JSON AST#expression#Right . parse 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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arrayBuffer AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left readLen 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#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 fileDirPath = 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 . filesDir 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 targetFolderPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left fileDirPath AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left iconPack AST#expression#Right AST#binary_expression#Right AST#expression#Right . uuid AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 . access AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetFolderPath 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 'import-fail-already-exists' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . rename AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tempFolderPath AST#expression#Right , AST#expression#Left targetFolderPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // insert into local preferences AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isDefault = 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 this AST#expression#Right . icons 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pack : AST#type_annotation#Left AST#primary_type#Left IconPackStore AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left uuid AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left iconPack AST#expression#Right . uuid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left iconPack AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left version AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left iconPack AST#expression#Right . version AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icons AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left iconPack AST#expression#Right . icons AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left targetFolderPath AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left isDefault 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#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 . iconManager AST#member_expression#Right AST#expression#Right . appendPack AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pack AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.setting_icon_pack_success' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 500 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#if_statement#Left if ( AST#expression#Left isDefault 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 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 . eventHub AST#member_expression#Right AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left EVENT_ICON_PACK_APPLY_REQUEST AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left uuid AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left iconPack AST#expression#Right . uuid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left force 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#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#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorMsg = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left e AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.setting_icon_pack_fail_common' AST#expression#Right ) AST#resource_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 errorMsg AST#expression#Right === AST#expression#Left 'import-fail-file-too-large' 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 message = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.setting_icon_pack_fail_file_too_large' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left errorMsg AST#expression#Right === AST#expression#Left 'import-fail-already-exists' 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 message = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.setting_icon_pack_fail_already_exists' AST#expression#Right ) AST#resource_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#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 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 message AST#property_assignment#Right , 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#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#finally_clause#Left finally 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 . unlink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tempArchiveName 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 . rmdir AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tempFolderPath 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async importIconPack(uri: string) { const tempDirPath = getContext(this).tempDir; const tempArchiveName = tempDirPath + '/temp.zip'; const tempFolderPath = tempDirPath + '/temp'; try { const userFileFd = (await fs.open(uri)).fd; if ((await fs.stat(userFileFd)).size > MAX_ICON_PACK_SIZE) { throw new Error('import-fail-file-too-large'); } await fs.mkdir(tempFolderPath); await fs.copyFile(userFileFd, tempArchiveName); await zlib.decompressFile(tempArchiveName, tempFolderPath); const arrayBuffer = new ArrayBuffer(1*1024*1024); const tempPackFile = await fs.open(tempFolderPath + '/pack.json'); const readLen = await fs.read(tempPackFile.fd, arrayBuffer); await fs.close(tempPackFile); const iconPack: IconPackSchema =JSON.parse( buffer.from(arrayBuffer, 0, readLen).toString() ); const fileDirPath = getContext(this).filesDir; const targetFolderPath: string = fileDirPath + '/' + iconPack.uuid; if (await fs.access(targetFolderPath)) { throw new Error('import-fail-already-exists'); } await fs.rename(tempFolderPath, targetFolderPath); const isDefault = (this.icons.length==0); const pack: IconPackStore = { uuid: iconPack.uuid, name: iconPack.name, version: iconPack.version, icons: iconPack.icons.length, uri: targetFolderPath, isDefault, }; await this.iconManager.appendPack(pack); promptAction.showToast({message: $r('app.string.setting_icon_pack_success'), duration: 500}); if (isDefault) { getContext(this).eventHub.emit(EVENT_ICON_PACK_APPLY_REQUEST, {uuid: iconPack.uuid, force: true}); } } catch (e) { const errorMsg = (e as Error).message; console.error(errorMsg); let message = $r('app.string.setting_icon_pack_fail_common'); if (errorMsg==='import-fail-file-too-large') { message = $r('app.string.setting_icon_pack_fail_file_too_large'); } else if (errorMsg==='import-fail-already-exists') { message = $r('app.string.setting_icon_pack_fail_already_exists'); } promptAction.showToast({message, duration: 500}); } finally { fs.unlink(tempArchiveName); fs.rmdir(tempFolderPath); } }
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/entryability/EntryAbility.ets#L428-L485
e97ddafe675c7149f5acee52069ca6529bfef04b
github
sea5241/PictureSelector
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
selector/src/main/ets/utils/SelectorParamUtils.ets
arkts
获取路由参数
export function getSelectorRouterParams(params: object): ArrayList<MediaData> | null { if (params) { let mediaDataParams: MediaDataParams = params['mediaDataParams'] if (mediaDataParams) { let list = new ArrayList<MediaData>() let count = mediaDataParams.mediaDataListCount let mediaDataList = mediaDataParams.mediaDataList for (let i = 0; i < count; i++) { list.add(mediaDataList[i] as MediaData) } return list } } return null }
AST#export_declaration#Left export AST#function_declaration#Left function getSelectorRouterParams AST#parameter_list#Left ( AST#parameter#Left params : 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#union_type#Left AST#primary_type#Left AST#generic_type#Left ArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MediaData 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left params AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mediaDataParams : AST#type_annotation#Left AST#primary_type#Left MediaDataParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left 'mediaDataParams' 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 mediaDataParams AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left list = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MediaData 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#variable_declaration#Left let AST#variable_declarator#Left count = AST#expression#Left AST#member_expression#Left AST#expression#Left mediaDataParams AST#expression#Right . mediaDataListCount 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 mediaDataList = AST#expression#Left AST#member_expression#Left AST#expression#Left mediaDataParams AST#expression#Right . mediaDataList AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 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 list AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left mediaDataList AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MediaData 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#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 list AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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#function_declaration#Right AST#export_declaration#Right
export function getSelectorRouterParams(params: object): ArrayList<MediaData> | null { if (params) { let mediaDataParams: MediaDataParams = params['mediaDataParams'] if (mediaDataParams) { let list = new ArrayList<MediaData>() let count = mediaDataParams.mediaDataListCount let mediaDataList = mediaDataParams.mediaDataList for (let i = 0; i < count; i++) { list.add(mediaDataList[i] as MediaData) } return list } } return null }
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/utils/SelectorParamUtils.ets#L6-L20
695d541f8e38897c58247925ccbde1d678af5ee2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets
arkts
ToolBoxView
功能说明: 本示例介绍使用zIndex、gesture等接口实现悬浮工具箱效果。 推荐场景: 用于悬浮工具箱场景 核心组件: 1. FloatingWindow: 悬浮工具箱组件 实现步骤: 1. 悬浮球UI准备:构建一个悬浮球的UI效果 @example @Builder toolTouch($$: ToolTouchInterface) { Button(){ Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : Color.Gray) .opacity(0.5) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor($$.isDisable ? 0xFFA28F : 0xD3D3D3) .opacity(0.5) } 2. 工具项UI准备:构建一个工具项的UI效果 @example @Builder function tool($$: ToolInterface) { Image(($$.params as ImgParams).imgRes) .height(CommonConstants.TOOL_ITEM_HEIGHT) .width(40) .objectFit(ImageFit.Fill) .visibility(($$.animation as VisibleAnimation).visible) .onClick(() => { promptAction.showToast({ message: '点击逻辑自行实现', duration: 2000 }) }) } 3. 动效属性设置 @State animationAttribute: VisibleAnimation = new VisibleAnimation(); 4. 构建每一个工具项 this.toolList[0] = new CustomTool(wrapBuilder(tool), { x: 60, y: CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE / 2, y: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI) }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_circle_viewfinder')))); 5. 构建悬浮工具箱 @example FloatingWindow({ toolList: this.toolList, floatBall: this.toolTouch, toolItemHeight: CommonConstants.TOOL_ITEM_HEIGHT, maximumDistance: CommonConstants.MAXIMUM_DISTANCE, clickListener: { onAction: (event: GestureEvent) => { animateTo({ duration: 200 }, () => { this.animationAttribute.visible = this.animationAttribute.visible === Visibility.Visible ? Visibility.Hidden : Visibility.Visible; }) } }, longClickListener: { onAction: (event: GestureEvent, isDisable: boolean) => { this.animationAttribute.visible = Visibility.Hidden; }, onActionEnd: (event: GestureEvent, isDisable: boolean) => {}, onActionCancel: (isDisable: boolean) => {} } })
@Entry @Component export struct ToolBoxView { private windowClass: window.Window | undefined = undefined; @State progress: number = 49; toolList: CustomTool[] = []; @State animationAttribute: VisibleAnimation = new VisibleAnimation(); aboutToAppear(): void { let windowStage: window.WindowStage = ( this.getUIContext().getHostContext() as common.UIAbilityContext ).windowStage; windowStage.getMainWindow((err: BusinessError, data) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`); return; } this.windowClass = data; this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); }); this.toolList[0] = new CustomTool(wrapBuilder(tool), { x: 60, y: CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE / 2, y: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI) }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_circle_viewfinder')))); this.toolList[1] = new CustomTool(wrapBuilder(tool), { x: 0, y: CommonConstants.MAXIMUM_DISTANCE }, { x: 0, y: CommonConstants.MAXIMUM_DISTANCE }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_form')))); this.toolList[2] = new CustomTool(wrapBuilder(tool), { x: 60, y: -CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI), y: CommonConstants.MAXIMUM_DISTANCE / 2 }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_keyboard')))); this.toolList[3] = new CustomTool(wrapBuilder(tool), { x: 0, y: -CommonConstants.MAXIMUM_DISTANCE }, { x: CommonConstants.MAXIMUM_DISTANCE, y: 0 }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_lightbulb_max')))); } aboutToDisappear(): void { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } build() { RelativeContainer() { LoadingHUD({ nowProgress: this.progress }) .alignRules({ center: { anchor: "__container__", align: VerticalAlign.Center }, middle: { anchor: "__container__", align: HorizontalAlign.Center } }) /** * 构建悬浮工具箱 * * toolList: 工具箱内容 * floatBall: 悬浮球样式 * toolItemHeight: 工具项高度 * maximumDistance: 工具项至悬浮球中心的最远距离 */ FloatingWindow({ toolList: this.toolList, floatBall: this.toolTouch, toolItemHeight: CommonConstants.TOOL_ITEM_HEIGHT, maximumDistance: CommonConstants.MAXIMUM_DISTANCE, clickListener: { onAction: (event: GestureEvent) => { animateTo({ duration: 200 }, () => { this.animationAttribute.visible = this.animationAttribute.visible === Visibility.Visible ? Visibility.Hidden : Visibility.Visible; }) } }, longClickListener: { onAction: (event: GestureEvent, isDisable: boolean) => { this.animationAttribute.visible = Visibility.Hidden; }, onActionEnd: (event: GestureEvent, isDisable: boolean) => { }, onActionCancel: (isDisable: boolean) => { } } }) .height("250px") .width("250px") } .height('100%') .width('100%') .onClick(() => { if (this.windowClass !== undefined) { console.log(`${this.windowClass.getPreferredOrientation()}`) if (this.windowClass.getPreferredOrientation() === window.Orientation.USER_ROTATION_PORTRAIT) { this.setOrientation(window.Orientation.USER_ROTATION_LANDSCAPE); } else if (this.windowClass.getPreferredOrientation() === window.Orientation.USER_ROTATION_LANDSCAPE) { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } } }) } // 横竖屏切换 setOrientation(orientation: number) { console.log(`setOrientation`) if (this.windowClass !== undefined) { console.log(`setOrientation enter`) this.windowClass.setPreferredOrientation(orientation).then(() => { console.info('setWindowOrientation: ' + orientation + ' Succeeded.'); }).catch((err: BusinessError) => { console.info('setWindowOrientation: ' + orientation + ' Failed. Cause: ' + JSON.stringify(err)); }); } } /** * 悬浮球样式 * @param {ToolTouchInterface} $$ - 悬浮球入参 */ @Builder toolTouch($$: ToolTouchInterface) { Button() { Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : Color.Gray) .opacity(0.5) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor($$.isDisable ? 0xFFA28F : 0xD3D3D3) .opacity(0.5) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ToolBoxView AST#component_body#Left { AST#property_declaration#Left private windowClass : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 49 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left toolList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomTool [ ] 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 @ State AST#decorator#Right animationAttribute : AST#type_annotation#Left AST#primary_type#Left VisibleAnimation 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 VisibleAnimation 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#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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#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#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . getMainWindow 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#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errCode : 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 err AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left errCode AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to obtain the main window. Cause 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 , 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 ` 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#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 . windowClass AST#member_expression#Right = AST#expression#Left data 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 . setOrientation 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 window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_PORTRAIT 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomTool AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left tool AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 60 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_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 x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 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#call_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 CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . cos 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 30 AST#expression#Right / AST#expression#Left 180 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . PI 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#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AttributeSet 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 . animationAttribute AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImgParams 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.AI_circle_viewfinder' AST#expression#Right ) AST#resource_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#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomTool AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left tool AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_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 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AttributeSet 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 . animationAttribute AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImgParams 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.AI_form' AST#expression#Right ) AST#resource_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#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomTool AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left tool AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 60 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 AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left CommonConstants AST#expression#Right AST#unary_expression#Right AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_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 x AST#property_name#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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . cos 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 30 AST#expression#Right / AST#expression#Left 180 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . PI 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 y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AttributeSet 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 . animationAttribute AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImgParams 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.AI_keyboard' AST#expression#Right ) AST#resource_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#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 3 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomTool AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left tool AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { 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 AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left CommonConstants AST#expression#Right AST#unary_expression#Right AST#expression#Right . MAXIMUM_DISTANCE AST#member_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 x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_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 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AttributeSet 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 . animationAttribute AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImgParams 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.AI_lightbulb_max' AST#expression#Right ) AST#resource_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#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 aboutToDisappear 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 . setOrientation 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 window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_PORTRAIT 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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingHUD ( AST#component_parameters#Left { AST#component_parameter#Left nowProgress : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progress AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left center AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center 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 middle AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center 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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /** * 构建悬浮工具箱 * * toolList: 工具箱内容 * floatBall: 悬浮球样式 * toolItemHeight: 工具项高度 * maximumDistance: 工具项至悬浮球中心的最远距离 */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FloatingWindow ( AST#component_parameters#Left { AST#component_parameter#Left toolList : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left floatBall : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolTouch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toolItemHeight : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOOL_ITEM_HEIGHT AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left maximumDistance : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MAXIMUM_DISTANCE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left clickListener : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left 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 { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationAttribute AST#member_expression#Right AST#expression#Right . visible AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . animationAttribute AST#member_expression#Right AST#expression#Right . visible AST#member_expression#Right AST#expression#Right === AST#expression#Left Visibility AST#expression#Right AST#binary_expression#Right AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Visible 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#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left longClickListener : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left 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#Left isDisable : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationAttribute AST#member_expression#Right AST#expression#Right . visible AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Hidden 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onActionEnd AST#property_name#Right : AST#expression#Left AST#arrow_function#Left 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#Left isDisable : 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#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#property_assignment#Left AST#property_name#Left onActionCancel AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isDisable : 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#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#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left "250px" AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "250px" AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass 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 console AST#expression#Right . log 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right . getPreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right . getPreferredOrientation 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 window AST#expression#Right AST#binary_expression#Right AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_PORTRAIT 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 . setOrientation 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 window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_LANDSCAPE 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 else 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#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 . getPreferredOrientation 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 window AST#expression#Right AST#binary_expression#Right AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_LANDSCAPE 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 . setOrientation 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 window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . USER_ROTATION_PORTRAIT 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#if_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#arrow_function#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#build_body#Right AST#build_method#Right // 横竖屏切换 AST#method_declaration#Left setOrientation AST#parameter_list#Left ( AST#parameter#Left orientation : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#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#template_literal#Left ` setOrientation ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` setOrientation enter ` AST#template_literal#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#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 . windowClass AST#member_expression#Right AST#expression#Right . setPreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orientation 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'setWindowOrientation: ' AST#expression#Right + AST#expression#Left orientation AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' Succeeded.' 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#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 console AST#expression#Right . info 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'setWindowOrientation: ' AST#expression#Right + AST#expression#Left orientation AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' Failed. Cause: ' AST#expression#Right AST#binary_expression#Right 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 悬浮球样式 * @param {ToolTouchInterface} $$ - 悬浮球入参 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right toolTouch AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left ToolTouchInterface 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 Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EIGHTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EIGHTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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#expression#Right . isDisable AST#member_expression#Right AST#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#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Gray 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#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 . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left $$ AST#expression#Right . isDisable AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0xFFA28F AST#expression#Right : AST#expression#Left 0xD3D3D3 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 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#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Entry @Component export struct ToolBoxView { private windowClass: window.Window | undefined = undefined; @State progress: number = 49; toolList: CustomTool[] = []; @State animationAttribute: VisibleAnimation = new VisibleAnimation(); aboutToAppear(): void { let windowStage: window.WindowStage = ( this.getUIContext().getHostContext() as common.UIAbilityContext ).windowStage; windowStage.getMainWindow((err: BusinessError, data) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`); return; } this.windowClass = data; this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); }); this.toolList[0] = new CustomTool(wrapBuilder(tool), { x: 60, y: CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE / 2, y: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI) }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_circle_viewfinder')))); this.toolList[1] = new CustomTool(wrapBuilder(tool), { x: 0, y: CommonConstants.MAXIMUM_DISTANCE }, { x: 0, y: CommonConstants.MAXIMUM_DISTANCE }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_form')))); this.toolList[2] = new CustomTool(wrapBuilder(tool), { x: 60, y: -CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI), y: CommonConstants.MAXIMUM_DISTANCE / 2 }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_keyboard')))); this.toolList[3] = new CustomTool(wrapBuilder(tool), { x: 0, y: -CommonConstants.MAXIMUM_DISTANCE }, { x: CommonConstants.MAXIMUM_DISTANCE, y: 0 }, new AttributeSet(this.animationAttribute, new ImgParams($r('app.media.AI_lightbulb_max')))); } aboutToDisappear(): void { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } build() { RelativeContainer() { LoadingHUD({ nowProgress: this.progress }) .alignRules({ center: { anchor: "__container__", align: VerticalAlign.Center }, middle: { anchor: "__container__", align: HorizontalAlign.Center } }) FloatingWindow({ toolList: this.toolList, floatBall: this.toolTouch, toolItemHeight: CommonConstants.TOOL_ITEM_HEIGHT, maximumDistance: CommonConstants.MAXIMUM_DISTANCE, clickListener: { onAction: (event: GestureEvent) => { animateTo({ duration: 200 }, () => { this.animationAttribute.visible = this.animationAttribute.visible === Visibility.Visible ? Visibility.Hidden : Visibility.Visible; }) } }, longClickListener: { onAction: (event: GestureEvent, isDisable: boolean) => { this.animationAttribute.visible = Visibility.Hidden; }, onActionEnd: (event: GestureEvent, isDisable: boolean) => { }, onActionCancel: (isDisable: boolean) => { } } }) .height("250px") .width("250px") } .height('100%') .width('100%') .onClick(() => { if (this.windowClass !== undefined) { console.log(`${this.windowClass.getPreferredOrientation()}`) if (this.windowClass.getPreferredOrientation() === window.Orientation.USER_ROTATION_PORTRAIT) { this.setOrientation(window.Orientation.USER_ROTATION_LANDSCAPE); } else if (this.windowClass.getPreferredOrientation() === window.Orientation.USER_ROTATION_LANDSCAPE) { this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT); } } }) } setOrientation(orientation: number) { console.log(`setOrientation`) if (this.windowClass !== undefined) { console.log(`setOrientation enter`) this.windowClass.setPreferredOrientation(orientation).then(() => { console.info('setWindowOrientation: ' + orientation + ' Succeeded.'); }).catch((err: BusinessError) => { console.info('setWindowOrientation: ' + orientation + ' Failed. Cause: ' + JSON.stringify(err)); }); } } @Builder toolTouch($$: ToolTouchInterface) { Button() { Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : Color.Gray) .opacity(0.5) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor($$.isDisable ? 0xFFA28F : 0xD3D3D3) .opacity(0.5) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets#L103-L236
b493e701a5fe1f31e540fdf938b284b0176294dd
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/SearchSchedule.ets
arkts
ItemSwipeLeft
ListItem 右滑显示的组件。将对应日程移动至(或移出)“我的一天”。 @param schedule 组件对应的日程记录
@Builder private ItemSwipeLeft(schedule: Schedule): void { Row() { Image($r('app.media.my_day')) .size({ width: 24, height: 24 }) .fillColor($r('app.color.pure_white')); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.blue')) .size({ width: '100%', height: '100%' }) .onClick(() => { schedule.isMyDay = !schedule.isMyDay; this.allSchedules[this.allSchedules.findIndex( (value: Schedule): boolean => value.id === schedule.id)] = schedule; this.scheduleTable.updateData(schedule, () => { }); this.getSchedules(); }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ItemSwipeLeft AST#parameter_list#Left ( AST#parameter#Left schedule : AST#type_annotation#Left AST#primary_type#Left Schedule 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#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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.my_day' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pure_white' 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#ERROR#Left ; AST#ERROR#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#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.blue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left schedule AST#expression#Right . isMyDay AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left schedule AST#expression#Right AST#unary_expression#Right AST#expression#Right . isMyDay 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allSchedules AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allSchedules 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 AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Schedule 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left schedule AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = schedule AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scheduleTable AST#member_expression#Right AST#expression#Right . updateData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left schedule AST#expression#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#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 . getSchedules AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private ItemSwipeLeft(schedule: Schedule): void { Row() { Image($r('app.media.my_day')) .size({ width: 24, height: 24 }) .fillColor($r('app.color.pure_white')); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.blue')) .size({ width: '100%', height: '100%' }) .onClick(() => { schedule.isMyDay = !schedule.isMyDay; this.allSchedules[this.allSchedules.findIndex( (value: Schedule): boolean => value.id === schedule.id)] = schedule; this.scheduleTable.updateData(schedule, () => { }); this.getSchedules(); }); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L375-L393
fe794d733b8509c42ef2d922ba989451af73426c
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets
arkts
应用约束:使用ES模块导出(约束60)
export default ClientUserGuildSettings;
AST#export_declaration#Left export default AST#expression#Left ClientUserGuildSettings AST#expression#Right ; AST#export_declaration#Right
export default ClientUserGuildSettings;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets#L71-L71
778897ea0877e90acb48e9e8dfed66a43794e2b7
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/WeatherManager.ets
arkts
getCacheRemainingMinutes
获取缓存剩余时间(分钟)
getCacheRemainingMinutes(): number { if (!this.cachedWeatherData) return 0; const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION; const elapsed = Date.now() - this.lastUpdateTime; const remaining = cacheDuration - elapsed; return Math.max(0, Math.ceil(remaining / 60000)); }
AST#method_declaration#Left getCacheRemainingMinutes 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#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 . cachedWeatherData AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 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 cacheDuration = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TEST_MODE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left 10 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . CACHE_DURATION 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 elapsed = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastUpdateTime 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 remaining = AST#expression#Left AST#binary_expression#Left AST#expression#Left cacheDuration AST#expression#Right - AST#expression#Left elapsed 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#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 . max 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#member_expression#Left AST#expression#Left Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left remaining AST#expression#Right / AST#expression#Left 60000 AST#expression#Right AST#binary_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getCacheRemainingMinutes(): number { if (!this.cachedWeatherData) return 0; const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION; const elapsed = Date.now() - this.lastUpdateTime; const remaining = cacheDuration - elapsed; return Math.max(0, Math.ceil(remaining / 60000)); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L227-L233
e29dc54dd764ba2193bf2828af15221f68a6a785
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
getFirstLvMenu
底部一级菜单
@Builder getFirstLvMenu() { Row() { Column() { Image($r('app.media.ic_adjust')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_adjust')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) } .justifyContent(FlexAlign.Center) .height('100%') .width('40%') .margin({ left: '10%' }) .backgroundColor(this.adjustMarkJudg ? Color.Black : $r('app.color.edit_image_adjust_selected')) .onClick(async () => { this.adjustMarkJudg = false; this.currentTask = Tasks.ADJUST; }) Column() { Image($r('app.media.ic_mark')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_mark')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) } .justifyContent(FlexAlign.Center) .onClick(() => { this.adjustMarkJudg = true; this.currentTask = Tasks.MARK; }) .backgroundColor(this.adjustMarkJudg ? $r('app.color.edit_image_adjust_selected') : Color.Black) .height('100%') .width('40%') .margin({ right: '10%' }) } .height('9%') .width('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getFirstLvMenu 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#container_content_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 'app.media.ic_adjust' 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.float.size_30' 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.float.size_30' 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 Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.edit_image_adjust' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_16' 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#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#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left '10%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . adjustMarkJudg AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.edit_image_adjust_selected' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left async 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 . adjustMarkJudg 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 . currentTask AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Tasks AST#expression#Right . ADJUST 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#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 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 'app.media.ic_mark' 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.float.size_30' 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.float.size_30' 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 Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.edit_image_mark' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_16' 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#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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . adjustMarkJudg 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 . currentTask AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Tasks AST#expression#Right . MARK 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#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . adjustMarkJudg AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.edit_image_adjust_selected' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '40%' 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 '10%' 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '9%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder getFirstLvMenu() { Row() { Column() { Image($r('app.media.ic_adjust')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_adjust')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) } .justifyContent(FlexAlign.Center) .height('100%') .width('40%') .margin({ left: '10%' }) .backgroundColor(this.adjustMarkJudg ? Color.Black : $r('app.color.edit_image_adjust_selected')) .onClick(async () => { this.adjustMarkJudg = false; this.currentTask = Tasks.ADJUST; }) Column() { Image($r('app.media.ic_mark')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_mark')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) } .justifyContent(FlexAlign.Center) .onClick(() => { this.adjustMarkJudg = true; this.currentTask = Tasks.MARK; }) .backgroundColor(this.adjustMarkJudg ? $r('app.color.edit_image_adjust_selected') : Color.Black) .height('100%') .width('40%') .margin({ right: '10%' }) } .height('9%') .width('100%') }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L241-L282
a5591c3cf0bc220780cf2721a4616d6b5925c9b5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets
arkts
writeBufferToFile
Save the arraybuffer to a file.
static writeBufferToFile(path: string, arrayBuffer: ArrayBuffer): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, arrayBuffer); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writeFile err:' + err); return -1; } }
AST#method_declaration#Left static writeBufferToFile 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#Left arrayBuffer : 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#type_annotation#Left AST#primary_type#Left number 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 file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path 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 fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fileIo AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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 value = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . writeSync 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 arrayBuffer 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 fileIo 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 value 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'FileUtil' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'writeFile err:' AST#expression#Right + AST#expression#Left err 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#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static writeBufferToFile(path: string, arrayBuffer: ArrayBuffer): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, arrayBuffer); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writeFile err:' + err); return -1; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets#L39-L49
017dd01c9030e1582aa723e8f64ccb1835fbe6dd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
国内热门城市数据
export const HOT_CITY = ['北京', '上海', '广州', '深圳', '杭州', '南京', '苏州', '天津', '武汉', '长沙', '重庆', '成都'];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HOT_CITY = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '北京' AST#expression#Right , AST#expression#Left '上海' AST#expression#Right , AST#expression#Left '广州' AST#expression#Right , AST#expression#Left '深圳' AST#expression#Right , AST#expression#Left '杭州' AST#expression#Right , AST#expression#Left '南京' AST#expression#Right , AST#expression#Left '苏州' AST#expression#Right , AST#expression#Left '天津' AST#expression#Right , AST#expression#Left '武汉' AST#expression#Right , AST#expression#Left '长沙' AST#expression#Right , AST#expression#Left '重庆' AST#expression#Right , AST#expression#Left '成都' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HOT_CITY = ['北京', '上海', '广州', '深圳', '杭州', '南京', '苏州', '天津', '武汉', '长沙', '重庆', '成都'];
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L86-L87
46d216dc0a74ebdd85984f07504c7d5315099a07
gitee
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/pages/auth/Register.ets
arkts
TextStyle
文本样式
@Extend(Text) function TextStyle() { .fontColor(StyleConstants.BASE_STYLE.fontColor) .fontWeight(FontWeight.Bold) .margin({ top: StyleConstants.SPACING}) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function TextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . BASE_STYLE AST#member_expression#Right AST#expression#Right . fontColor 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 . 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#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . SPACING 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#extend_function_body#Right AST#decorated_function_declaration#Right
@Extend(Text) function TextStyle() { .fontColor(StyleConstants.BASE_STYLE.fontColor) .fontWeight(FontWeight.Bold) .margin({ top: StyleConstants.SPACING}) }
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/pages/auth/Register.ets#L291-L295
cf6b9882a024eb1f0b4fe5957ff8c54a4d425b4e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/WithReuseId.ets
arkts
[EndExclude opt_reuseId]
build() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment })// ReusId is used to control component reuse .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') } }, (moment: FriendMoment) => moment.id) } // [StartExclude opt_reuseId] .cachedCount(this.LIST_CACHE_COUNT) .margin({ top: 8 }) .width(Constants.LAYOUT_MAX) .height(Constants.LAYOUT_MAX) // [EndExclude opt_reuseId] } }
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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LIST_SPACE 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#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . momentData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left moment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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 OneMoment ( AST#component_parameters#Left { AST#component_parameter#Left moment : AST#expression#Left moment AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right // ReusId is used to control component reuse AST#modifier_chain_expression#Left . reuseId ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left moment AST#expression#Right . image AST#member_expression#Right 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 'withImage_id' AST#expression#Right : AST#expression#Left 'noImage_id' AST#expression#Right AST#conditional_expression#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#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 moment : AST#type_annotation#Left AST#primary_type#Left FriendMoment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left moment AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right // [StartExclude opt_reuseId] AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LIST_CACHE_COUNT 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_MAX AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_MAX 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 // [EndExclude opt_reuseId] } 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() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment }) .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') } }, (moment: FriendMoment) => moment.id) } .cachedCount(this.LIST_CACHE_COUNT) .margin({ top: 8 }) .width(Constants.LAYOUT_MAX) .height(Constants.LAYOUT_MAX) } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/WithReuseId.ets#L35-L52
ffed54f32701bb557813dc3365f3769d8d9c0990
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets
arkts
format
格式化日期 @param date 日期 @param format 格式字符串,例如:'yyyy-MM-dd HH:mm:ss' @returns 格式化后的字符串
static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.getHours().toString().padStart(MAX_LENGTH, '0'); let minute = date.getMinutes().toString().padStart(MAX_LENGTH, '0'); let second = date.getSeconds().toString().padStart(MAX_LENGTH, '0'); let result = format.replace('yyyy', year); result = result.replace('MM', month); result = result.replace('dd', day); result = result.replace('HH', hour); result = result.replace('mm', minute); result = result.replace('ss', second); return result; }
AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'yyyy_MM_dd_HHmmss' 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#variable_declaration#Left const AST#variable_declarator#Left MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 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 year = 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 date AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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 month = 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 ( 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 . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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 . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , AST#expression#Left '0' 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 day = 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 date 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 . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , AST#expression#Left '0' 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 hour = 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 date AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , AST#expression#Left '0' 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 minute = 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 date AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , AST#expression#Left '0' 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 second = 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 date AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , AST#expression#Left '0' 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left format AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'yyyy' AST#expression#Right , AST#expression#Left year 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'MM' AST#expression#Right , AST#expression#Left month 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'dd' AST#expression#Right , AST#expression#Left day 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'HH' AST#expression#Right , AST#expression#Left hour 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'mm' AST#expression#Right , AST#expression#Left minute 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ss' AST#expression#Right , AST#expression#Left second 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 result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.getHours().toString().padStart(MAX_LENGTH, '0'); let minute = date.getMinutes().toString().padStart(MAX_LENGTH, '0'); let second = date.getSeconds().toString().padStart(MAX_LENGTH, '0'); let result = format.replace('yyyy', year); result = result.replace('MM', month); result = result.replace('dd', day); result = result.replace('HH', hour); result = result.replace('mm', minute); result = result.replace('ss', second); return result; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L54-L69
f36d672135270b6d56598fbedc97d49fa9fdb7f1
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
loadDescription
Load description of AccessibilityService
async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Array<bundleManager.HapModuleInfo> = bundleInfo.hapModulesInfo; if (moduleInfo.length > 0) { for (let hapInfo of moduleInfo) { let bundleContext: Context = context.createBundleContext(bundleInfo.name); for (let ability of hapInfo.extensionAbilitiesInfo) { if (ability.name === serviceName && ability.descriptionId > 0) { LogUtil.info(`${MODULE_TAG} descriptionId: ${JSON.stringify(ability.descriptionId)}`); await bundleContext.resourceManager.getStringValue(ability.descriptionId) .then((res) => { description = res; LogUtil.info(`${MODULE_TAG} description: ${JSON.stringify(description)}`); }) .catch((err: object) => { LogUtil.info(`${MODULE_TAG} get description error: ${JSON.stringify(err)}`); }); if (!description) { LogUtil.warn(`${MODULE_TAG} load description invalid`); description = $r('app.string.no_description_provided'); } LogUtil.info(`${MODULE_TAG} load description end`); return description; } } } } return description; }
AST#method_declaration#Left async loadDescription AST#parameter_list#Left ( AST#parameter#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serviceName : 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 ResourceStr 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 description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.no_description_provided' AST#expression#Right ) AST#resource_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 context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . globalKeySettingsAbilityContext AST#member_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 Context 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 let AST#variable_declarator#Left moduleInfo : 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 bundleManager . HapModuleInfo 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#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . hapModulesInfo AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left moduleInfo AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( let hapInfo of AST#expression#Left moduleInfo AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleContext : AST#type_annotation#Left AST#primary_type#Left Context 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 context AST#expression#Right . createBundleContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let ability of AST#expression#Left AST#member_expression#Left AST#expression#Left hapInfo AST#expression#Right . extensionAbilitiesInfo 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left serviceName AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left ability AST#expression#Right AST#binary_expression#Right AST#expression#Right . descriptionId 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 LogUtil AST#expression#Right . info 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 MODULE_TAG AST#expression#Right } AST#template_substitution#Right descriptionId: 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 AST#member_expression#Left AST#expression#Left ability AST#expression#Right . descriptionId AST#member_expression#Right 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#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 AST#await_expression#Left await AST#expression#Left bundleContext AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . descriptionId 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#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left description = AST#expression#Left res 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 LogUtil AST#expression#Right . info 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 MODULE_TAG AST#expression#Right } AST#template_substitution#Right description: 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 description 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 . 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 object 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 LogUtil AST#expression#Right . info 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 MODULE_TAG AST#expression#Right } AST#template_substitution#Right get description error: 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#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left description 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 LogUtil AST#expression#Right . warn 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 MODULE_TAG AST#expression#Right } AST#template_substitution#Right load description invalid ` 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 description = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.no_description_provided' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info 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 MODULE_TAG AST#expression#Right } AST#template_substitution#Right load description end ` 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 description 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#for_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#return_statement#Left return AST#expression#Left description AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Array<bundleManager.HapModuleInfo> = bundleInfo.hapModulesInfo; if (moduleInfo.length > 0) { for (let hapInfo of moduleInfo) { let bundleContext: Context = context.createBundleContext(bundleInfo.name); for (let ability of hapInfo.extensionAbilitiesInfo) { if (ability.name === serviceName && ability.descriptionId > 0) { LogUtil.info(`${MODULE_TAG} descriptionId: ${JSON.stringify(ability.descriptionId)}`); await bundleContext.resourceManager.getStringValue(ability.descriptionId) .then((res) => { description = res; LogUtil.info(`${MODULE_TAG} description: ${JSON.stringify(description)}`); }) .catch((err: object) => { LogUtil.info(`${MODULE_TAG} get description error: ${JSON.stringify(err)}`); }); if (!description) { LogUtil.warn(`${MODULE_TAG} load description invalid`); description = $r('app.string.no_description_provided'); } LogUtil.info(`${MODULE_TAG} load description end`); return description; } } } } return description; }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L228-L257
a58939cc34f00f02604ebc35b8953f89612359c1
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/function_var/function_var_003_T.ets
arkts
Introduction 变量函数
export function function_var_003_T(taint_src : string){ let f1 = ff; f1(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function function_var_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left f1 = AST#expression#Left ff 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 f1 AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src 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 function_var_003_T(taint_src : string){ let f1 = ff; f1(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_var/function_var_003_T.ets#L6-L9
e02e9e0851733d3090b0ddc0063627408ac16b51
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
generateTransformedValuesScatter
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the SCATTERCHART. @param data @return
public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number, phaseY: number, from: number, to: number): number[] { const count: number = Math.floor(((to - from) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesScatter.length != count) { this.valuePointsForGenerateTransformedValuesScatter = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesScatter; for (let j = 0; j < count; j += 2) { let e: Entry | null = data.getEntryForIndex(j / 2 + from); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
AST#method_declaration#Left public generateTransformedValuesScatter AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IScatterDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : 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 const AST#variable_declarator#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( 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 to AST#expression#Right - AST#expression#Left from AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left phaseX 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#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesScatter AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left count 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 . valuePointsForGenerateTransformedValuesScatter AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left count 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#variable_declaration#Left let AST#variable_declarator#Left valuePoints : 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#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesScatter AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left j += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Entry 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left from AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getX 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#binary_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 valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getY 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 phaseY AST#expression#Right AST#binary_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#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j 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 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 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#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 . getValueToPixelMatrix AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valuePoints 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 valuePoints AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number, phaseY: number, from: number, to: number): number[] { const count: number = Math.floor(((to - from) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesScatter.length != count) { this.valuePointsForGenerateTransformedValuesScatter = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesScatter; for (let j = 0; j < count; j += 2) { let e: Entry | null = data.getEntryForIndex(j / 2 + from); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L107-L133
5d9d9a0cf9304b63162174a021fd7d341081347b
gitee
batiluoxuanwan/MomentFlow.git
e57aa461223abca74f48893afc2ccf7c2d73e9b8
frontend/entry/src/main/ets/api/UserApi.ets
arkts
login
登录
static async login(account: string, pass: string): Promise<User | null> { return request<User>(`${BASE_URL}/login`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ "account": account, "password": pass }) }) }
AST#method_declaration#Left static async login AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pass : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left User 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 User AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left BASE_URL AST#expression#Right } AST#template_substitution#Right /login ` AST#template_literal#Right 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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "account" AST#property_name#Right : AST#expression#Left account AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "password" AST#property_name#Right : AST#expression#Left pass 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#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 login(account: string, pass: string): Promise<User | null> { return request<User>(`${BASE_URL}/login`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ "account": account, "password": pass }) }) }
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/UserApi.ets#L74-L83
f42427ae062c3bb63bba98ee029be7e13ff559b7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
MARK: - COS配置常量(需保密)
export namespace CosConfig { export const region : string = "STap-shanghai";
AST#export_declaration#Left export AST#ERROR#Left namespace CosConfig { export AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left region : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "STap-shanghai" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export namespace CosConfig { export const region : string = "STap-shanghai";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L9-L10
bcee5d3ddaf01934760b407bf03cb63cdf6115e9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
getLabelPosition
returns the position of the y-labels
public getLabelPosition(): YAxisLabelPosition { return this.mPosition; }
AST#method_declaration#Left public getLabelPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left YAxisLabelPosition 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 . mPosition AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getLabelPosition(): YAxisLabelPosition { return this.mPosition; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L227-L229
d20d56ed3ad266f02a5d68ab65f621920e108621
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getUserInfo
获取用户信息 @returns {User} 用户信息
getUserInfo(): User { return this.userState.getUserInfo(); }
AST#method_declaration#Left getUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User 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 . userState AST#member_expression#Right AST#expression#Right . getUserInfo 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#method_declaration#Right
getUserInfo(): User { return this.userState.getUserInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L76-L78
d04b3033490b231e58708a490ba11d801d7ee055
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FileUtil.ets
arkts
hasDirPath
判断是否是完整路径 @param path 文件路径
static hasDirPath(path: string): boolean { return StrUtil.startsWith(path, "/data/storage/") || StrUtil.startsWith(path, "/storage/"); }
AST#method_declaration#Left static hasDirPath 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left "/data/storage/" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left StrUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left "/storage/" 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 hasDirPath(path: string): boolean { return StrUtil.startsWith(path, "/data/storage/") || StrUtil.startsWith(path, "/storage/"); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L112-L114
8da039f6e2e5b9f488b1048cfb32c67f8f7fa460
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppFunctions.ets
arkts
检查磁盘空间是否足够(带Toast提示)
export function checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean { return FileUtility.checkDiskSpace(needMegas); }
AST#export_declaration#Left export AST#function_declaration#Left function checkDiskSpace AST#parameter_list#Left ( AST#parameter#Left needMegas : 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 AST#member_expression#Left AST#expression#Left AppSettings AST#expression#Right . App AST#member_expression#Right AST#expression#Right . minDisk AST#member_expression#Right 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 FileUtility AST#expression#Right . checkDiskSpace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left needMegas 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#function_declaration#Right AST#export_declaration#Right
export function checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean { return FileUtility.checkDiskSpace(needMegas); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L15-L17
e865934d52341c57a8370226f6b4c2878cdb405e
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets
arkts
getCapitalStringSync
同步返回大写字符串string值
static getCapitalStringSync(resource: ResourceStr): string { if (!resource) { return ''; } if (typeof resource === 'string') { return resource.toUpperCase(); } let result = ResourceUtils.getStringSync(resource); return result?.toUpperCase(); }
AST#method_declaration#Left static getCapitalStringSync AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string 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 resource AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#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#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left resource AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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 resource AST#expression#Right . toUpperCase 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#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 ResourceUtils AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource 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 result AST#expression#Right ?. toUpperCase 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#method_declaration#Right
static getCapitalStringSync(resource: ResourceStr): string { if (!resource) { return ''; } if (typeof resource === 'string') { return resource.toUpperCase(); } let result = ResourceUtils.getStringSync(resource); return result?.toUpperCase(); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets#L42-L51
274e7b5e9c03c1c67490472bb7c537dede07ac9e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets
arkts
verifyCode
验证码识别
verifyCode() { if (this.isAccountFrozen) { promptAction.showToast({ message: '账号已冻结,无法登录', duration: 2000, }); return false; } if (this.account !== 'jay') { promptAction.showToast({ message: '账号错误', duration: 2000, }); return false; } if (this.password !== this.correctVerificationCode) { promptAction.showToast({ message: '验证码错误', duration: 2000, }); return false; } return true; }
AST#method_declaration#Left verifyCode 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 . isAccountFrozen 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 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#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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#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 . account AST#member_expression#Right AST#expression#Right !== AST#expression#Left 'jay' 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 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#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . password AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . correctVerificationCode 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 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#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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#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#method_declaration#Right
verifyCode() { if (this.isAccountFrozen) { promptAction.showToast({ message: '账号已冻结,无法登录', duration: 2000, }); return false; } if (this.account !== 'jay') { promptAction.showToast({ message: '账号错误', duration: 2000, }); return false; } if (this.password !== this.correctVerificationCode) { promptAction.showToast({ message: '验证码错误', duration: 2000, }); return false; } return true; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets#L74-L97
487ccae50b17a1f74c393eaad395dbf4e68dc2b1
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
configure
配置偏好设置处理器,用于初始化用户首选项存储。 @param context 上下文对象,提供对应用程序的访问权限
public async configure(context: Context) { this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID); this.preferences.on('change', (data: Record<string, Object>) => { // 当首选项数据发生变化时,通知所有已注册的监听器 for (let preferencesListener of this.listeners) { preferencesListener.onDataChanged(data.key as string); } }); }
AST#method_declaration#Left public async configure 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_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences 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 data_preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PREFERENCE_ID 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#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 . preferences AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'change' 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#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 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#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 当首选项数据发生变化时,通知所有已注册的监听器 AST#statement#Left AST#for_statement#Left for ( let preferencesListener of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners 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 preferencesListener AST#expression#Right . onDataChanged 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 data AST#expression#Right . key 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 ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public async configure(context: Context) { this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID); this.preferences.on('change', (data: Record<string, Object>) => { for (let preferencesListener of this.listeners) { preferencesListener.onDataChanged(data.key as string); } }); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L23-L31
afd3361b7ff9e18a5838b145ed60d98fd5260841
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
updateThemeMode
更新主题模式
private async updateThemeMode(mode: ThemeMode): Promise<void> { try { await this.settingsService.updateThemeSettings({ mode }); // 重新加载设置 this.settings = await this.settingsService.getSettings(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to update theme: ${error}`); } }
AST#method_declaration#Left private async updateThemeMode AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode 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#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . settingsService AST#member_expression#Right AST#expression#Right . updateThemeSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left mode 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . settingsService AST#member_expression#Right AST#expression#Right . getSettings 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#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 update theme: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async updateThemeMode(mode: ThemeMode): Promise<void> { try { await this.settingsService.updateThemeSettings({ mode }); this.settings = await this.settingsService.getSettings(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to update theme: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L81-L89
8f2e59426fc2dda673cf7c853b0757471cc0d0ea
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Make (create) a directory in a sync way. @param dir_name A string, the path of the file.
export function sandbox_mkdir_sync(dir_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_dir_directory = filesDir + '/' + dir_name; try { fs.mkdirSync(full_dir_directory, true); } catch (e) { console.error('[storage_tools][sandbox_mkdir_sync] [' + dir_name + ']' + e); return false; } return true; }
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_mkdir_sync AST#parameter_list#Left ( AST#parameter#Left dir_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left context_filesDir AST#expression#Right || AST#expression#Left meowContext AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir 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 full_dir_directory = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filesDir AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left dir_name 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#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 full_dir_directory 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#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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[storage_tools][sandbox_mkdir_sync] [' AST#expression#Right + AST#expression#Left dir_name 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 e 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#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#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#function_declaration#Right AST#export_declaration#Right
export function sandbox_mkdir_sync(dir_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_dir_directory = filesDir + '/' + dir_name; try { fs.mkdirSync(full_dir_directory, true); } catch (e) { console.error('[storage_tools][sandbox_mkdir_sync] [' + dir_name + ']' + e); return false; } return true; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L411-L421
86df4889cd7b581eac75890bbc810dfd55977e5f
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDelete.ets
arkts
Emitted whenever a message is deleted. @event Client#messageDelete @param {Object} message The deleted message 应用约束61:使用export default代替module.exports
export default MessageDeleteHandler;
AST#export_declaration#Left export default AST#expression#Left MessageDeleteHandler AST#expression#Right ; AST#export_declaration#Right
export default MessageDeleteHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDelete.ets#L29-L29
1ac9f819123c9d633eed0b486ef3771bed5192f6
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/Tracking.ets
arkts
record
preference的put方法只能放boolean,string,number及其组成的数组,而我们需要传递的是包含多个属性的对象
record(startTime:number,endTime:number,questionId:string){ // 先根据键获得值,未获取到则为空数组[] const json = this.getStore().getSync(this.dataKey,'[]') // 用JSON将字符串数组转为TiameItem类型的对象数组,并存到list中 const list = JSON.parse(json as string) as TimeItem[] //此时可以添加对象进数组 list.push({startTime,endTime,questionId}) // 把list重新使用JSON转为字符串数组,然后使用putSync储存 this.getStore().putSync(this.dataKey,JSON.stringify(list)) this.getStore().flushSync()//持久化处理 }
AST#method_declaration#Left record AST#parameter_list#Left ( AST#parameter#Left startTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left questionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 先根据键获得值,未获取到则为空数组[] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left json = 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 . getStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getSync 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 . dataKey AST#member_expression#Right AST#expression#Right , AST#expression#Left '[]' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 用JSON将字符串数组转为TiameItem类型的对象数组,并存到list中 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left list = 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#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 json 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 AST#array_type#Left TimeItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right //此时可以添加对象进数组 AST#ERROR#Left list AST#ERROR#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left startTime AST#property_assignment#Right , AST#property_assignment#Left endTime AST#property_assignment#Right , AST#property_assignment#Left questionId AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // 把list重新使用JSON转为字符串数组,然后使用putSync储存 AST#ERROR#Left this AST#ERROR#Right . getStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . putSync 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 . dataKey AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left list 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#ERROR#Left this AST#ERROR#Right . getStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right 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#variable_declarator#Right //持久化处理 AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
record(startTime:number,endTime:number,questionId:string){ const json = this.getStore().getSync(this.dataKey,'[]') const list = JSON.parse(json as string) as TimeItem[] list.push({startTime,endTime,questionId}) this.getStore().putSync(this.dataKey,JSON.stringify(list)) this.getStore().flushSync() }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Tracking.ets#L21-L32
dcde1a784c20c7c192f4b914112d5d624f9f86a6
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
destroy
Cleanup resources
async destroy(): Promise<void> { await this.rdbHelper.close(); await this.configService.destroy(); this.notificationService.destroy(); await this.ttsService.destroy(); await this.logService.destroy(); console.info('[MainViewModel] Resources cleaned up'); }
AST#method_declaration#Left async destroy 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#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 . rdbHelper 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#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 . configService AST#member_expression#Right AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notificationService AST#member_expression#Right AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 . ttsService AST#member_expression#Right AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 . logService AST#member_expression#Right AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 '[MainViewModel] Resources cleaned up' 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 destroy(): Promise<void> { await this.rdbHelper.close(); await this.configService.destroy(); this.notificationService.destroy(); await this.ttsService.destroy(); await this.logService.destroy(); console.info('[MainViewModel] Resources cleaned up'); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L714-L721
e9d4a3da08800b5a6dcca07f6624e948a8160ebc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets
arkts
decryptMessage
解密消息
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = decoder.doFinalSync(cipherText); return decryptUpdate; }
AST#function_declaration#Left function decryptMessage 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 cipherText : 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 decoder = 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|CCM' 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 decoder AST#expression#Right . initSync 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 . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ccmParams 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 decryptUpdate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cipherText 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 decryptUpdate AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = decoder.doFinalSync(cipherText); return decryptUpdate; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets#L52-L57
c65035d9a35b28b1b80af1f8b0a3413b5858c3cc
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getConnectTimeout
Getter and setter for connectTimeout
getConnectTimeout(): number | undefined { return this.connectTimeout; }
AST#method_declaration#Left getConnectTimeout 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 this AST#expression#Right . connectTimeout AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getConnectTimeout(): number | undefined { return this.connectTimeout; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L92-L94
cb86d11119e74c5898e5bbb91cda6bc92945bd8e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets
arkts
tabBar类
export class TabDataModel { // tabId用户切换tabContent id: number = 0; // tab类别 navData: string | Resource = ''; constructor(id: number, navData: string | Resource) { this.navData = navData; this.id = id; } }
AST#export_declaration#Left export AST#class_declaration#Left class TabDataModel AST#class_body#Left { // tabId用户切换tabContent AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // tab类别 AST#property_declaration#Left navData : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left navData : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#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 . navData AST#member_expression#Right = AST#expression#Left navData 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 . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TabDataModel { id: number = 0; navData: string | Resource = ''; constructor(id: number, navData: string | Resource) { this.navData = navData; this.id = id; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets#L30-L40
2f33c2daf54e3827da59d5fd16b4ea3a863d329d
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets
arkts
Copyright (c) 2023 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 ListModel { title: string; function: Function | undefined; value: string; constructor(title: string, func: Function | undefined, value: string = '') { this.title = title; this.function = func; this.value = value; } setValue(value: string) { this.value = value; } getValue() { if (this.function == undefined) { return this.value; } this.value = this.function(); return this.value; } }
AST#export_declaration#Left export AST#class_declaration#Left class ListModel AST#class_body#Left { AST#property_declaration#Left title : 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 function : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Function AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( 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 func : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Function AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . function AST#member_expression#Right = AST#expression#Left func 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 . 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#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left setValue AST#parameter_list#Left ( AST#parameter#Left value : 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#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 . value AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left getValue AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . function 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value AST#member_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value 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 . function 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value 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 ListModel { title: string; function: Function | undefined; value: string; constructor(title: string, func: Function | undefined, value: string = '') { this.title = title; this.function = func; this.value = value; } setValue(value: string) { this.value = value; } getValue() { if (this.function == undefined) { return this.value; } this.value = this.function(); return this.value; } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets#L16-L38
7282f104244cdacde4d0acfe352ff9323ba33f7c
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/XiaoXunResponse.ets
arkts
通义千问大语言模型请求响应数据结构类(阿里云)
export class XiaoXunResponse { /** * 系统生成的标志本次调用的id */ request_id?: string; /** * 调用结果信息对象 */ output?: TongYiResp_output; /** * 计量信息对象 */ usage?: TongYiResp_usage; }
AST#export_declaration#Left export AST#class_declaration#Left class XiaoXunResponse AST#class_body#Left { /** * 系统生成的标志本次调用的id */ AST#property_declaration#Left request_id ? : 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 output ? : AST#type_annotation#Left AST#primary_type#Left TongYiResp_output AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 计量信息对象 */ AST#property_declaration#Left usage ? : AST#type_annotation#Left AST#primary_type#Left TongYiResp_usage 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 XiaoXunResponse { request_id?: string; output?: TongYiResp_output; usage?: TongYiResp_usage; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/XiaoXunResponse.ets#L4-L19
2201655b3055d0c7feff48a6006fc869d6b8cc78
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/navigation/MainNav.ets
arkts
MainNav
@file 主页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function MainNav(): void { MainPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MainNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left MainPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function MainNav(): void { MainPage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/navigation/MainNav.ets#L8-L11
1ff758d1b100b20af568049af46cbee4d8241000
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/CharUtils.ets
arkts
isEmoji
判断是否为emoji表情符 @param c 字符 @returns 是否为emoji
static isEmoji(c: number): boolean { // 使用 TypeScript 类型断言来告诉编译器我们已知这个条件不会是null或undefined const isNotEmoji = (c === 0x0) || (c === 0x9) || (c === 0xA) || (c === 0xD) || ((c >= 0x20 && c == 0xD7FF)) || ((c >= 0xE000 && c == 0xFFFD)) || ((c >= 0x100000 && c == 0x10FFFF)); return !isNotEmoji; }
AST#method_declaration#Left static isEmoji AST#parameter_list#Left ( AST#parameter#Left c : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 使用 TypeScript 类型断言来告诉编译器我们已知这个条件不会是null或undefined AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isNotEmoji = 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 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 c AST#expression#Right === AST#expression#Left 0x0 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 c AST#expression#Right === AST#expression#Left 0x9 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#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right === AST#expression#Left 0xA 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#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right === AST#expression#Left 0xD 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#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right >= AST#expression#Left 0x20 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right == AST#expression#Left 0xD7FF 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right >= AST#expression#Left 0xE000 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right == AST#expression#Left 0xFFFD 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right >= AST#expression#Left 0x100000 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right == AST#expression#Left 0x10FFFF 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#parenthesized_expression#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#return_statement#Left return AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isNotEmoji AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isEmoji(c: number): boolean { const isNotEmoji = (c === 0x0) || (c === 0x9) || (c === 0xA) || (c === 0xD) || ((c >= 0x20 && c == 0xD7FF)) || ((c >= 0xE000 && c == 0xFFFD)) || ((c >= 0x100000 && c == 0x10FFFF)); return !isNotEmoji; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/CharUtils.ets#L37-L47
e999cf829e00d856f604f0147e7755f249176567
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
getUserById
根据ID获取用户信息 @param userId 用户ID
async getUserById(userId: number): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.getUserById(userId); if (userData) { return UserInfo.fromCloudObject(userData); } return null; } catch (error) { console.error('获取用户失败:', error); return null; } }
AST#method_declaration#Left async getUserById AST#parameter_list#Left ( AST#parameter#Left userId : 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#union_type#Left AST#primary_type#Left UserInfo 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left userData = 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 . cloudDBService AST#member_expression#Right AST#expression#Right . getUserById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userId 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 userData 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 UserInfo AST#expression#Right . fromCloudObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userData 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#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '获取用户失败:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_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
async getUserById(userId: number): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.getUserById(userId); if (userData) { return UserInfo.fromCloudObject(userData); } return null; } catch (error) { console.error('获取用户失败:', error); return null; } }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L175-L186
d5723b0a0978eac17f68a5954a33046ff8569858
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets
arkts
createSubWindow
[StartExclude rotate_sample]
private createSubWindow(): void { window.createWindow({ name: 'subWindow', windowType: window.WindowType.TYPE_DIALOG, ctx: this.getUIContext().getHostContext(), }).then((subWindow: window.Window) => { this.subWindow = subWindow; if (!this.mainWindow) { return; } let mainWindowRect: window.Rect | null = null; try { mainWindowRect = this.mainWindow.getWindowProperties().windowRect; } catch (error) { hilog.warn(0x000, 'testTag', `getWindowProperties failed, code: ${error.code}, message: ${error.message}`); } let mainWindowWidth: number = mainWindowRect!.width; let mainWindowHeight: number = mainWindowRect!.height; this.subWindow.resize(mainWindowWidth - SUB_WINDOW_LEFT_OFFSET, mainWindowHeight - SUB_WINDOW_TOP_OFFSET) .catch((err: BusinessError) => { hilog.error(0x000, 'testTag', `resize failed, code=${err.code}, message=${err.message}`); }) this.subWindow.moveWindowTo(SUB_WINDOW_LEFT_OFFSET / 2, SUB_WINDOW_TOP_OFFSET / 2) .catch((err: BusinessError) => { hilog.error(0x000, 'testTag', `moveWindowTo failed, code=${err.code}, message=${err.message}`); }) this.subWindow.setUIContent('pages/Subwindow').then(() => { try { this.subWindow?.setWindowBackgroundColor('#ff0000'); } catch (error) { hilog.warn(0x000, 'testTag', `setWindowBackgroundColor failed, code: ${error.code}, message: ${error.message}`); } this.subWindow?.showWindow().then(() => { hilog.info(DOMAIN, TAG, 'Show subwindow success'); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to show subwindow, error: ${error}`); }); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to setUIContent, error: ${error}`); }); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to create subwindow, error: ${error}`); }); }
AST#method_declaration#Left private createSubWindow 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#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 window AST#expression#Right . createWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'subWindow' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left windowType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . WindowType AST#member_expression#Right AST#expression#Right . TYPE_DIALOG AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ctx 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#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 . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 subWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right = AST#expression#Left subWindow AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mainWindow 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 let AST#variable_declarator#Left mainWindowRect : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Rect AST#qualified_type#Right 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#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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left mainWindowRect = 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 . mainWindow 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 . windowRect 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#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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getWindowProperties failed, code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mainWindowWidth : 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 AST#non_null_assertion_expression#Left AST#expression#Left mainWindowRect AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . 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 mainWindowHeight : 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 AST#non_null_assertion_expression#Left AST#expression#Left mainWindowRect AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 . subWindow AST#member_expression#Right AST#expression#Right . resize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left mainWindowWidth AST#expression#Right - AST#expression#Left SUB_WINDOW_LEFT_OFFSET AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left mainWindowHeight AST#expression#Right - AST#expression#Left SUB_WINDOW_TOP_OFFSET AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` resize failed, 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 , 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 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#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#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . moveWindowTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left SUB_WINDOW_LEFT_OFFSET AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left SUB_WINDOW_TOP_OFFSET AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` moveWindowTo failed, 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 , 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 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#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#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . setUIContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/Subwindow' 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#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 . subWindow AST#member_expression#Right AST#expression#Right ?. setWindowBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#ff0000' 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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` setWindowBackgroundColor failed, code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_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#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ?. showWindow 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Show subwindow 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 error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to show subwindow, error: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . 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 error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to setUIContent, error: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . 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 error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to create subwindow, error: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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
private createSubWindow(): void { window.createWindow({ name: 'subWindow', windowType: window.WindowType.TYPE_DIALOG, ctx: this.getUIContext().getHostContext(), }).then((subWindow: window.Window) => { this.subWindow = subWindow; if (!this.mainWindow) { return; } let mainWindowRect: window.Rect | null = null; try { mainWindowRect = this.mainWindow.getWindowProperties().windowRect; } catch (error) { hilog.warn(0x000, 'testTag', `getWindowProperties failed, code: ${error.code}, message: ${error.message}`); } let mainWindowWidth: number = mainWindowRect!.width; let mainWindowHeight: number = mainWindowRect!.height; this.subWindow.resize(mainWindowWidth - SUB_WINDOW_LEFT_OFFSET, mainWindowHeight - SUB_WINDOW_TOP_OFFSET) .catch((err: BusinessError) => { hilog.error(0x000, 'testTag', `resize failed, code=${err.code}, message=${err.message}`); }) this.subWindow.moveWindowTo(SUB_WINDOW_LEFT_OFFSET / 2, SUB_WINDOW_TOP_OFFSET / 2) .catch((err: BusinessError) => { hilog.error(0x000, 'testTag', `moveWindowTo failed, code=${err.code}, message=${err.message}`); }) this.subWindow.setUIContent('pages/Subwindow').then(() => { try { this.subWindow?.setWindowBackgroundColor('#ff0000'); } catch (error) { hilog.warn(0x000, 'testTag', `setWindowBackgroundColor failed, code: ${error.code}, message: ${error.message}`); } this.subWindow?.showWindow().then(() => { hilog.info(DOMAIN, TAG, 'Show subwindow success'); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to show subwindow, error: ${error}`); }); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to setUIContent, error: ${error}`); }); }).catch((error: BusinessError) => { hilog.error(DOMAIN, TAG, `Failed to create subwindow, error: ${error}`); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets#L77-L123
bdfb259a882667ec8530114d5fc025789aa54d7c
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
addService
添加服务。用户基于AbstractService定义自己的设备服务,并添加到设备 @param serviceId 服务id,要和设备模型定义一致 @param deviceService 服务实例
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
AST#method_declaration#Left public addService AST#parameter_list#Left ( AST#parameter#Left serviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left deviceService : AST#type_annotation#Left AST#primary_type#Left AbstractService 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 deviceService AST#expression#Right . iotDevice AST#member_expression#Right = AST#expression#Left this 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 deviceService AST#expression#Right . serviceId AST#member_expression#Right = AST#expression#Left serviceId 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#call_expression#Left AST#expression#Left AST#member_expression#Left 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 . services AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left serviceId 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 . services AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left serviceId AST#expression#Right , AST#expression#Left deviceService AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L82-L89
9a334f7d992551579c07ee9c08ab63d9cfaba895
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/AccountUtil.ets
arkts
账号服务类 登录请求
export function loginWithHuaweiID(UIContext: UIContext, callback: Function = () => { }) { // 创建授权请求,并设置参数 const huaweiIdProvider = new authentication.HuaweiIDProvider(); const loginRequest = huaweiIdProvider.createAuthorizationWithHuaweiIDRequest(); // 默认值为 true,若账号未登录则强制拉起账号登录页 loginRequest.forceAuthorization = true; loginRequest.idTokenSignAlgorithm = authentication.IdTokenSignAlgorithm.PS256; loginRequest.state = util.generateRandomUUID(); // 建议使用generateRandomUUID生成state // 执行登录请求,并处理结果 try { const controller = new authentication.AuthenticationController(UIContext.getHostContext()); controller.executeRequest(loginRequest, (error: BusinessError<Object>, data) => { if (error) { dealAllError(error); return; } const loginWithHuaweiIDResponse = data as authentication.LoginWithHuaweiIDResponse; const state = loginWithHuaweiIDResponse.state; if (state !== undefined && loginRequest.state !== state) { Logger.error('[AccountKit.loginWithHuaweiID]', `Failed to login. The state is different, response state: ${state}`); return; } Logger.info('[AccountKit.loginWithHuaweiID]', `Succeeded in login.`); const loginWithHuaweiIDCredential = loginWithHuaweiIDResponse.data!; const code = loginWithHuaweiIDCredential.authorizationCode; const idToken = loginWithHuaweiIDCredential.idToken; const openID = loginWithHuaweiIDCredential.openID; const unionID = loginWithHuaweiIDCredential.unionID; // 开发者处理 code, idToken callback(code, idToken, openID, unionID); }); } catch (error) { dealAllError(error); } }
AST#export_declaration#Left export AST#function_declaration#Left function loginWithHuaweiID AST#parameter_list#Left ( AST#parameter#Left UIContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#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#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 创建授权请求,并设置参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left huaweiIdProvider = 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 authentication AST#expression#Right AST#new_expression#Right AST#expression#Right . HuaweiIDProvider 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 loginRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huaweiIdProvider AST#expression#Right . createAuthorizationWithHuaweiIDRequest 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 // 默认值为 true,若账号未登录则强制拉起账号登录页 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left loginRequest AST#expression#Right . forceAuthorization 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 loginRequest AST#expression#Right . idTokenSignAlgorithm AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left authentication AST#expression#Right . IdTokenSignAlgorithm AST#member_expression#Right AST#expression#Right . PS256 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 loginRequest AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . generateRandomUUID 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 // 建议使用generateRandomUUID生成state // 执行登录请求,并处理结果 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left controller = 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 authentication AST#expression#Right AST#new_expression#Right AST#expression#Right . AuthenticationController 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 UIContext AST#expression#Right . getHostContext 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 controller AST#expression#Right . executeRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left loginRequest AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : 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#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left error AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left dealAllError 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#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 const AST#variable_declarator#Left loginWithHuaweiIDResponse = AST#expression#Left AST#as_expression#Left AST#expression#Left data AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left authentication . LoginWithHuaweiIDResponse 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 state = AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDResponse AST#expression#Right . state AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left state AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left loginRequest AST#expression#Right AST#binary_expression#Right AST#expression#Right . state AST#member_expression#Right AST#expression#Right !== AST#expression#Left state 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 '[AccountKit.loginWithHuaweiID]' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to login. The state is different, response state: AST#template_substitution#Left $ { AST#expression#Left state 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#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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[AccountKit.loginWithHuaweiID]' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Succeeded in login. ` 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 const AST#variable_declarator#Left loginWithHuaweiIDCredential = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDResponse AST#expression#Right . data AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left code = AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDCredential AST#expression#Right . authorizationCode 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 idToken = AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDCredential AST#expression#Right . idToken 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 openID = AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDCredential AST#expression#Right . openID 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 unionID = AST#expression#Left AST#member_expression#Left AST#expression#Left loginWithHuaweiIDCredential AST#expression#Right . unionID AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 开发者处理 code, idToken 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 code AST#expression#Right , AST#expression#Left idToken AST#expression#Right , AST#expression#Left openID AST#expression#Right , AST#expression#Left unionID 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#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 dealAllError 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#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#function_declaration#Right AST#export_declaration#Right
export function loginWithHuaweiID(UIContext: UIContext, callback: Function = () => { }) { const huaweiIdProvider = new authentication.HuaweiIDProvider(); const loginRequest = huaweiIdProvider.createAuthorizationWithHuaweiIDRequest(); loginRequest.forceAuthorization = true; loginRequest.idTokenSignAlgorithm = authentication.IdTokenSignAlgorithm.PS256; loginRequest.state = util.generateRandomUUID(); try { const controller = new authentication.AuthenticationController(UIContext.getHostContext()); controller.executeRequest(loginRequest, (error: BusinessError<Object>, data) => { if (error) { dealAllError(error); return; } const loginWithHuaweiIDResponse = data as authentication.LoginWithHuaweiIDResponse; const state = loginWithHuaweiIDResponse.state; if (state !== undefined && loginRequest.state !== state) { Logger.error('[AccountKit.loginWithHuaweiID]', `Failed to login. The state is different, response state: ${state}`); return; } Logger.info('[AccountKit.loginWithHuaweiID]', `Succeeded in login.`); const loginWithHuaweiIDCredential = loginWithHuaweiIDResponse.data!; const code = loginWithHuaweiIDCredential.authorizationCode; const idToken = loginWithHuaweiIDCredential.idToken; const openID = loginWithHuaweiIDCredential.openID; const unionID = loginWithHuaweiIDCredential.unionID; callback(code, idToken, openID, unionID); }); } catch (error) { dealAllError(error); } }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/AccountUtil.ets#L8-L45
495bd6c1881c43d8382cf78c6b9d8fcd648ca0af
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/navigation/GoodsGraph.ets
arkts
@file 商品模块导航图 @author Joker.X
export class GoodsGraph implements RouteGraph { /** * 注册商品模块导航路由 */ register(): void { RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav)); RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav)); RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav)); RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav)); } }
AST#export_declaration#Left export AST#class_declaration#Left class GoodsGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /** * 注册商品模块导航路由 */ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Detail AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left GoodsDetailNav 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Search AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left GoodsSearchNav 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Comment AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left GoodsCommentNav 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Category AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left GoodsCategoryNav AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class GoodsGraph implements RouteGraph { register(): void { RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav)); RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav)); RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav)); RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav)); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsGraph.ets#L12-L22
a1ebe70205bed84165ed9f174041745563831c5b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets
arkts
用户评论列表mock数据
export const REVIEW_DATA: Array<ReviewItem> = [ new ReviewItem('用户1', '主播介绍得好详细,产品看起来很棒,已下单!'), new ReviewItem('用户2', '这个直播间的优惠力度真的大,爱了爱了。') ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left REVIEW_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 ReviewItem 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#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ReviewItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '用户1' AST#expression#Right , AST#expression#Left '主播介绍得好详细,产品看起来很棒,已下单!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ReviewItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '用户2' AST#expression#Right , AST#expression#Left '这个直播间的优惠力度真的大,爱了爱了。' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const REVIEW_DATA: Array<ReviewItem> = [ new ReviewItem('用户1', '主播介绍得好详细,产品看起来很棒,已下单!'), new ReviewItem('用户2', '这个直播间的优惠力度真的大,爱了爱了。') ];
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets#L20-L23
e8ceb9f769d46015755ec9e7e1b1aa3ed50b48e7
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/homeability/HomeAbility.ets
arkts
onNewWant
Life Cycles Receives a want. @param want The want. @param launchParam The launchParam to determine if this is a continuation or something else.
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('launchParam launchReason: ' + launchParam.launchReason); this.process_want(want, 'onNewWant'); }
AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . LaunchParam 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#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'launchParam launchReason: ' AST#expression#Right + AST#expression#Left launchParam AST#expression#Right AST#binary_expression#Right AST#expression#Right . launchReason AST#member_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 . process_want AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right , AST#expression#Left 'onNewWant' 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
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('launchParam launchReason: ' + launchParam.launchReason); this.process_want(want, 'onNewWant'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/homeability/HomeAbility.ets#L61-L64
a937535bacd8a28db23995bb21eb714409ec2b53
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Message event after page is back or destroyed if postMessage() is called in H5 page. @typedef OnMessageEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnMessageEvent { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ data: object[]; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnMessageEvent AST#object_type#Left { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#type_member#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left object [ ] AST#array_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 declare interface OnMessageEvent { data: object[]; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L169-L179
0e3c0548c89e212eb6e721e60ad6d61f2551c139
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptCBCSync
解密(CBC模式),同步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。 @returns
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): cryptoFramework.DataBlob { return AES.decryptSync(data, symKey, ivParams, transformation); }
AST#method_declaration#Left static decryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'AES256|CBC|PKCS7' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : 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#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 AES AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ivParams AST#expression#Right , AST#expression#Left transformation 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 decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): cryptoFramework.DataBlob { return AES.decryptSync(data, symKey, ivParams, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L150-L153
02a71e19359e296edf11d5fa2e5806dd8122a638
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowTabsVertical.ets
arkts
try_scroll_to
Tab controls Tries to scroll to a tab of specific index. @param idx The index of the target tab.
try_scroll_to(idx: number) { let tab_height_default: number = 42; clearTimeout(this.scroll_2_bottom_timeout_handle_id); // Cancel existing timeout; this.scroll_2_bottom_timeout_handle_id = setTimeout(() => { let tar = (idx + 1) * tab_height_default + (idx) * 5; // Determine scroll distance const max_y = (this.bunch_of_tabs.Tabs.length) * tab_height_default + (this.bunch_of_tabs.Tabs.length - 1) * 5; let scroll_y = tar - 0.5 * this.scroll_area_height - (tab_height_default + 5) * 0.5; // Limit range if (scroll_y > max_y - this.scroll_area_height) { scroll_y = max_y - this.scroll_area_height; } if (scroll_y < 0) { scroll_y = 0; } // Scroll console.log(`[try_scroll_to] idx=${idx}, tar=${tar}, scroll_y=${scroll_y}`); this.scroll_controller.scrollTo({ xOffset: 0, yOffset: scroll_y, animation: true, }); }, 50); }
AST#method_declaration#Left try_scroll_to AST#parameter_list#Left ( AST#parameter#Left idx : 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 let AST#variable_declarator#Left tab_height_default : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 42 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 clearTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroll_2_bottom_timeout_handle_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 // Cancel existing timeout; 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 . scroll_2_bottom_timeout_handle_id AST#member_expression#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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tar = 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 idx 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#expression#Left tab_height_default AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left idx AST#expression#Right ) AST#parenthesized_expression#Right 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Determine scroll distance AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left max_y = 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bunch_of_tabs AST#member_expression#Right AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left tab_height_default AST#expression#Right AST#binary_expression#Right AST#expression#Right + 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . bunch_of_tabs AST#member_expression#Right AST#expression#Right . Tabs 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#parenthesized_expression#Right 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scroll_y = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tar AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left 0.5 AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . scroll_area_height AST#member_expression#Right AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left tab_height_default AST#expression#Right + AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Limit range 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 scroll_y AST#expression#Right > AST#expression#Left AST#binary_expression#Left AST#expression#Left max_y AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . scroll_area_height 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 scroll_y = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left max_y AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scroll_area_height 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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left scroll_y 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 scroll_y = 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 // Scroll 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#template_literal#Left ` [try_scroll_to] idx= AST#template_substitution#Left $ { AST#expression#Left idx AST#expression#Right } AST#template_substitution#Right , tar= AST#template_substitution#Left $ { AST#expression#Left tar AST#expression#Right } AST#template_substitution#Right , scroll_y= AST#template_substitution#Left $ { AST#expression#Left scroll_y AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroll_controller 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 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left yOffset AST#property_name#Right : AST#expression#Left scroll_y AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left animation 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 50 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
try_scroll_to(idx: number) { let tab_height_default: number = 42; clearTimeout(this.scroll_2_bottom_timeout_handle_id); this.scroll_2_bottom_timeout_handle_id = setTimeout(() => { let tar = (idx + 1) * tab_height_default + (idx) * 5; const max_y = (this.bunch_of_tabs.Tabs.length) * tab_height_default + (this.bunch_of_tabs.Tabs.length - 1) * 5; let scroll_y = tar - 0.5 * this.scroll_area_height - (tab_height_default + 5) * 0.5; if (scroll_y > max_y - this.scroll_area_height) { scroll_y = max_y - this.scroll_area_height; } if (scroll_y < 0) { scroll_y = 0; } console.log(`[try_scroll_to] idx=${idx}, tar=${tar}, scroll_y=${scroll_y}`); this.scroll_controller.scrollTo({ xOffset: 0, yOffset: scroll_y, animation: true, }); }, 50); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsVertical.ets#L240-L265
cd8fdc2b9172023193c10371e5d0edc5faf169bb
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
toggleMode
切换模式(递增/递减)
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; // 切换模式时重置时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.startTimer(); }
AST#method_declaration#Left private toggleMode 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 this AST#expression#Right . stopTimer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIncrementing 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 . isIncrementing 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 . 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSeconds AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIncrementing AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . totalSeconds AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTimer 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
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.startTimer(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L151-L158
9f3ceae2099239987b73eb7dd360a4865ae3503f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
showCalendarPicker
日历选择器弹窗 @param options selected 设置选中项的日期。 options 描述日期选中态底板样式。 默认值:底板样式为圆形。 hintRadius 为0,底板样式为直角矩形。hintRadius为0 ~ 16,底板样式为圆角矩形。hintRadius>=16,底板样式为圆形 onChange:(value: Date) => void 选择弹窗中日期使当前选中项改变时触发该回调。value:选中的日期值。 onAccept:(value: Date) => void 点击弹窗中的“确定”按钮时触发该回调。value:选中的日期值。 onCancel:() => void 点击弹窗中的“取消”按钮时触发该回调。
static showCalendarPicker(options: CalendarDialogOptions) { options.backgroundColor = options.backgroundColor ?? DialogUtil.defaultConfig.backgroundColor; options.backgroundBlurStyle = options.backgroundBlurStyle ?? DialogUtil.defaultConfig.backgroundBlurStyle; options.shadow = options.shadow ?? DialogUtil.defaultConfig.shadow; options.enableHoverMode = options.enableHoverMode ?? DialogUtil.defaultConfig.enableHoverMode; options.hoverModeArea = options.hoverModeArea ?? DialogUtil.defaultConfig.hoverModeArea; CalendarPickerDialog.show(options); }
AST#method_declaration#Left static showCalendarPicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CalendarDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . backgroundColor AST#member_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 options AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . backgroundColor 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 options AST#expression#Right . backgroundBlurStyle AST#member_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 options AST#expression#Right . backgroundBlurStyle AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . backgroundBlurStyle 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 options AST#expression#Right . shadow AST#member_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 options AST#expression#Right . shadow AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . shadow 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 options AST#expression#Right . enableHoverMode AST#member_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 options AST#expression#Right . enableHoverMode AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . enableHoverMode 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 options AST#expression#Right . hoverModeArea AST#member_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 options AST#expression#Right . hoverModeArea AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . hoverModeArea 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CalendarPickerDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static showCalendarPicker(options: CalendarDialogOptions) { options.backgroundColor = options.backgroundColor ?? DialogUtil.defaultConfig.backgroundColor; options.backgroundBlurStyle = options.backgroundBlurStyle ?? DialogUtil.defaultConfig.backgroundBlurStyle; options.shadow = options.shadow ?? DialogUtil.defaultConfig.shadow; options.enableHoverMode = options.enableHoverMode ?? DialogUtil.defaultConfig.enableHoverMode; options.hoverModeArea = options.hoverModeArea ?? DialogUtil.defaultConfig.hoverModeArea; CalendarPickerDialog.show(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L133-L140
c8b58df709a3f66eb0a780f27701059bd184650d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppDelay/entry/src/main/ets/view/LoadingView.ets
arkts
Skeletal diagram layout
build() { Row() { List({ space: Constants.RESOURCE_LIST_SPACE }) { ForEach(SkeletonData, (item: SkeType) => { ListItem() { ArticleSkeletonView({ isMine: item.isMine, isFeed: item.isFeed }) } }) } .padding({ left: '12vp', right: '12vp' }) .lanes(1) .layoutWeight(1) .scrollBar(BarState.Off) Row() .layoutWeight(0) .backgroundColor($r('app.color.skeleton_color_medium')) } .width('100%') .opacity(this.listOpacity) .onAppear(() => { this.startAnimation(); }) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#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 AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . RESOURCE_LIST_SPACE 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 SkeletonData 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 SkeType 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 ArticleSkeletonView ( AST#component_parameters#Left { AST#component_parameter#Left isMine : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isMine AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isFeed : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isFeed 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#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#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 '12vp' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left '12vp' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lanes ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off 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 Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.skeleton_color_medium' 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#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 . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listOpacity 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 this AST#expression#Right . startAnimation 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Row() { List({ space: Constants.RESOURCE_LIST_SPACE }) { ForEach(SkeletonData, (item: SkeType) => { ListItem() { ArticleSkeletonView({ isMine: item.isMine, isFeed: item.isFeed }) } }) } .padding({ left: '12vp', right: '12vp' }) .lanes(1) .layoutWeight(1) .scrollBar(BarState.Off) Row() .layoutWeight(0) .backgroundColor($r('app.color.skeleton_color_medium')) } .width('100%') .opacity(this.listOpacity) .onAppear(() => { this.startAnimation(); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/view/LoadingView.ets#L38-L64
5ec25377d6bea1ae9cebf20061d52d95f2db0f19
gitee
eternaljust/Msea_HarmonyOS.git
bd83668f32138238482ee6e78f1d8e8717047a7c
entry/src/main/ets/view/ComponentExtend.ets
arkts
系统默认字体分类
export enum FontCategory { Headline96Light, Headline72Light, Headline60Light, Headline48Regular, Headline38Regular, Headline30Medium, Headline24Medium, Headline20Medium, Subtitle18Medium, Subtitle16Medium, Subtitle14Medium, Body16Regular, Body14Regular, Body12Regular, Button16Medium, Button14Medium, Caption10Regular, Overline14Regular }
AST#export_declaration#Left export AST#enum_declaration#Left enum FontCategory AST#enum_body#Left { AST#enum_member#Left Headline96Light AST#enum_member#Right , AST#enum_member#Left Headline72Light AST#enum_member#Right , AST#enum_member#Left Headline60Light AST#enum_member#Right , AST#enum_member#Left Headline48Regular AST#enum_member#Right , AST#enum_member#Left Headline38Regular AST#enum_member#Right , AST#enum_member#Left Headline30Medium AST#enum_member#Right , AST#enum_member#Left Headline24Medium AST#enum_member#Right , AST#enum_member#Left Headline20Medium AST#enum_member#Right , AST#enum_member#Left Subtitle18Medium AST#enum_member#Right , AST#enum_member#Left Subtitle16Medium AST#enum_member#Right , AST#enum_member#Left Subtitle14Medium AST#enum_member#Right , AST#enum_member#Left Body16Regular AST#enum_member#Right , AST#enum_member#Left Body14Regular AST#enum_member#Right , AST#enum_member#Left Body12Regular AST#enum_member#Right , AST#enum_member#Left Button16Medium AST#enum_member#Right , AST#enum_member#Left Button14Medium AST#enum_member#Right , AST#enum_member#Left Caption10Regular AST#enum_member#Right , AST#enum_member#Left Overline14Regular AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum FontCategory { Headline96Light, Headline72Light, Headline60Light, Headline48Regular, Headline38Regular, Headline30Medium, Headline24Medium, Headline20Medium, Subtitle18Medium, Subtitle16Medium, Subtitle14Medium, Body16Regular, Body14Regular, Body12Regular, Button16Medium, Button14Medium, Caption10Regular, Overline14Regular }
https://github.com/eternaljust/Msea_HarmonyOS.git/blob/bd83668f32138238482ee6e78f1d8e8717047a7c/entry/src/main/ets/view/ComponentExtend.ets#L2-L21
27a6fb8176f2f57399196141185dfa6b0720f8e1
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets
arkts
writeStrToFile
Save the text content to a file.
static writeStrToFile(path: string, text: string): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, text); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writeFile err:' + err); return -1; } }
AST#method_declaration#Left static writeStrToFile 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#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try 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 fileIo AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path 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 fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fileIo AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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 value = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . writeSync 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 text 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 fileIo 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 value 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'FileUtil' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'writeFile err:' AST#expression#Right + AST#expression#Left err 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#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static writeStrToFile(path: string, text: string): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, text); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writeFile err:' + err); return -1; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets#L52-L62
83919c4da5f5b45ac25ade4c7ba44bd03dd980f6
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets
arkts
bind2Port
绑定本地端口
async bind2Port() { //本地地址 let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await tcpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; this.canConnect = true }) .catch((e) => { this.msgHistory = 'bind fail ' + e.message + "\r\n"; }) //收到消息时的处理 tcpSocket.on("message", async (value) => { let msg = buf2String(value.message) let time = await getCurrentTimeString() this.msgHistory += "服务端:" + msg + time + "\r\n" this.scroller.scrollEdge(Edge.Bottom) }) }
AST#method_declaration#Left async bind2Port AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left "0.0.0.0" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . localPort AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 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 tcpSocket AST#expression#Right AST#await_expression#Right AST#expression#Right . bind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left localAddress 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bind success' AST#expression#Right + AST#expression#Left "\r\n" 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 . canConnect 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#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 e 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bind fail ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#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 tcpSocket AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "message" AST#expression#Right , AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left msg = AST#expression#Left AST#call_expression#Left AST#expression#Left buf2String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . message 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 time = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getCurrentTimeString AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . msgHistory 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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "服务端:" AST#expression#Right + AST#expression#Left msg AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left time AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom 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#variable_declarator#Right AST#variable_declaration#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
async bind2Port() { let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await tcpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; this.canConnect = true }) .catch((e) => { this.msgHistory = 'bind fail ' + e.message + "\r\n"; }) tcpSocket.on("message", async (value) => { let msg = buf2String(value.message) let time = await getCurrentTimeString() this.msgHistory += "服务端:" + msg + time + "\r\n" this.scroller.scrollEdge(Edge.Bottom) }) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets#L167-L187
909feff46cca45db4b63a7b639518da78365e2bc
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
resetTimer
重置计时
private resetTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } this.isRunning = false; this.isPaused = false; // 根据当前模式重置时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.getTimeDigits(this.currentSeconds); this.closeDialog(); }
AST#method_declaration#Left private resetTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left 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 . timerId AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#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#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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSeconds AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIncrementing AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . totalSeconds AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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#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#builder_function_body#Right AST#method_declaration#Right
private resetTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } this.isRunning = false; this.isPaused = false; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.getTimeDigits(this.currentSeconds); this.closeDialog(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L136-L147
5c4b988d79ae681c2397ef4f55b5ea3129af88f1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
朗读控件
export class TextReaderHelper { /** * 朗读控件初始化,用于初始化TTS引擎和底层播放器,初始化失败会返回对应错误码。 * @param windowStage 窗口管理器 * @param context 当前应用上下文 * @param readParams 朗读参数 * @param panelName 默认值为‘小艺朗读’,并且readParams为undefined该值才生效 * @returns */ static async init(windowStage: window.WindowStage, context: common.BaseContext, readerParams?: TextReader.ReaderParam, panelName: string = '小艺朗读'): Promise<void> { WindowManager.setWindowStage(windowStage); if (readerParams === undefined || readerParams === null) { const params: TextReader.ReaderParam = { isVoiceBrandVisible: true, businessBrandInfo: { panelName: panelName } }; readerParams = params; } return TextReader.init(context, readerParams); //初始化朗读控件 } /** * 朗读控件起播,拉起播放器面板并开始播放。播放失败返回对应错误码。 * @param readInfoList 播放文章列表 * @param articleId 文章id,articleId不传时,默认从文章列表中的第一篇开始播放;传参时,从传入articleId对应的文章开始依次往下播放。(文章id不能重复,否则从列表进入同id的文章,会自动选择同id的第一篇朗读) * @returns */ static start(readInfoList: TextReader.ReadInfo[], articleId?: string): Promise<void> { return TextReader.start(readInfoList, articleId); } /** * 朗读控件起播,拉起播放器面板并开始播放。 * @param id 文章id * @param bodyInfo 正文信息(长度10000汉字以内) * @param title 标题 * @param author 文章的作者 * @param date 文章的时间 * @returns */ static startEasy(id: string, bodyInfo: string, title?: string, author?: string, date?: string): Promise<void> { const readInfoList: TextReader.ReadInfo[] = [{ id: id, title: { text: title ?? '', isClickable: true }, author: { text: author ?? '', isClickable: true }, date: { text: date ?? '', isClickable: false }, bodyInfo: bodyInfo }]; return TextReaderHelper.start(readInfoList); } /** * 朗读控件停止朗读,执行播放面板的关闭,注销监听,重置参数。 * @returns */ static async stop(): Promise<void> { return TextReader.stop(); } /** * 释放朗读控件的所有资源。 * @returns */ static async release(): Promise<void> { return TextReader.release(); } /** * 暂停播放。 */ static pause(): boolean { try { TextReader.pause(); return true; } catch (e) { console.error(`TextReader failed to pause. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 继续播放。 */ static resume(): boolean { try { TextReader.resume(); return true; } catch (e) { console.error(`TextReader failed to resume. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 播放上一篇文章。 */ static playPrev(): boolean { try { TextReader.playPrev(); return true; } catch (e) { console.error(`TextReader failed to play previous article. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 播放下一篇文章。 */ static playNext(): boolean { try { TextReader.playNext(); return true; } catch (e) { console.error(`TextReader failed to play next article. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 隐藏播放面板。 */ static hidePanel(): boolean { try { TextReader.hidePanel(); return true; } catch (e) { console.error(`TextReader failed to hide panel. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 打开播放面板。 */ static showPanel(): boolean { try { TextReader.showPanel(); return true; } catch (e) { console.error(`TextReader failed to show panel. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 查询文章播报状态。 * @param id 文章的id * @returns */ static queryReadState(id: string): TextReader.ReadState { try { let readState = TextReader.queryReadState(id); return readState; } catch (e) { console.error(`TextReader failed to queryReadState. Code: ${e.code}, message: ${e.message}`); let readState: TextReader.ReadState = { id: id, state: 5 }; return readState; } } /** * 设置文章内容。 * @param id 文章id * @param content 文章内容,content不传或者为空时,播放指定id的文章时,控件内容页显示加载失败;传参时,将指定id文章的内容设置为content */ static setArticleContent(id: string, content: string): boolean { try { TextReader.setArticleContent(id, content); return true; } catch (e) { console.error(`TextReader failed to setArticleContent. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 设置指定文章的信息,并立即播放。 * @param readInfo 文章信息,包括图片和内容;如果文章的ID不在列表中,则不会生效。 */ static setArticle(readInfo: TextReader.ReadInfo): boolean { try { TextReader.setArticle(readInfo); return true; } catch (e) { console.error(`TextReader failed to setArticle. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 加载更多文章到文章列表。需在项目init和start之后调用,建议在'requestMore'操作监听中使用。 * @param readInfos 要加载的文章列表 * @param isEnd 是否还有更多内容需要加载 * @returns */ static loadMore(readInfos: TextReader.ReadInfo[], isEnd: boolean): boolean { try { TextReader.loadMore(readInfos, isEnd); return true; } catch (e) { console.error(`TextReader failed to loadMore. Code: ${e.code}, message: ${e.message}`); return false; } } /** * 设置监听事件 * @param listener */ static setListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.on('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.on('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.on('release', listener.onRelease); } if (listener?.onShowPanel) { TextReaderHelper.on('showPanel', listener.onShowPanel); } if (listener?.onHidePanel) { TextReaderHelper.on('hidePanel', listener.onHidePanel); } if (listener?.onSetArticle) { TextReaderHelper.on('setArticle', listener.onSetArticle); } if (listener?.onClickArticle) { TextReaderHelper.on('clickArticle', listener.onClickArticle); } if (listener?.onClickAuthor) { TextReaderHelper.on('clickAuthor', listener.onClickAuthor); } if (listener?.onClickNotification) { TextReaderHelper.on('clickNotification', listener.onClickNotification); } if (listener?.onRequestMore) { TextReaderHelper.on('requestMore', listener.onRequestMore); } if (listener?.onEventPanel) { TextReaderHelper.on('eventPanel', listener.onEventPanel); } if (listener?.onEventNotification) { TextReaderHelper.on('eventNotification', listener.onEventNotification); } if (listener?.onEventReadList) { TextReaderHelper.on('eventReadList', listener.onEventReadList); } } /** * 注销监听事件 * @param listener */ static offListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.off('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.off('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.off('release', listener.onRelease); } if (listener?.onShowPanel) { TextReaderHelper.off('showPanel', listener.onShowPanel); } if (listener?.onHidePanel) { TextReaderHelper.off('hidePanel', listener.onHidePanel); } if (listener?.onSetArticle) { TextReaderHelper.off('setArticle', listener.onSetArticle); } if (listener?.onClickArticle) { TextReaderHelper.off('clickArticle', listener.onClickArticle); } if (listener?.onClickAuthor) { TextReaderHelper.off('clickAuthor', listener.onClickAuthor); } if (listener?.onClickNotification) { TextReaderHelper.off('clickNotification', listener.onClickNotification); } if (listener?.onRequestMore) { TextReaderHelper.off('requestMore', listener.onRequestMore); } if (listener?.onEventPanel) { TextReaderHelper.off('eventPanel', listener.onEventPanel); } if (listener?.onEventNotification) { TextReaderHelper.off('eventNotification', listener.onEventNotification); } if (listener?.onEventReadList) { TextReaderHelper.off('eventReadList', listener.onEventReadList); } } /** * 添加监听事件 */ static on(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList', callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback<TextReader.PanelEvent> | Callback<TextReader.NotificationEvent> | Callback<Array<TextReader.ListEventState>>) { try { if (type === 'stateChange') { TextReader.on(type, callback as Callback<TextReader.ReadState>); } else if (type === 'stop') { TextReader.on(type, callback as Callback<void>); } else if (type === 'release') { TextReader.on(type, callback as Callback<void>); } else if (type === 'showPanel') { TextReader.on(type, callback as Callback<void>); } else if (type === 'hidePanel') { TextReader.on(type, callback as Callback<void>); } else if (type === 'setArticle') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickArticle') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickAuthor') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickNotification') { TextReader.on(type, callback as Callback<string>); } else if (type === 'requestMore') { TextReader.on(type, callback as Callback<void>); } else if (type === 'eventPanel') { TextReader.on(type, callback as Callback<TextReader.PanelEvent>); } else if (type === 'eventNotification') { TextReader.on(type, callback as Callback<TextReader.NotificationEvent>); } else if (type === 'eventReadList') { TextReader.on(type, callback as Callback<Array<TextReader.ListEventState>>); } } catch (e) { console.error(`TextReader failed to set eventListener. Code: ${e.code}, message: ${e.message}`); } } /** * 注销监听事件 */ static off(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList', callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback<TextReader.PanelEvent> | Callback<TextReader.NotificationEvent> | Callback<Array<TextReader.ListEventState>>) { try { if (type === 'stateChange') { TextReader.off(type, callback as Callback<TextReader.ReadState>); } else if (type === 'stop') { TextReader.off(type, callback as Callback<void>); } else if (type === 'release') { TextReader.off(type, callback as Callback<void>); } else if (type === 'showPanel') { TextReader.off(type, callback as Callback<void>); } else if (type === 'hidePanel') { TextReader.off(type, callback as Callback<void>); } else if (type === 'setArticle') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickArticle') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickAuthor') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickNotification') { TextReader.off(type, callback as Callback<string>); } else if (type === 'requestMore') { TextReader.off(type, callback as Callback<void>); } else if (type === 'eventPanel') { TextReader.off(type, callback as Callback<TextReader.PanelEvent>); } else if (type === 'eventNotification') { TextReader.off(type, callback as Callback<TextReader.NotificationEvent>); } else if (type === 'eventReadList') { TextReader.off(type, callback as Callback<Array<TextReader.ListEventState>>); } } catch (e) { console.error(`TextReader failed to unset eventListener. Code: ${e.code}, message: ${e.message}`); } } }
AST#export_declaration#Left export AST#class_declaration#Left class TextReaderHelper AST#class_body#Left { /** * 朗读控件初始化,用于初始化TTS引擎和底层播放器,初始化失败会返回对应错误码。 * @param windowStage 窗口管理器 * @param context 当前应用上下文 * @param readParams 朗读参数 * @param panelName 默认值为‘小艺朗读’,并且readParams为undefined该值才生效 * @returns */ AST#method_declaration#Left static async init 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#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . BaseContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left readerParams ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReaderParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left panelName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '小艺朗读' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 WindowManager AST#expression#Right . setWindowStage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left windowStage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left readerParams AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left readerParams AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReaderParam 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 isVoiceBrandVisible 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 businessBrandInfo AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left panelName AST#property_name#Right : AST#expression#Left panelName 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left readerParams = AST#expression#Left params 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left readerParams 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 readInfoList 播放文章列表 * @param articleId 文章id,articleId不传时,默认从文章列表中的第一篇开始播放;传参时,从传入articleId对应的文章开始依次往下播放。(文章id不能重复,否则从列表进入同id的文章,会自动选择同id的第一篇朗读) * @returns */ AST#method_declaration#Left static start AST#parameter_list#Left ( AST#parameter#Left readInfoList : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#ERROR#Right , AST#parameter#Left articleId ? : 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 TextReader AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left readInfoList AST#expression#Right , AST#expression#Left articleId 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 id 文章id * @param bodyInfo 正文信息(长度10000汉字以内) * @param title 标题 * @param author 文章的作者 * @param date 文章的时间 * @returns */ AST#method_declaration#Left static startEasy 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 bodyInfo : 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 author ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#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 readInfoList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TextReader AST#ERROR#Left . ReadInfo AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left id AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text 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 isClickable 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left author AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left author 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 isClickable 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left date 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 isClickable AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bodyInfo AST#property_name#Right : AST#expression#Left bodyInfo AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#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 TextReaderHelper AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left readInfoList 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 /** * 朗读控件停止朗读,执行播放面板的关闭,注销监听,重置参数。 * @returns */ AST#method_declaration#Left static async stop 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . stop 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#method_declaration#Right /** * 释放朗读控件的所有资源。 * @returns */ AST#method_declaration#Left static async release 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 暂停播放。 */ AST#method_declaration#Left static pause AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . pause AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to pause. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 继续播放。 */ AST#method_declaration#Left static resume AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . resume AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to resume. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 播放上一篇文章。 */ AST#method_declaration#Left static playPrev AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . playPrev AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to play previous article. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 播放下一篇文章。 */ AST#method_declaration#Left static playNext AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . playNext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to play next article. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 隐藏播放面板。 */ AST#method_declaration#Left static hidePanel AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . hidePanel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to hide panel. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 打开播放面板。 */ AST#method_declaration#Left static showPanel AST#parameter_list#Left ( ) 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . showPanel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to show panel. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 查询文章播报状态。 * @param id 文章的id * @returns */ AST#method_declaration#Left static queryReadState 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#qualified_type#Left TextReader . ReadState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left readState = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . queryReadState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left readState AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to queryReadState. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left readState : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadState 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 id AST#property_name#Right : AST#expression#Left id AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left state AST#property_name#Right : AST#expression#Left 5 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 readState 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 /** * 设置文章内容。 * @param id 文章id * @param content 文章内容,content不传或者为空时,播放指定id的文章时,控件内容页显示加载失败;传参时,将指定id文章的内容设置为content */ AST#method_declaration#Left static setArticleContent 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 content : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . setArticleContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to setArticleContent. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 设置指定文章的信息,并立即播放。 * @param readInfo 文章信息,包括图片和内容;如果文章的ID不在列表中,则不会生效。 */ AST#method_declaration#Left static setArticle AST#parameter_list#Left ( AST#parameter#Left readInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . setArticle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left readInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to setArticle. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 加载更多文章到文章列表。需在项目init和start之后调用,建议在'requestMore'操作监听中使用。 * @param readInfos 要加载的文章列表 * @param isEnd 是否还有更多内容需要加载 * @returns */ AST#method_declaration#Left static loadMore AST#parameter_list#Left ( AST#parameter#Left readInfos : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#ERROR#Right , AST#parameter#Left isEnd : 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader AST#expression#Right . loadMore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left readInfos AST#expression#Right , AST#expression#Left isEnd AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` TextReader failed to loadMore. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 /** * 设置监听事件 * @param listener */ AST#method_declaration#Left static setListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TextReaderListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStateChange AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStateChange AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStop AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stop' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStop AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRelease AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'release' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRelease AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onShowPanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onShowPanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onHidePanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hidePanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onHidePanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onSetArticle AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onSetArticle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickArticle AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickArticle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickAuthor AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickAuthor' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickAuthor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickNotification AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickNotification AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRequestMore AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'requestMore' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRequestMore AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventPanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventPanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventNotification AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventNotification AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventReadList AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventReadList' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventReadList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注销监听事件 * @param listener */ AST#method_declaration#Left static offListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TextReaderListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStateChange AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStateChange AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStop AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stop' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStop AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRelease AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'release' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRelease AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onShowPanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onShowPanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onHidePanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hidePanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onHidePanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onSetArticle AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onSetArticle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickArticle AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickArticle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickAuthor AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickAuthor' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickAuthor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickNotification AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickNotification AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRequestMore AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'requestMore' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRequestMore AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventPanel AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventPanel AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventNotification AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventNotification AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventReadList AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReaderHelper AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventReadList' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventReadList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 添加监听事件 */ AST#method_declaration#Left static on AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList' AST#ERROR#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Callback 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#primary_type#Left AST#generic_type#Left Callback 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 AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadState 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . PanelEvent 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . NotificationEvent 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ListEventState 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#type_arguments#Right AST#generic_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'stateChange' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadState 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'stop' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'release' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'showPanel' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'hidePanel' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'setArticle' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickArticle' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickAuthor' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickNotification' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'requestMore' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventPanel' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . PanelEvent 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventNotification' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . NotificationEvent 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventReadList' 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 TextReader AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ListEventState 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#type_arguments#Right AST#generic_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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` TextReader failed to set eventListener. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 注销监听事件 */ AST#method_declaration#Left static off AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList' AST#ERROR#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Callback 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#primary_type#Left AST#generic_type#Left Callback 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 AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadState 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . PanelEvent 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . NotificationEvent 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#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ListEventState 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#type_arguments#Right AST#generic_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'stateChange' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadState 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'stop' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'release' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'showPanel' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'hidePanel' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'setArticle' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickArticle' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickAuthor' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'clickNotification' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'requestMore' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventPanel' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . PanelEvent 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventNotification' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . NotificationEvent 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#as_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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left 'eventReadList' 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 TextReader AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left callback AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ListEventState 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#type_arguments#Right AST#generic_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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` TextReader failed to unset eventListener. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_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 TextReaderHelper { static async init(windowStage: window.WindowStage, context: common.BaseContext, readerParams?: TextReader.ReaderParam, panelName: string = '小艺朗读'): Promise<void> { WindowManager.setWindowStage(windowStage); if (readerParams === undefined || readerParams === null) { const params: TextReader.ReaderParam = { isVoiceBrandVisible: true, businessBrandInfo: { panelName: panelName } }; readerParams = params; } return TextReader.init(context, readerParams); } static start(readInfoList: TextReader.ReadInfo[], articleId?: string): Promise<void> { return TextReader.start(readInfoList, articleId); } static startEasy(id: string, bodyInfo: string, title?: string, author?: string, date?: string): Promise<void> { const readInfoList: TextReader.ReadInfo[] = [{ id: id, title: { text: title ?? '', isClickable: true }, author: { text: author ?? '', isClickable: true }, date: { text: date ?? '', isClickable: false }, bodyInfo: bodyInfo }]; return TextReaderHelper.start(readInfoList); } static async stop(): Promise<void> { return TextReader.stop(); } static async release(): Promise<void> { return TextReader.release(); } static pause(): boolean { try { TextReader.pause(); return true; } catch (e) { console.error(`TextReader failed to pause. Code: ${e.code}, message: ${e.message}`); return false; } } static resume(): boolean { try { TextReader.resume(); return true; } catch (e) { console.error(`TextReader failed to resume. Code: ${e.code}, message: ${e.message}`); return false; } } static playPrev(): boolean { try { TextReader.playPrev(); return true; } catch (e) { console.error(`TextReader failed to play previous article. Code: ${e.code}, message: ${e.message}`); return false; } } static playNext(): boolean { try { TextReader.playNext(); return true; } catch (e) { console.error(`TextReader failed to play next article. Code: ${e.code}, message: ${e.message}`); return false; } } static hidePanel(): boolean { try { TextReader.hidePanel(); return true; } catch (e) { console.error(`TextReader failed to hide panel. Code: ${e.code}, message: ${e.message}`); return false; } } static showPanel(): boolean { try { TextReader.showPanel(); return true; } catch (e) { console.error(`TextReader failed to show panel. Code: ${e.code}, message: ${e.message}`); return false; } } static queryReadState(id: string): TextReader.ReadState { try { let readState = TextReader.queryReadState(id); return readState; } catch (e) { console.error(`TextReader failed to queryReadState. Code: ${e.code}, message: ${e.message}`); let readState: TextReader.ReadState = { id: id, state: 5 }; return readState; } } static setArticleContent(id: string, content: string): boolean { try { TextReader.setArticleContent(id, content); return true; } catch (e) { console.error(`TextReader failed to setArticleContent. Code: ${e.code}, message: ${e.message}`); return false; } } static setArticle(readInfo: TextReader.ReadInfo): boolean { try { TextReader.setArticle(readInfo); return true; } catch (e) { console.error(`TextReader failed to setArticle. Code: ${e.code}, message: ${e.message}`); return false; } } static loadMore(readInfos: TextReader.ReadInfo[], isEnd: boolean): boolean { try { TextReader.loadMore(readInfos, isEnd); return true; } catch (e) { console.error(`TextReader failed to loadMore. Code: ${e.code}, message: ${e.message}`); return false; } } static setListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.on('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.on('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.on('release', listener.onRelease); } if (listener?.onShowPanel) { TextReaderHelper.on('showPanel', listener.onShowPanel); } if (listener?.onHidePanel) { TextReaderHelper.on('hidePanel', listener.onHidePanel); } if (listener?.onSetArticle) { TextReaderHelper.on('setArticle', listener.onSetArticle); } if (listener?.onClickArticle) { TextReaderHelper.on('clickArticle', listener.onClickArticle); } if (listener?.onClickAuthor) { TextReaderHelper.on('clickAuthor', listener.onClickAuthor); } if (listener?.onClickNotification) { TextReaderHelper.on('clickNotification', listener.onClickNotification); } if (listener?.onRequestMore) { TextReaderHelper.on('requestMore', listener.onRequestMore); } if (listener?.onEventPanel) { TextReaderHelper.on('eventPanel', listener.onEventPanel); } if (listener?.onEventNotification) { TextReaderHelper.on('eventNotification', listener.onEventNotification); } if (listener?.onEventReadList) { TextReaderHelper.on('eventReadList', listener.onEventReadList); } } static offListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.off('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.off('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.off('release', listener.onRelease); } if (listener?.onShowPanel) { TextReaderHelper.off('showPanel', listener.onShowPanel); } if (listener?.onHidePanel) { TextReaderHelper.off('hidePanel', listener.onHidePanel); } if (listener?.onSetArticle) { TextReaderHelper.off('setArticle', listener.onSetArticle); } if (listener?.onClickArticle) { TextReaderHelper.off('clickArticle', listener.onClickArticle); } if (listener?.onClickAuthor) { TextReaderHelper.off('clickAuthor', listener.onClickAuthor); } if (listener?.onClickNotification) { TextReaderHelper.off('clickNotification', listener.onClickNotification); } if (listener?.onRequestMore) { TextReaderHelper.off('requestMore', listener.onRequestMore); } if (listener?.onEventPanel) { TextReaderHelper.off('eventPanel', listener.onEventPanel); } if (listener?.onEventNotification) { TextReaderHelper.off('eventNotification', listener.onEventNotification); } if (listener?.onEventReadList) { TextReaderHelper.off('eventReadList', listener.onEventReadList); } } static on(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList', callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback<TextReader.PanelEvent> | Callback<TextReader.NotificationEvent> | Callback<Array<TextReader.ListEventState>>) { try { if (type === 'stateChange') { TextReader.on(type, callback as Callback<TextReader.ReadState>); } else if (type === 'stop') { TextReader.on(type, callback as Callback<void>); } else if (type === 'release') { TextReader.on(type, callback as Callback<void>); } else if (type === 'showPanel') { TextReader.on(type, callback as Callback<void>); } else if (type === 'hidePanel') { TextReader.on(type, callback as Callback<void>); } else if (type === 'setArticle') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickArticle') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickAuthor') { TextReader.on(type, callback as Callback<string>); } else if (type === 'clickNotification') { TextReader.on(type, callback as Callback<string>); } else if (type === 'requestMore') { TextReader.on(type, callback as Callback<void>); } else if (type === 'eventPanel') { TextReader.on(type, callback as Callback<TextReader.PanelEvent>); } else if (type === 'eventNotification') { TextReader.on(type, callback as Callback<TextReader.NotificationEvent>); } else if (type === 'eventReadList') { TextReader.on(type, callback as Callback<Array<TextReader.ListEventState>>); } } catch (e) { console.error(`TextReader failed to set eventListener. Code: ${e.code}, message: ${e.message}`); } } static off(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList', callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback<TextReader.PanelEvent> | Callback<TextReader.NotificationEvent> | Callback<Array<TextReader.ListEventState>>) { try { if (type === 'stateChange') { TextReader.off(type, callback as Callback<TextReader.ReadState>); } else if (type === 'stop') { TextReader.off(type, callback as Callback<void>); } else if (type === 'release') { TextReader.off(type, callback as Callback<void>); } else if (type === 'showPanel') { TextReader.off(type, callback as Callback<void>); } else if (type === 'hidePanel') { TextReader.off(type, callback as Callback<void>); } else if (type === 'setArticle') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickArticle') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickAuthor') { TextReader.off(type, callback as Callback<string>); } else if (type === 'clickNotification') { TextReader.off(type, callback as Callback<string>); } else if (type === 'requestMore') { TextReader.off(type, callback as Callback<void>); } else if (type === 'eventPanel') { TextReader.off(type, callback as Callback<TextReader.PanelEvent>); } else if (type === 'eventNotification') { TextReader.off(type, callback as Callback<TextReader.NotificationEvent>); } else if (type === 'eventReadList') { TextReader.off(type, callback as Callback<Array<TextReader.ListEventState>>); } } catch (e) { console.error(`TextReader failed to unset eventListener. Code: ${e.code}, message: ${e.message}`); } } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L8-L415
501a6eb032833999d02f71ae0e5eec9e59286478
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/model/dataType.ets
arkts
Copyright (c) 2023 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 OperateTabs { src: Resource name: Resource constructor
AST#export_declaration#Left export AST#ERROR#Left class OperateTabs { src : Resource name : Resource 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 class OperateTabs { src: Resource name: Resource constructor
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/model/dataType.ets#L16-L20
695fb9bd6add91721c172ddac2c644e2afa102e4
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/BubbleSort.ets
arkts
optimizedSort
优化的冒泡排序算法 @param arr 需要排序的数组 @returns 排序后的数组
public static optimizedSort(arr: number[]): number[] { const n = arr.length; const result = [...arr]; for (let i = 0; i < n - 1; i++) { let swapped = false; for (let j = 0; j < n - i - 1; j++) { if (result[j] > result[j + 1]) { // 使用临时变量进行交换 const temp = result[j]; result[j] = result[j + 1]; result[j + 1] = temp; swapped = true; } } // 如果内层循环没有发生交换,说明数组已经有序 if (!swapped) { break; } } return result; }
AST#method_declaration#Left public static optimizedSort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 const AST#variable_declarator#Left n = AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left n 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#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left swapped = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right - AST#expression#Left i 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#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right > AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 使用临时变量进行交换 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left temp = AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left j 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = result AST#ERROR#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = temp AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left swapped = 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#for_statement#Right AST#statement#Right // 如果内层循环没有发生交换,说明数组已经有序 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left swapped AST#expression#Right AST#unary_expression#Right 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#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 optimizedSort(arr: number[]): number[] { const n = arr.length; const result = [...arr]; for (let i = 0; i < n - 1; i++) { let swapped = false; for (let j = 0; j < n - i - 1; j++) { if (result[j] > result[j + 1]) { const temp = result[j]; result[j] = result[j + 1]; result[j + 1] = temp; swapped = true; } } if (!swapped) { break; } } return result; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/BubbleSort.ets#L35-L59
a8c21eac821706093fad3dc2709ebead629a50c2
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FoldSplitContainer.d.ets
arkts
Preset split ratio. @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare enum PresetSplitRatio { /** * 1:1 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LAYOUT_1V1 = 1, /** * 2:3 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LAYOUT_2V3 = 0.6666666666666666, /** * 3:2 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LAYOUT_3V2 = 1.5 }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PresetSplitRatio AST#enum_body#Left { /** * 1:1 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#enum_member#Left LAYOUT_1V1 = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , /** * 2:3 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#enum_member#Left LAYOUT_2V3 = AST#expression#Left 0.6666666666666666 AST#expression#Right AST#enum_member#Right , /** * 3:2 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#enum_member#Left LAYOUT_3V2 = AST#expression#Left 1.5 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export declare enum PresetSplitRatio { LAYOUT_1V1 = 1, LAYOUT_2V3 = 0.6666666666666666, LAYOUT_3V2 = 1.5 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L162-L187
06076880a73f302795bd45aec50b98b6fda1a0ae
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
卡片点击回调函数类型 @param data - 卡片数据对象 @param index - 卡片在数组中的索引
export type OnCardClickedCallback = (data: object, index: number) => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnCardClickedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left object 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 void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type OnCardClickedCallback = (data: object, index: number) => void;
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L57-L57
1d339aad6287518f74a6e583ac17d69d12502d42
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets
arkts
getPowerModeName
MODE_NORMAL 600 表示标准模式,默认值。 MODE_POWER_SAVE 601 表示省电模式。 MODE_PERFORMANCE 602 表示性能模式。 MODE_EXTREME_POWER_SAVE 603 表示超级省电模式。
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case PowerManagerUtil.powerModes[0]: return powerModeNames[0]; case PowerManagerUtil.powerModes[1]: return powerModeNames[1]; case PowerManagerUtil.powerModes[2]: return powerModeNames[2]; case PowerManagerUtil.powerModes[3]: return powerModeNames[3]; default: return '' }
AST#method_declaration#Left static async getPowerModeName 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 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#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left powerModeNames : 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#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getStringArray AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.strarray.power_mode' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left switch AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left power AST#expression#Right . getPowerMode 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#property_name#Left case AST#property_name#Right PowerManagerUtil AST#modifier_chain_expression#Left . powerModes AST#modifier_chain_expression#Right AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left powerModeNames AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PowerManagerUtil AST#expression#Right . powerModes AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 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#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left powerModeNames AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PowerManagerUtil AST#expression#Right . powerModes AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 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#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left powerModeNames AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PowerManagerUtil AST#expression#Right . powerModes AST#member_expression#Right AST#expression#Right [ AST#expression#Left 3 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#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left powerModeNames AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '' AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case PowerManagerUtil.powerModes[0]: return powerModeNames[0]; case PowerManagerUtil.powerModes[1]: return powerModeNames[1]; case PowerManagerUtil.powerModes[2]: return powerModeNames[2]; case PowerManagerUtil.powerModes[3]: return powerModeNames[3]; default: return '' }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets#L49-L62
35c8c53f2160eb12d53c0d8ad36554335dc369f0
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/views/Sounds&NotificationsView.ets
arkts
snList
设置列表 item
@Builder snList(list_title: Resource, hapticList: SNListItemModel[]) { // 列表标题 Text(list_title) .width('100%') .textAlign(TextAlign.Start) .fontColor(Color.Gray) .fontSize(14) .fontWeight(FontWeight.Medium) .padding({ left: 12 }) .margin({ bottom: 8 }) // 列表 List() { ForEach(hapticList, (item: SNListItemModel, index: number) => { // 总震感开关列表项 if (index === 0) { ListItem() { Column() { Row() { Row() { Text(item.label) .fontSize(16) .fontWeight(FontWeight.Medium) Blank() Toggle({ isOn: item.is_on!!, type: ToggleType.Switch }) .selectedColor($r('app.color.list_on_color')) .onChange((isOn: boolean) => { this.appGeneralData.isHapticFeedback = isOn; this.appGeneralData.isHapticButton = isOn; this.appGeneralData.isHapticSwipe = isOn; this.appGeneralData.isHapticListItem = isOn; this.appGeneralData.isHapticMenu = isOn; this.hapticList[0].isDivider = isOn; for (let i = 1; i < this.hapticList.length; i++) { const haptic = this.hapticList[i]; haptic.is_on = isOn; } }) .onClick(() => { // 开启按钮触感反馈 if (this.appGeneralData.isHapticButton) { StartVibrator() } }) } .width('100%') .padding({ left: 12, right: 12 }) .clickEffect({ level: ClickEffectLevel.LIGHT }) } .width('100%') .height(52) .alignItems(VerticalAlign.Center) .stateStyles({ normal: { .backgroundColor('') }, pressed: { .backgroundColor(Color.Gray) .borderRadius(12) }, focused: { .backgroundColor(Color.Gray) .borderRadius(12) } }) if (item.isDivider) { Divider().padding({ left: 12, right: 12 }) } } .width('100%') } .padding({ top: 2, bottom: 2, left: 4, right: 4 }) .onClick(() => { // 开启震动 if (this.appGeneralData.isHapticListItem || !this.appGeneralData.isHapticFeedback) { StartVibrator() } }) } // 具体震感列表项 else { if (hapticList[0].is_on) { ListItem() { Column() { Row() { Row() { Text(item.label) .fontSize(16) .fontWeight(FontWeight.Medium) Blank() Toggle({ isOn: item.is_on!!, type: ToggleType.Switch }) .selectedColor($r('app.color.list_on_color')) .onChange((isOn: boolean) => { if (index === 1) { this.appGeneralData.isHapticButton = isOn; } else if (index === 2) { this.appGeneralData.isHapticSwipe = isOn; } else if (index === 3) { this.appGeneralData.isHapticListItem = isOn; } else { this.appGeneralData.isHapticMenu = isOn; } let isClosed: boolean = true; for (let i = 1; i < this.hapticList.length; i++) { const haptic = this.hapticList[i]; if (haptic.is_on) { isClosed = false; } } if (isClosed) { this.hapticList[0].is_on = false; } }) .onClick(() => { // 开启按钮触感反馈 if (this.appGeneralData.isHapticButton) { StartVibrator() } }) } .width('100%') .padding({ left: 12, right: 12 }) .clickEffect({ level: ClickEffectLevel.LIGHT }) } .width('100%') .height(52) .alignItems(VerticalAlign.Center) .stateStyles({ normal: { .backgroundColor('') }, pressed: { .backgroundColor(Color.Gray) .borderRadius(12) }, focused: { .backgroundColor(Color.Gray) .borderRadius(12) } }) if (item.isDivider) { Divider().padding({ left: 12, right: 12 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right snList AST#parameter_list#Left ( AST#parameter#Left list_title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hapticList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SNListItemModel [ ] AST#array_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 Text ( AST#expression#Left list_title 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 . 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 . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 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#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#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 bottom 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#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 List ( ) AST#ui_component#Right AST#ERROR#Left { ForEach ( 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hapticList AST#expression#Right AST#ERROR#Left , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SNListItemModel 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#ui_arrow_function_body#Left { // 总震感开关列表项 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { 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 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 Row ( ) 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#member_expression#Left AST#expression#Left item AST#expression#Right . label AST#member_expression#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 . 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#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 Blank ( ) 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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left isOn : AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . is_on AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.list_on_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticFeedback AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticButton AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticSwipe AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticListItem AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticMenu AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hapticList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . isDivider AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_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 1 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 . hapticList 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 haptic = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hapticList 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left haptic AST#expression#Right . is_on AST#member_expression#Right = AST#expression#Left isOn 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 开启按钮触感反馈 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticButton AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left StartVibrator AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#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#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 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 . clickEffect ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left level AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ClickEffectLevel AST#expression#Right . LIGHT 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 52 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . stateStyles ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#object_literal#Right AST#expression#Right . backgroundColor 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pressed AST#expression#Right AST#ERROR#Left : { AST#ERROR#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#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 focused AST#expression#Right AST#ERROR#Left : { AST#ERROR#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ) AST#ERROR#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isDivider AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#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 AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right AST#ERROR#Right . padding 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 top AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 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 . onClick 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#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 . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticListItem AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticFeedback AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left StartVibrator AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } // 具体震感列表项 else { if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left hapticList AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . is_on AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left { ListItem AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left { Column AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left { Row AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left { Row AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left { Text AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left Blank AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left Toggle AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left isOn AST#property_name#Right : AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . is_on AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch 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 . selectedColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.list_on_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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#if_statement#Left if ( 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#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 . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticButton AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_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 index AST#expression#Right === AST#expression#Left 2 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 this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticSwipe AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_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 index AST#expression#Right === AST#expression#Left 3 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 this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticListItem AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticMenu AST#member_expression#Right = AST#expression#Left isOn AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isClosed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#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 1 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 . hapticList 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 haptic = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hapticList 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#member_expression#Left AST#expression#Left haptic AST#expression#Right . is_on 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 isClosed = 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#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isClosed AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hapticList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . is_on 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . isHapticButton AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left StartVibrator AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padding 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 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#argument_list#Right AST#call_expression#Right AST#expression#Right . clickEffect 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 level AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ClickEffectLevel AST#expression#Right . LIGHT 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#ERROR#Left } AST#ERROR#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 52 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . stateStyles 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 normal AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#object_literal#Right AST#expression#Right . backgroundColor 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pressed AST#expression#Right AST#ERROR#Left : { AST#ERROR#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#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 focused AST#expression#Right AST#ERROR#Left : { AST#ERROR#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } } AST#ERROR#Right ) 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#member_expression#Left AST#expression#Left item AST#expression#Right . isDivider AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right { AST#property_name#Left Divider AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder snList(list_title: Resource, hapticList: SNListItemModel[]) { Text(list_title) .width('100%') .textAlign(TextAlign.Start) .fontColor(Color.Gray) .fontSize(14) .fontWeight(FontWeight.Medium) .padding({ left: 12 }) .margin({ bottom: 8 }) List() { ForEach(hapticList, (item: SNListItemModel, index: number) => { if (index === 0) { ListItem() { Column() { Row() { Row() { Text(item.label) .fontSize(16) .fontWeight(FontWeight.Medium) Blank() Toggle({ isOn: item.is_on!!, type: ToggleType.Switch }) .selectedColor($r('app.color.list_on_color')) .onChange((isOn: boolean) => { this.appGeneralData.isHapticFeedback = isOn; this.appGeneralData.isHapticButton = isOn; this.appGeneralData.isHapticSwipe = isOn; this.appGeneralData.isHapticListItem = isOn; this.appGeneralData.isHapticMenu = isOn; this.hapticList[0].isDivider = isOn; for (let i = 1; i < this.hapticList.length; i++) { const haptic = this.hapticList[i]; haptic.is_on = isOn; } }) .onClick(() => { if (this.appGeneralData.isHapticButton) { StartVibrator() } }) } .width('100%') .padding({ left: 12, right: 12 }) .clickEffect({ level: ClickEffectLevel.LIGHT }) } .width('100%') .height(52) .alignItems(VerticalAlign.Center) .stateStyles({ normal: { .backgroundColor('') }, pressed: { .backgroundColor(Color.Gray) .borderRadius(12) }, focused: { .backgroundColor(Color.Gray) .borderRadius(12) } }) if (item.isDivider) { Divider().padding({ left: 12, right: 12 }) } } .width('100%') } .padding({ top: 2, bottom: 2, left: 4, right: 4 }) .onClick(() => { if (this.appGeneralData.isHapticListItem || !this.appGeneralData.isHapticFeedback) { StartVibrator() } }) } else { if (hapticList[0].is_on) { ListItem() { Column() { Row() { Row() { Text(item.label) .fontSize(16) .fontWeight(FontWeight.Medium) Blank() Toggle({ isOn: item.is_on!!, type: ToggleType.Switch }) .selectedColor($r('app.color.list_on_color')) .onChange((isOn: boolean) => { if (index === 1) { this.appGeneralData.isHapticButton = isOn; } else if (index === 2) { this.appGeneralData.isHapticSwipe = isOn; } else if (index === 3) { this.appGeneralData.isHapticListItem = isOn; } else { this.appGeneralData.isHapticMenu = isOn; } let isClosed: boolean = true; for (let i = 1; i < this.hapticList.length; i++) { const haptic = this.hapticList[i]; if (haptic.is_on) { isClosed = false; } } if (isClosed) { this.hapticList[0].is_on = false; } }) .onClick(() => { if (this.appGeneralData.isHapticButton) { StartVibrator() } }) } .width('100%') .padding({ left: 12, right: 12 }) .clickEffect({ level: ClickEffectLevel.LIGHT }) } .width('100%') .height(52) .alignItems(VerticalAlign.Center) .stateStyles({ normal: { .backgroundColor('') }, pressed: { .backgroundColor(Color.Gray) .borderRadius(12) }, focused: { .backgroundColor(Color.Gray) .borderRadius(12) } }) if (item.isDivider) { Divider().padding({ left: 12, right: 12 }) }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/Sounds&NotificationsView.ets#L52-L206
e4b43fb9c5ec6518368e22a3b55deb467fba9c60
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
arkts
sleep
睡眠
private sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)) }
AST#method_declaration#Left private sleep AST#parameter_list#Left ( AST#parameter#Left ms : 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left resolve => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolve AST#expression#Right , AST#expression#Left ms 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets#L87-L89
3489be7881737d7d34594cb11fb12bc6bce0513f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets
arkts
getToken
读取 Token(默认返回空字符串) @returns {Promise<string>} Token
async getToken(): Promise<string> { const value: preferences.ValueType = await this.prefs.get(TokenStoreDataSourceImpl.KEY_TOKEN, ""); return typeof value === "string" ? value : ""; } /** * 清除 Token * @returns {Promise<void>} Promise<void> */ async clearToken(): Promise<void> { await this.prefs.remove(TokenStoreDataSourceImpl.KEY_TOKEN); }
AST#method_declaration#Left async getToken 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 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#variable_declaration#Left const AST#variable_declarator#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . ValueType 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#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 . prefs AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TokenStoreDataSourceImpl AST#expression#Right . KEY_TOKEN AST#member_expression#Right AST#expression#Right , AST#expression#Left "" 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#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left "string" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left value : "" ; } AST#ERROR#Right /** * 清除 Token * @returns {Promise<void>} Promise<void> */ AST#ERROR#Left async AST#ERROR#Left clearToken AST#ERROR#Right 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#ERROR#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 . prefs AST#member_expression#Right AST#expression#Right . remove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TokenStoreDataSourceImpl AST#expression#Right . KEY_TOKEN AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getToken(): Promise<string> { const value: preferences.ValueType = await this.prefs.get(TokenStoreDataSourceImpl.KEY_TOKEN, ""); return typeof value === "string" ? value : ""; } async clearToken(): Promise<void> { await this.prefs.remove(TokenStoreDataSourceImpl.KEY_TOKEN); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets#L46-L57
3983dee22ad14a8af8c20426da1f8992a7d458a0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initWxLogin
/配置微信登录
initWxLogin(want: Want){ /////////////////////////////////////////// ///获取appIdentifier,微信登录和微信支付需要用,需要配置在微信开放平台的appIdentifier,不是AppID, /// // (注意:不能使用自动签名:同一应用申请的debug profile或release profile中,appIdentifier一致。 // 注:如果debug启用IDE自动签名,那么appIdentifier为随机分配(此appIdentifier不可作为应用正式的身份标识),不同于应用正式profile中的appIdentifier。 // 参考:https://developer.huawei.com/consumer/cn/forum/topic/0204192989131047958 /// ///这是自动签名获取的:6918705225533654805,不对。 ///需要使用自己申请的debug或release时的profile,(release签名不能调试,所以只能用申请debug类型的profile) ///6917579325076446931 ///6917592474741463583 //WordTree /// ///QQ登录需要获取fingerPrint的md5 // fingerprint = "0e5ad763ce8811a91d7de1c38a4f1f200041d4bbb458102a537f6475662298ff"//单词树 // fingerprintMd5 = "f138c6c6c06a0dc45c1031345e34b5aa" //单词树 // // if (DebugFlg.isDebugMode()) { // BundleUtils.getBundleAppIdentifier() // } //////////////////////////////////////////////////////////// ///配置微信登录回调 // import('../models/managers/sns/wx/WxLoginManager').then((it)=>{ // // 尽早初始化微信SDK // it.WXLoginManager.shared.registerApp(); // // //处理回调 // it.WXLoginManager.shared.handleWeChatCallIfNeed(want)} // ) }
AST#method_declaration#Left initWxLogin AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { /////////////////////////////////////////// ///获取appIdentifier,微信登录和微信支付需要用,需要配置在微信开放平台的appIdentifier,不是AppID, /// // (注意:不能使用自动签名:同一应用申请的debug profile或release profile中,appIdentifier一致。 // 注:如果debug启用IDE自动签名,那么appIdentifier为随机分配(此appIdentifier不可作为应用正式的身份标识),不同于应用正式profile中的appIdentifier。 // 参考:https://developer.huawei.com/consumer/cn/forum/topic/0204192989131047958 /// ///这是自动签名获取的:6918705225533654805,不对。 ///需要使用自己申请的debug或release时的profile,(release签名不能调试,所以只能用申请debug类型的profile) ///6917579325076446931 ///6917592474741463583 //WordTree /// ///QQ登录需要获取fingerPrint的md5 // fingerprint = "0e5ad763ce8811a91d7de1c38a4f1f200041d4bbb458102a537f6475662298ff"//单词树 // fingerprintMd5 = "f138c6c6c06a0dc45c1031345e34b5aa" //单词树 // // if (DebugFlg.isDebugMode()) { // BundleUtils.getBundleAppIdentifier() // } //////////////////////////////////////////////////////////// ///配置微信登录回调 // import('../models/managers/sns/wx/WxLoginManager').then((it)=>{ // // 尽早初始化微信SDK // it.WXLoginManager.shared.registerApp(); // // //处理回调 // it.WXLoginManager.shared.handleWeChatCallIfNeed(want)} // ) } AST#builder_function_body#Right AST#method_declaration#Right
initWxLogin(want: Want){ 这是自动签名获取的:6918705225533654805,不对。 需要使用自己申请的debug或release时的profile,(release签名不能调试,所以只能用申请debug类型的profile) 6917579325076446931 6917592474741463583 WordTree QQ登录需要获取fingerPrint的md5 if (DebugFlg.isDebugMode()) { BundleUtils.getBundleAppIdentifier() } 配置微信登录回调 import('../models/managers/sns/wx/WxLoginManager').then((it)=>{ 尽早初始化微信SDK it.WXLoginManager.shared.registerApp(); 处理回调 it.WXLoginManager.shared.handleWeChatCallIfNeed(want)} ) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/entryability/EntryAbility.ets#L160-L190
fc0f53597d45585ee499265cf1e47737eacbacc5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
设置冲突接口
export interface SettingsConflict { key: string; localValue: string | number | boolean | Record<string, string | number | boolean>; remoteValue: string | number | boolean | Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsConflict AST#object_type#Left { AST#type_member#Left key : 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 localValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean 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#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left remoteValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean 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#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface SettingsConflict { key: string; localValue: string | number | boolean | Record<string, string | number | boolean>; remoteValue: string | number | boolean | Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L175-L179
71d0d6cfc8c7d342c6fb188a1a907f4d9113fe05
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets
arkts
GridObjectSortComponentOptions of GridObjectSortComponent. @interface GridEditOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 GridObjectSortComponentOptions of GridObjectSortComponent. @interface GridEditOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface GridObjectSortComponentOptions { /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ type?: GridObjectSortComponentType; /** * The size of the GridObjectSortComponent image. * @type { ?number | ?Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The size of the GridObjectSortComponent image. * @type { ?number | ?Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ imageSize?: number | Resource; /** * The title displayed in the unedited state of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The title displayed in the unedited state of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ normalTitle?: ResourceStr; /** * The title displayed in the GridObjectSortComponent edit state. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The title displayed in the GridObjectSortComponent edit state. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ editTitle?: ResourceStr; /** * Display Area Title, First subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Display Area Title, First subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ showAreaTitle?: ResourceStr; /** * Add Zone Title, second subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Add Zone Title, second subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ addAreaTitle?: ResourceStr; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GridObjectSortComponentOptions AST#object_type#Left { /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left GridObjectSortComponentType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The size of the GridObjectSortComponent image. * @type { ?number | ?Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The size of the GridObjectSortComponent image. * @type { ?number | ?Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left imageSize ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The title displayed in the unedited state of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The title displayed in the unedited state of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left normalTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The title displayed in the GridObjectSortComponent edit state. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The title displayed in the GridObjectSortComponent edit state. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left editTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Display Area Title, First subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Display Area Title, First subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left showAreaTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Add Zone Title, second subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Add Zone Title, second subtitle of the GridObjectSortComponent. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left addAreaTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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 GridObjectSortComponentOptions { type?: GridObjectSortComponentType; imageSize?: number | Resource; normalTitle?: ResourceStr; editTitle?: ResourceStr; showAreaTitle?: ResourceStr; addAreaTitle?: ResourceStr; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L176-L275
06177787177c674bd4f5423af3e9e8a397c02bc2
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/data/Three.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 Three { public data: number[] = [ 0.0, //#0 1.2500000558793553E-4, //#1 0.0010000000447034842, //#2 0.0033750004023313683, //#3 0.008000000357627874, //#4 0.015625, //#5 0.027000003218650946, //#6 0.04287500876188338, //#7 0.06400001716613923, //#8 0.09112502896786043, //#9 0.1250000447034889, //#10 0.1663750649094666, //#11 0.21600009012223542, //#12 0.2746251208782373, //#13 0.34300015771391423, //#14 0.4218752011657081, //#15 0.5120002517700608, //#16 0.6141253100634143, //#17 0.7290003765822105, //#18 0.8573754518628914, //#19 1.0000003576279113, //#20 1.1576252365708513, //#21 1.3310000865459461, //#22 1.5208749054074306, //#23 1.7279996910095399, //#24 1.9531244412065085, //#25 2.1969991538525715, //#26 2.4603738268019635, //#27 2.743998457908919, //#28 3.048623045027674, //#29 3.374997586012462, //#30 3.723872078717519, //#31 4.095996520997079, //#32 4.492120910705377, //#33 4.9129952456966475, //#34 5.359369523825126, //#35 5.8319937429450475, //#36 6.331617900910646, //#37 6.858991995576157, //#38 7.414866024795816, //#39 7.999989986423856, //#40 8.615115381244424, //#41 9.260989275459615, //#42 9.938363097434028, //#43 10.647986845021897, //#44 11.390610516077459, //#45 12.166984108454947, //#46 12.977857620008598, //#47 13.823981048592644, //#48 14.706104392061324, //#49 15.624977648268867, //#50 16.581350815069513, //#51 17.575973890317496, //#52 18.609596871867048, //#53 19.682969757572405, //#54 20.796842545287802, //#55 21.951965232867476, //#56 23.149087818165658, //#57 24.388960299036587, //#58 25.672332673334495, //#59 26.999954938913618, //#60 28.37257709362819, //#61 29.790949135332447, //#62 31.25582106188062, //#63 32.76794287112695, //#64 34.32806456092567, //#65 35.93693612913101, //#66 37.59530757359721, //#67 39.303928892178504, //#68 41.06355008272912, //#69 42.87492114310331, //#70 44.73879207115529, //#71 46.65591286473931, //#72 48.627033521709585, //#73 50.65290403992037, //#74 52.73427441722589, //#75 54.87189465148038, //#76 57.06651474053808, //#77 59.31888468225323, //#78 61.629754474480045, //#79 63.99987411507277, //#80 66.42999360188564, //#81 68.9208749562066, //#82 71.47325674254265, //#83 74.08788896947685, //#84 76.76552164559234, //#85 79.50690477947222, //#86 82.31278837969957, //#87 85.18392245485751, //#88 88.12105701352914, //#89 91.12494206429756, //#90 94.19632761574586, //#91 97.33596367645715, //#92 100.54460025501454, //#93 103.82298736000112, //#94 107.171875, //#95 110.59201318359428, //#96 114.08415191936705, //#97 117.64904121590142, //#98 121.2874310817805,//#99 ] }
AST#export_declaration#Left export default AST#class_declaration#Left class Three AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0.0 AST#expression#Right , //#0 AST#expression#Left 1.2500000558793553E-4 AST#expression#Right , //#1 AST#expression#Left 0.0010000000447034842 AST#expression#Right , //#2 AST#expression#Left 0.0033750004023313683 AST#expression#Right , //#3 AST#expression#Left 0.008000000357627874 AST#expression#Right , //#4 AST#expression#Left 0.015625 AST#expression#Right , //#5 AST#expression#Left 0.027000003218650946 AST#expression#Right , //#6 AST#expression#Left 0.04287500876188338 AST#expression#Right , //#7 AST#expression#Left 0.06400001716613923 AST#expression#Right , //#8 AST#expression#Left 0.09112502896786043 AST#expression#Right , //#9 AST#expression#Left 0.1250000447034889 AST#expression#Right , //#10 AST#expression#Left 0.1663750649094666 AST#expression#Right , //#11 AST#expression#Left 0.21600009012223542 AST#expression#Right , //#12 AST#expression#Left 0.2746251208782373 AST#expression#Right , //#13 AST#expression#Left 0.34300015771391423 AST#expression#Right , //#14 AST#expression#Left 0.4218752011657081 AST#expression#Right , //#15 AST#expression#Left 0.5120002517700608 AST#expression#Right , //#16 AST#expression#Left 0.6141253100634143 AST#expression#Right , //#17 AST#expression#Left 0.7290003765822105 AST#expression#Right , //#18 AST#expression#Left 0.8573754518628914 AST#expression#Right , //#19 AST#expression#Left 1.0000003576279113 AST#expression#Right , //#20 AST#expression#Left 1.1576252365708513 AST#expression#Right , //#21 AST#expression#Left 1.3310000865459461 AST#expression#Right , //#22 AST#expression#Left 1.5208749054074306 AST#expression#Right , //#23 AST#expression#Left 1.7279996910095399 AST#expression#Right , //#24 AST#expression#Left 1.9531244412065085 AST#expression#Right , //#25 AST#expression#Left 2.1969991538525715 AST#expression#Right , //#26 AST#expression#Left 2.4603738268019635 AST#expression#Right , //#27 AST#expression#Left 2.743998457908919 AST#expression#Right , //#28 AST#expression#Left 3.048623045027674 AST#expression#Right , //#29 AST#expression#Left 3.374997586012462 AST#expression#Right , //#30 AST#expression#Left 3.723872078717519 AST#expression#Right , //#31 AST#expression#Left 4.095996520997079 AST#expression#Right , //#32 AST#expression#Left 4.492120910705377 AST#expression#Right , //#33 AST#expression#Left 4.9129952456966475 AST#expression#Right , //#34 AST#expression#Left 5.359369523825126 AST#expression#Right , //#35 AST#expression#Left 5.8319937429450475 AST#expression#Right , //#36 AST#expression#Left 6.331617900910646 AST#expression#Right , //#37 AST#expression#Left 6.858991995576157 AST#expression#Right , //#38 AST#expression#Left 7.414866024795816 AST#expression#Right , //#39 AST#expression#Left 7.999989986423856 AST#expression#Right , //#40 AST#expression#Left 8.615115381244424 AST#expression#Right , //#41 AST#expression#Left 9.260989275459615 AST#expression#Right , //#42 AST#expression#Left 9.938363097434028 AST#expression#Right , //#43 AST#expression#Left 10.647986845021897 AST#expression#Right , //#44 AST#expression#Left 11.390610516077459 AST#expression#Right , //#45 AST#expression#Left 12.166984108454947 AST#expression#Right , //#46 AST#expression#Left 12.977857620008598 AST#expression#Right , //#47 AST#expression#Left 13.823981048592644 AST#expression#Right , //#48 AST#expression#Left 14.706104392061324 AST#expression#Right , //#49 AST#expression#Left 15.624977648268867 AST#expression#Right , //#50 AST#expression#Left 16.581350815069513 AST#expression#Right , //#51 AST#expression#Left 17.575973890317496 AST#expression#Right , //#52 AST#expression#Left 18.609596871867048 AST#expression#Right , //#53 AST#expression#Left 19.682969757572405 AST#expression#Right , //#54 AST#expression#Left 20.796842545287802 AST#expression#Right , //#55 AST#expression#Left 21.951965232867476 AST#expression#Right , //#56 AST#expression#Left 23.149087818165658 AST#expression#Right , //#57 AST#expression#Left 24.388960299036587 AST#expression#Right , //#58 AST#expression#Left 25.672332673334495 AST#expression#Right , //#59 AST#expression#Left 26.999954938913618 AST#expression#Right , //#60 AST#expression#Left 28.37257709362819 AST#expression#Right , //#61 AST#expression#Left 29.790949135332447 AST#expression#Right , //#62 AST#expression#Left 31.25582106188062 AST#expression#Right , //#63 AST#expression#Left 32.76794287112695 AST#expression#Right , //#64 AST#expression#Left 34.32806456092567 AST#expression#Right , //#65 AST#expression#Left 35.93693612913101 AST#expression#Right , //#66 AST#expression#Left 37.59530757359721 AST#expression#Right , //#67 AST#expression#Left 39.303928892178504 AST#expression#Right , //#68 AST#expression#Left 41.06355008272912 AST#expression#Right , //#69 AST#expression#Left 42.87492114310331 AST#expression#Right , //#70 AST#expression#Left 44.73879207115529 AST#expression#Right , //#71 AST#expression#Left 46.65591286473931 AST#expression#Right , //#72 AST#expression#Left 48.627033521709585 AST#expression#Right , //#73 AST#expression#Left 50.65290403992037 AST#expression#Right , //#74 AST#expression#Left 52.73427441722589 AST#expression#Right , //#75 AST#expression#Left 54.87189465148038 AST#expression#Right , //#76 AST#expression#Left 57.06651474053808 AST#expression#Right , //#77 AST#expression#Left 59.31888468225323 AST#expression#Right , //#78 AST#expression#Left 61.629754474480045 AST#expression#Right , //#79 AST#expression#Left 63.99987411507277 AST#expression#Right , //#80 AST#expression#Left 66.42999360188564 AST#expression#Right , //#81 AST#expression#Left 68.9208749562066 AST#expression#Right , //#82 AST#expression#Left 71.47325674254265 AST#expression#Right , //#83 AST#expression#Left 74.08788896947685 AST#expression#Right , //#84 AST#expression#Left 76.76552164559234 AST#expression#Right , //#85 AST#expression#Left 79.50690477947222 AST#expression#Right , //#86 AST#expression#Left 82.31278837969957 AST#expression#Right , //#87 AST#expression#Left 85.18392245485751 AST#expression#Right , //#88 AST#expression#Left 88.12105701352914 AST#expression#Right , //#89 AST#expression#Left 91.12494206429756 AST#expression#Right , //#90 AST#expression#Left 94.19632761574586 AST#expression#Right , //#91 AST#expression#Left 97.33596367645715 AST#expression#Right , //#92 AST#expression#Left 100.54460025501454 AST#expression#Right , //#93 AST#expression#Left 103.82298736000112 AST#expression#Right , //#94 AST#expression#Left 107.171875 AST#expression#Right , //#95 AST#expression#Left 110.59201318359428 AST#expression#Right , //#96 AST#expression#Left 114.08415191936705 AST#expression#Right , //#97 AST#expression#Left 117.64904121590142 AST#expression#Right , //#98 AST#expression#Left 121.2874310817805 AST#expression#Right , //#99 ] 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 Three { public data: number[] = [ 0.0, 1.2500000558793553E-4, 0.0010000000447034842, 0.0033750004023313683, 0.008000000357627874, 0.015625, 0.027000003218650946, 0.04287500876188338, 0.06400001716613923, 0.09112502896786043, 0.1250000447034889, 0 0.1663750649094666, 1 0.21600009012223542, 2 0.2746251208782373, 3 0.34300015771391423, 4 0.4218752011657081, 5 0.5120002517700608, 6 0.6141253100634143, 7 0.7290003765822105, 8 0.8573754518628914, 9 1.0000003576279113, 0 1.1576252365708513, 1 1.3310000865459461, 2 1.5208749054074306, 3 1.7279996910095399, 4 1.9531244412065085, 5 2.1969991538525715, 6 2.4603738268019635, 7 2.743998457908919, 8 3.048623045027674, 9 3.374997586012462, 0 3.723872078717519, 1 4.095996520997079, 2 4.492120910705377, 3 4.9129952456966475, 4 5.359369523825126, 5 5.8319937429450475, 6 6.331617900910646, 7 6.858991995576157, 8 7.414866024795816, 9 7.999989986423856, 0 8.615115381244424, 1 9.260989275459615, 2 9.938363097434028, 3 10.647986845021897, 4 11.390610516077459, 5 12.166984108454947, 6 12.977857620008598, 7 13.823981048592644, 8 14.706104392061324, 9 15.624977648268867, 0 16.581350815069513, 1 17.575973890317496, 2 18.609596871867048, 3 19.682969757572405, 4 20.796842545287802, 5 21.951965232867476, 6 23.149087818165658, 7 24.388960299036587, 8 25.672332673334495, 9 26.999954938913618, 0 28.37257709362819, 1 29.790949135332447, 2 31.25582106188062, 3 32.76794287112695, 4 34.32806456092567, 5 35.93693612913101, 6 37.59530757359721, 7 39.303928892178504, 8 41.06355008272912, 9 42.87492114310331, 0 44.73879207115529, 1 46.65591286473931, 2 48.627033521709585, 3 50.65290403992037, 4 52.73427441722589, 5 54.87189465148038, 6 57.06651474053808, 7 59.31888468225323, 8 61.629754474480045, 9 63.99987411507277, 0 66.42999360188564, 1 68.9208749562066, 2 71.47325674254265, 3 74.08788896947685, 4 76.76552164559234, 5 79.50690477947222, 6 82.31278837969957, 7 85.18392245485751, 8 88.12105701352914, 9 91.12494206429756, 0 94.19632761574586, 1 97.33596367645715, 2 100.54460025501454, 3 103.82298736000112, 4 107.171875, 5 110.59201318359428, 6 114.08415191936705, 7 117.64904121590142, 8 121.2874310817805,9 ] }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Three.ets#L16-L119
194cc894a650e8833c5421e2dd93f97d118ddf6b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptECBSync
加密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。 @returns
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, null, transformation); }
AST#method_declaration#Left static encryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM4_128|ECB|PKCS7' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : 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#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 SM4 AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left transformation 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 encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L175-L178
10426dbad183b3188140d05ca3baa5ecddb76396
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
containsMonth
是否包含月
static containsMonth(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym; }
AST#method_declaration#Left static containsMonth AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right . YmdHms AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . YmdHm AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . YmdH AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Ymd AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Ym AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static containsMonth(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L76-L79
795379779bcdd3bc4231803a5d83da528e509734
gitee
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets
arkts
navItem
1. 全局builder
@Builder function navItem(icon: ResourceStr, txt: string) { Column({space: 10}) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function navItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left txt : 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#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 10 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 icon AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' 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 txt AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '25%' 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 AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left '点了' AST#expression#Right + AST#expression#Left txt 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_function_declaration#Right
@Builder function navItem(icon: ResourceStr, txt: string) { Column({space: 10}) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets#L41-L54
f528c84cbba58161cfeb458528cd86f075027c42
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/TitleBar.ets
arkts
TitleBar
Copyright (c) 2023 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.
@Component export struct TitleBar { private title: Resource = $r('app.string.EntryAbility_label'); build() { Column() { Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 24, top: 10 }) .objectFit(ImageFit.Contain) Text(this.title) .fontSize(20) .layoutWeight(1) .margin({ left: 16, top: 10 }) .align(Alignment.Start) Blank() } .height(56) .width('100%') } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.EntryAbility_label' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.back' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain 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 this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment 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#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 Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct TitleBar { private title: Resource = $r('app.string.EntryAbility_label'); build() { Column() { Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 24, top: 10 }) .objectFit(ImageFit.Contain) Text(this.title) .fontSize(20) .layoutWeight(1) .margin({ left: 16, top: 10 }) .align(Alignment.Start) Blank() } .height(56) .width('100%') } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/TitleBar.ets#L16-L40
2e8d2a658286b0e3ab75f1808cebb6fb11856d36
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Wave/WaveView.ets
arkts
drawWaves
绘制双波纹效果(主波+次波叠加) @param width - 画布宽度 @param height - 画布高度
private drawWaves(width: number, height: number) { this.context.clearRect(0, 0, width, height); // 清空画布 // 绘制主波(浅蓝色半透明) this.context.fillStyle = 'rgba(135, 206, 250, 0.6)'; this.context.fill(this.buildWavePath(width, height)); // 绘制次波(相位偏移产生层次感) this.offsetX += Math.PI / 4; // 添加相位偏移 this.context.fillStyle = 'rgba(173, 216, 230, 0.4)'; this.context.fill(this.buildWavePath(width, height)); this.offsetX -= Math.PI / 4; // 恢复原始相位 }
AST#method_declaration#Left private drawWaves AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#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 . context AST#member_expression#Right AST#expression#Right . clearRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left width AST#expression#Right , AST#expression#Left height 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left 'rgba(135, 206, 250, 0.6)' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fill 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 this AST#expression#Right . buildWavePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left width AST#expression#Right , AST#expression#Left height 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . PI AST#member_expression#Right AST#expression#Right / AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 添加相位偏移 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left 'rgba(173, 216, 230, 0.4)' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . fill 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 this AST#expression#Right . buildWavePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left width AST#expression#Right , AST#expression#Left height 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right -= AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . PI AST#member_expression#Right AST#expression#Right / AST#expression#Left 4 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
private drawWaves(width: number, height: number) { this.context.clearRect(0, 0, width, height); this.context.fillStyle = 'rgba(135, 206, 250, 0.6)'; this.context.fill(this.buildWavePath(width, height)); this.offsetX += Math.PI / 4; this.context.fillStyle = 'rgba(173, 216, 230, 0.4)'; this.context.fill(this.buildWavePath(width, height)); this.offsetX -= Math.PI / 4; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Wave/WaveView.ets#L66-L78
d881d5b5a114f80571cae9983851deaa29ac194f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
initializeMockData
初始化模拟数据 (生产版本 - 清空测试数据)
private initializeMockData(): void { // 生产版本:清空所有测试数据,从空状态开始 this.todos = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initialized TodoService with empty todo list for production'); }
AST#method_declaration#Left private initializeMockData 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 . todos 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#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 'Initialized TodoService with empty todo list for production' 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 initializeMockData(): void { this.todos = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initialized TodoService with empty todo list for production'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L62-L67
4b2c40f8af3c5fded8e39912f36d5c5e79ee7cd5
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Computed/computedLocal.ets
arkts
get
cannot trigger Computed
@Computed get fullName() { console.info('---------Computed----------'); this.computedLocalText += 1; return this.firstName + ' ' + this.lastName + this.age; }
AST#method_declaration#Left AST#decorator#Left @ Computed AST#decorator#Right get AST#ERROR#Left fullName AST#ERROR#Right 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 '---------Computed----------' 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 . computedLocalText AST#member_expression#Right += AST#expression#Left 1 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 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 . firstName AST#member_expression#Right AST#expression#Right + AST#expression#Left ' ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastName AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . age AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Computed get fullName() { console.info('---------Computed----------'); this.computedLocalText += 1; return this.firstName + ' ' + this.lastName + this.age; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Computed/computedLocal.ets#L23-L28
c27dd3eb675f7ca104749c7c6382fd8234e760c2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
subscribeCallback
订阅eventId为1234565的事件
subscribeCallback(): void { emitter.on(this.callbackEvent, () => { this.hideSubWindow(); }) }
AST#method_declaration#Left subscribeCallback 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 emitter AST#expression#Right . on 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 . callbackEvent AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideSubWindow 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
subscribeCallback(): void { emitter.on(this.callbackEvent, () => { this.hideSubWindow(); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L135-L139
1b0dbfdc05117be3326141a1880a12e062fb1865
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Dialog.d.ets
arkts
SelectDialog
Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@CustomDialog export declare struct SelectDialog { /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ controller: CustomDialogController; /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ title: ResourceStr; /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ content?: ResourceStr; /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ selectedIndex?: number; /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ confirm?: ButtonOptions; /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ radioContent: Array<SheetInfo>; /** * Custom Theme. * * @type { ?(Theme | CustomTheme) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ theme?: Theme | CustomTheme; /** * Sets the SelectDialog dark or light Mode. * * @type { ?ThemeColorMode } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ themeColorMode?: ThemeColorMode; }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SelectDialog AST#component_body#Left { /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog title. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog content. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left content ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog selected index. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left selectedIndex ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog confirm button. * @type { ?ButtonOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left confirm ? : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the SelectDialog sheets. * @type { Array<SheetInfo> }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left radioContent : 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 SheetInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Custom Theme. * * @type { ?(Theme | CustomTheme) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#property_declaration#Left theme ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Theme AST#primary_type#Right | AST#primary_type#Left CustomTheme AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Sets the SelectDialog dark or light Mode. * * @type { ?ThemeColorMode } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#property_declaration#Left themeColorMode ? : AST#type_annotation#Left AST#primary_type#Left ThemeColorMode AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@CustomDialog export declare struct SelectDialog { controller: CustomDialogController; title: ResourceStr; content?: ResourceStr; selectedIndex?: number; confirm?: ButtonOptions; radioContent: Array<SheetInfo>; theme?: Theme | CustomTheme; themeColorMode?: ThemeColorMode; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Dialog.d.ets#L477-L631
4a2417b0b839ef159addae8e78b4bb424d2c6e4d
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
notifyDataChange
通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件
notifyDataChange(index: number): void { Logger.debug('notifyDataChange: ' + index); this.listeners.forEach(listener => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'notifyDataChange: ' AST#expression#Right + AST#expression#Left 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#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 . listeners 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 listener => 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 listener AST#expression#Right . onDataChange 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#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
notifyDataChange(index: number): void { Logger.debug('notifyDataChange: ' + index); this.listeners.forEach(listener => { listener.onDataChange(index); }) }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L245-L250
7a9e11cccf4820170b14bc9c4a922c8e10f283e8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
createConnection
创建网络连接
private static createConnection() { // let netSpecifier: connection.NetSpecifier = { // netCapabilities: { // // 假设当前默认网络是WiFi,需要创建蜂窝网络连接,可指定网络类型为蜂窝网 // bearerTypes: [connection.NetBearType.BEARER_CELLULAR], // // 指定网络能力为Internet // networkCap: [connection.NetCap.NET_CAPABILITY_INTERNET] // }, // }; return connection.createNetConnection(); }
AST#method_declaration#Left private static createConnection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // let netSpecifier: connection.NetSpecifier = { // netCapabilities: { // // 假设当前默认网络是WiFi,需要创建蜂窝网络连接,可指定网络类型为蜂窝网 // bearerTypes: [connection.NetBearType.BEARER_CELLULAR], // // 指定网络能力为Internet // networkCap: [connection.NetCap.NET_CAPABILITY_INTERNET] // }, // }; 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 connection AST#expression#Right . createNetConnection 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#method_declaration#Right
private static createConnection() { return connection.createNetConnection(); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L39-L49
ce5e2fe2b9be7783c33224c4f733f4f0cdddba74
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbListView.ets
arkts
VideoThumbListView
视频帧图片列表预览组件
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { // TODO: 性能知识点:使用ForEach组件循环渲染数据 ForEach(this.mVideoThumbOption.videoThumbs, (item: ThumbContent, index?: number) => { ListItem() { Image(item.pixelMap ? item.pixelMap : item.framePlaceholder) .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.integer.video_trimmer_thumb_height')) } .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_trimmer_full_size')) .backgroundColor(item.frameBackground ? item.frameBackground : $r('app.color.video_trimmer_frame_bg_color')) }, (item: ThumbContent, index: number) => index.toString()) } .listDirection(Axis.Horizontal) .height($r('app.string.video_trimmer_full_size')) .width($r('app.string.video_trimmer_full_size')) .scrollBar(BarState.Off) } .width($r('app.string.video_trimmer_full_size')) .height($r('app.string.video_trimmer_full_size')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoThumbListView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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 Scroller 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#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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : AST#expression#Left 0 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 . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO: 性能知识点:使用ForEach组件循环渲染数据 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbs 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 ThumbContent 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#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#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right : AST#expression#Left item AST#expression#Right AST#conditional_expression#Right AST#expression#Right . framePlaceholder AST#member_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.video_trimmer_thumb_height' 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_trimmer_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . frameBackground AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . frameBackground AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.video_trimmer_frame_bg_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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#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 ThumbContent 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 index 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#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 . 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_trimmer_full_size' 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.video_trimmer_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off 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#resource_expression#Left $r ( AST#expression#Left 'app.string.video_trimmer_full_size' 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.video_trimmer_full_size' 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { ForEach(this.mVideoThumbOption.videoThumbs, (item: ThumbContent, index?: number) => { ListItem() { Image(item.pixelMap ? item.pixelMap : item.framePlaceholder) .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.integer.video_trimmer_thumb_height')) } .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_trimmer_full_size')) .backgroundColor(item.frameBackground ? item.frameBackground : $r('app.color.video_trimmer_frame_bg_color')) }, (item: ThumbContent, index: number) => index.toString()) } .listDirection(Axis.Horizontal) .height($r('app.string.video_trimmer_full_size')) .width($r('app.string.video_trimmer_full_size')) .scrollBar(BarState.Off) } .width($r('app.string.video_trimmer_full_size')) .height($r('app.string.video_trimmer_full_size')) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbListView.ets#L20-L48
e12508d7cfc08c697d74f79379edc0144200d7c3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/model/ItemData.ets
arkts
ItemData
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.
@Observed export class ItemData { id: string = ''; title: string | Resource = ''; content: string = ''; from: string | Resource = ''; tail: string | Resource = ''; type: number = 0; pics: Resource[] = []; preview: Resource | string = ''; duration: string = ''; isShowTitle?: Visibility = Visibility.Hidden; constructor(id: string, type: number) { this.id = id; this.type = type; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ItemData AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left content : 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 from : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left tail : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left pics : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] 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 preview : 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#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left duration : 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 isShowTitle ? : AST#type_annotation#Left AST#primary_type#Left Visibility AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export class ItemData { id: string = ''; title: string | Resource = ''; content: string = ''; from: string | Resource = ''; tail: string | Resource = ''; type: number = 0; pics: Resource[] = []; preview: Resource | string = ''; duration: string = ''; isShowTitle?: Visibility = Visibility.Hidden; constructor(id: string, type: number) { this.id = id; this.type = type; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/model/ItemData.ets#L16-L33
9087113371ef2542463017d18cb8f9867cee894e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeader.d.ets
arkts
Control style of operation element @enum { OperationStyle } @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Control style of operation element @enum { OperationStyle } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Control style of operation element @enum { OperationStyle } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare enum OperationType { /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ TEXT_ARROW = 0, /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ BUTTON = 1, /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ ICON_GROUP = 2, /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ LOADING = 3 }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum OperationType AST#enum_body#Left { /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#enum_member#Left TEXT_ARROW = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The Button style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#enum_member#Left BUTTON = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The IconGroup style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#enum_member#Left ICON_GROUP = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The LoadingProgress style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#enum_member#Left LOADING = AST#expression#Left 3 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export declare enum OperationType { TEXT_ARROW = 0, BUTTON = 1, ICON_GROUP = 2, LOADING = 3 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeader.d.ets#L45-L125
0e9332311734f0b4f057ded25768587f2cad7716
gitee