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
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets
arkts
cancelNotificationById
cancel notification by id
async cancelNotificationById(id: number) { try { await notification.cancel(id); logger.info(TAG, `cancel success`); } catch (err) { if (err) { logger.info(TAG, `cancel err ${JSON.stringify(err)}`); } } }
AST#method_declaration#Left async cancelNotificationById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notification AST#expression#Right AST#await_expression#Right AST#expression#Right . cancel 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` cancel success ` 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#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` cancel err AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async cancelNotificationById(id: number) { try { await notification.cancel(id); logger.info(TAG, `cancel success`); } catch (err) { if (err) { logger.info(TAG, `cancel err ${JSON.stringify(err)}`); } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets#L85-L94
a9d3985f189829727b36ea7e8c3e88fca154289d
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets
arkts
shutDown
释放ai语音转文字引擎
static shutDown() { SpeechRecognizerManager.asrEngine?.shutdown() }
AST#method_declaration#Left static shutDown 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 AST#member_expression#Left AST#expression#Left SpeechRecognizerManager AST#expression#Right . asrEngine AST#member_expression#Right AST#expression#Right ?. shutdown AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static shutDown() { SpeechRecognizerManager.asrEngine?.shutdown() }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L122-L124
c35ccfaffb8bf132c7a8cc1702bfb34648166602
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets
arkts
defaultDeductionView
ListItem自定义组件(默认)
@Builder defaultDeductionView(listItemInfo: ListInfo) { Row() { Image(listItemInfo.icon) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .draggable(false) // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false Text(listItemInfo.name) .margin({ left: $r('app.string.ohos_id_elements_margin_vertical_l') }) Blank() Image($r("app.media.list_exchange_ic_public_drawer")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .draggable(false) // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false } .width('100%') .height(commonConstants.LIST_ITEM_HEIGHT) .backgroundColor(Color.White) .padding({ left: $r('app.string.ohos_id_card_padding_start'), right: $r('app.string.ohos_id_card_padding_start') }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right defaultDeductionView AST#parameter_list#Left ( AST#parameter#Left listItemInfo : AST#type_annotation#Left AST#primary_type#Left ListInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#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 listItemInfo AST#expression#Right . icon AST#member_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.integer.list_exchange_icon_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.integer.list_exchange_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . draggable ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_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 // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false 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 listItemInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ohos_id_elements_margin_vertical_l' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.list_exchange_ic_public_drawer" 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.integer.list_exchange_icon_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.integer.list_exchange_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . draggable ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false } 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 AST#member_expression#Left AST#expression#Left commonConstants AST#expression#Right . LIST_ITEM_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ohos_id_card_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ohos_id_card_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder defaultDeductionView(listItemInfo: ListInfo) { Row() { Image(listItemInfo.icon) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .draggable(false) Text(listItemInfo.name) .margin({ left: $r('app.string.ohos_id_elements_margin_vertical_l') }) Blank() Image($r("app.media.list_exchange_ic_public_drawer")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .draggable(false) } .width('100%') .height(commonConstants.LIST_ITEM_HEIGHT) .backgroundColor(Color.White) .padding({ left: $r('app.string.ohos_id_card_padding_start'), right: $r('app.string.ohos_id_card_padding_start') }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L123-L146
57515a0a295e137ee9ded1ec363f47daa9749c19
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getPriority
获取Offer优先级(用于排序)
getPriority(): number { switch (this.status) { case OfferStatus.RECEIVED: return this.isExpiringSoon() ? 5 : 4; case OfferStatus.PENDING: return 3; case OfferStatus.ACCEPTED: return 2; case OfferStatus.REJECTED: return 1; case OfferStatus.EXPIRED: return 0; default: return 0; }
AST#method_declaration#Left getPriority AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . RECEIVED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isExpiringSoon 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 5 AST#expression#Right : AST#expression#Left 4 AST#expression#Right AST#conditional_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#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . PENDING AST#member_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 3 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#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . ACCEPTED AST#member_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 2 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#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . REJECTED AST#member_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 1 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#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . EXPIRED AST#member_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 0 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 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getPriority(): number { switch (this.status) { case OfferStatus.RECEIVED: return this.isExpiringSoon() ? 5 : 4; case OfferStatus.PENDING: return 3; case OfferStatus.ACCEPTED: return 2; case OfferStatus.REJECTED: return 1; case OfferStatus.EXPIRED: return 0; default: return 0; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L253-L267
f154d2beafda6baca74d97e8bb6e62ff4f564f6a
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getTasks
Get all tasks @returns Array of Task objects
async getTasks(): Promise<Task[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS); predicates.orderByDesc('due_time'); try { const resultSet = await this.rdbStore.query(predicates); const tasks: Task[] = []; while (resultSet.goToNextRow()) { const row: TaskRow = { id: resultSet.getLong(resultSet.getColumnIndex('id')), title: resultSet.getString(resultSet.getColumnIndex('title')), due_time: resultSet.getLong(resultSet.getColumnIndex('due_time')), is_done: resultSet.getLong(resultSet.getColumnIndex('is_done')), created_at: resultSet.getColumnIndex('created_at') !== -1 ? resultSet.getLong(resultSet.getColumnIndex('created_at')) : 0 }; tasks.push(Task.fromRow(row)); } resultSet.close(); console.info(`[RdbHelper] Retrieved ${tasks.length} tasks`); return tasks; } catch (error) { const err = error as BusinessError; console.error(`[RdbHelper] Failed to get tasks. Code: ${err.code}, message: ${err.message}`); throw new Error(`Failed to get tasks: ${err.message}`); } }
AST#method_declaration#Left async getTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Task [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . rdbStore AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Database not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TABLE_TASKS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . orderByDesc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'due_time' 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#variable_declaration#Left const AST#variable_declarator#Left resultSet = 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 . rdbStore AST#member_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right ) AST#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 tasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Task [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left row : AST#type_annotation#Left AST#primary_type#Left TaskRow AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title' 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left due_time AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'due_time' 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_done AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'is_done' 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'created_at' AST#expression#Right ) AST#argument_list#Right AST#call_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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'created_at' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Task AST#expression#Right . fromRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left row 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#while_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] Retrieved AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right tasks ` 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 tasks AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] Failed to get tasks. 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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to get tasks: 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#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getTasks(): Promise<Task[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS); predicates.orderByDesc('due_time'); try { const resultSet = await this.rdbStore.query(predicates); const tasks: Task[] = []; while (resultSet.goToNextRow()) { const row: TaskRow = { id: resultSet.getLong(resultSet.getColumnIndex('id')), title: resultSet.getString(resultSet.getColumnIndex('title')), due_time: resultSet.getLong(resultSet.getColumnIndex('due_time')), is_done: resultSet.getLong(resultSet.getColumnIndex('is_done')), created_at: resultSet.getColumnIndex('created_at') !== -1 ? resultSet.getLong(resultSet.getColumnIndex('created_at')) : 0 }; tasks.push(Task.fromRow(row)); } resultSet.close(); console.info(`[RdbHelper] Retrieved ${tasks.length} tasks`); return tasks; } catch (error) { const err = error as BusinessError; console.error(`[RdbHelper] Failed to get tasks. Code: ${err.code}, message: ${err.message}`); throw new Error(`Failed to get tasks: ${err.message}`); } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L195-L226
17d127b9ea9dc55f2f39b16fbb5fe2c67ab6f647
github
CQULeaf/HarmonyOS-App-Development.git
91f6ab13be3dbf83f6c1c4d2958673f15faefe46
Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets
arkts
startListening
开始监听
static startListening() { // 设置开始识别的相关参数 let recognizerParams: speechRecognizer.StartParams = { // 会话id sessionId: SpeechRecognizerManager.sessionId, // 音频配置信息。 audioInfo: { // 音频类型。 当前仅支持“pcm” audioType: 'pcm', // 音频的采样率。 当前仅支持16000采样率 sampleRate: 16000, // 音频返回的通道数信息。 当前仅支持通道1。 soundChannel: 1, // 音频返回的采样位数。 当前仅支持16位 sampleBit: 16 }, // 录音识别 extraParams: { // 0:实时录音识别 会自动打开麦克风 录制实时语音 "recognitionMode": 0, // 最大支持音频时长 maxAudioDuration: 60000 } } // 调用开始识别方法 SpeechRecognizerManager.asrEngine?.startListening(recognizerParams); }
AST#method_declaration#Left static startListening AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置开始识别的相关参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left recognizerParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . StartParams 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#object_literal#Left { // 会话id AST#property_assignment#Left AST#property_name#Left sessionId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SpeechRecognizerManager AST#expression#Right . sessionId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 音频配置信息。 AST#property_assignment#Left AST#property_name#Left audioInfo AST#property_name#Right : AST#expression#Left AST#object_literal#Left { // 音频类型。 当前仅支持“pcm” AST#property_assignment#Left AST#property_name#Left audioType AST#property_name#Right : AST#expression#Left 'pcm' AST#expression#Right AST#property_assignment#Right , // 音频的采样率。 当前仅支持16000采样率 AST#property_assignment#Left AST#property_name#Left sampleRate AST#property_name#Right : AST#expression#Left 16000 AST#expression#Right AST#property_assignment#Right , // 音频返回的通道数信息。 当前仅支持通道1。 AST#property_assignment#Left AST#property_name#Left soundChannel AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 音频返回的采样位数。 当前仅支持16位 AST#property_assignment#Left AST#property_name#Left sampleBit AST#property_name#Right : AST#expression#Left 16 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 extraParams AST#property_name#Right : AST#expression#Left AST#object_literal#Left { // 0:实时录音识别 会自动打开麦克风 录制实时语音 AST#property_assignment#Left AST#property_name#Left "recognitionMode" AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 最大支持音频时长 AST#property_assignment#Left AST#property_name#Left maxAudioDuration AST#property_name#Right : AST#expression#Left 60000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // 调用开始识别方法 AST#ERROR#Left SpeechRecognizerManager AST#ERROR#Right . asrEngine AST#member_expression#Right AST#expression#Right ?. startListening AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left recognizerParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static startListening() { let recognizerParams: speechRecognizer.StartParams = { sessionId: SpeechRecognizerManager.sessionId, audioInfo: { audioType: 'pcm', sampleRate: 16000, soundChannel: 1, sampleBit: 16 }, extraParams: { "recognitionMode": 0, maxAudioDuration: 60000 } } SpeechRecognizerManager.asrEngine?.startListening(recognizerParams); }
https://github.com/CQULeaf/HarmonyOS-App-Development.git/blob/91f6ab13be3dbf83f6c1c4d2958673f15faefe46/Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets#L84-L110
ea021a54da0aec7e927b894b1d5b7ab4daef76e4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets
arkts
ActionSectionView
操作组合组件
@Component export struct ActionSectionView { actionItems: ActionItem[] = []; // 操作项数组 onClickItem?: (id: string) => void; // 操作项点击处理 build() { Column() { ForEach(this.actionItems, (actionItem: ActionItem, index: number) => { this.createActionItem(actionItem, this.onClickItem) if (index < this.actionItems.length - 1) { this.createDivider() } }) }.sectionStyle() } /** * 创建一条操作栏目的视图 * @param title * @param onClick * @param subTitle */ @Builder createActionItem(actionItem: ActionItem, onClickItem?: (id: string) => void) { Row() { Text(actionItem.title) .fontSize($r('app.integer.limited_height_bottom_dialog_section_item_title_font_size')) .fontColor(Color.Black) Text(actionItem.subTitle) .fontSize($r('app.integer.limited_height_bottom_dialog_section_item_sub_title_font_size')) .fontColor(Color.Gray) .margin({ left: $r('app.integer.limited_height_bottom_dialog_section_item_sub_title_left_margin') }) Blank() Image($r("app.media.limited_height_bottom_dialog_right_arrow")) .width($r('app.integer.limited_height_bottom_dialog_right_arrow_width')) .height($r('app.integer.limited_height_bottom_dialog_right_arrow_height')) } .alignItems(VerticalAlign.Center) .width($r('app.string.limited_height_bottom_dialog_full_width')) .height($r('app.integer.limited_height_bottom_dialog_section_item_height')) .onClick(() => { if (onClickItem) { onClickItem(actionItem.id) } else { promptAction.showToast({ message: $r('app.string.limited_height_bottom_dialog_toast_tips') }); } }) } /** * 创建特定样式的分隔线 */ @Builder createDivider() { Divider() .vertical(false) .strokeWidth(0.5) .color($r('app.color.limited_height_bottom_dialog_divider_color')) } /** * section的样式 */ @Styles sectionStyle() { .width($r('app.string.limited_height_bottom_dialog_full_width')) .backgroundColor(Color.White) .borderRadius($r('app.integer.limited_height_bottom_dialog_section_border_radius')) .padding({ left: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding'), right: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding') }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ActionSectionView AST#component_body#Left { AST#property_declaration#Left actionItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] 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 onClickItem ? : AST#type_annotation#Left AST#function_type#Left 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 void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 操作项点击处理 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . actionItems AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left actionItem : AST#type_annotation#Left AST#primary_type#Left ActionItem 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createActionItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left actionItem AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onClickItem AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . actionItems 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createDivider 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_if_statement#Right AST#ui_control_flow#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 . sectionStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /** * 创建一条操作栏目的视图 * @param title * @param onClick * @param subTitle */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createActionItem AST#parameter_list#Left ( AST#parameter#Left actionItem : AST#type_annotation#Left AST#primary_type#Left ActionItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onClickItem ? : AST#type_annotation#Left AST#function_type#Left 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 void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left actionItem AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_item_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left actionItem AST#expression#Right . subTitle AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_item_sub_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_item_sub_title_left_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.limited_height_bottom_dialog_right_arrow" 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.integer.limited_height_bottom_dialog_right_arrow_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_right_arrow_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 . 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_item_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left onClickItem AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onClickItem AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left actionItem AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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.limited_height_bottom_dialog_toast_tips' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createDivider 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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.limited_height_bottom_dialog_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * section的样式 */ AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right sectionStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_border_radius' AST#expression#Right ) AST#resource_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 AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_left_and_right_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.limited_height_bottom_dialog_section_left_and_right_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct ActionSectionView { actionItems: ActionItem[] = []; onClickItem?: (id: string) => void; build() { Column() { ForEach(this.actionItems, (actionItem: ActionItem, index: number) => { this.createActionItem(actionItem, this.onClickItem) if (index < this.actionItems.length - 1) { this.createDivider() } }) }.sectionStyle() } @Builder createActionItem(actionItem: ActionItem, onClickItem?: (id: string) => void) { Row() { Text(actionItem.title) .fontSize($r('app.integer.limited_height_bottom_dialog_section_item_title_font_size')) .fontColor(Color.Black) Text(actionItem.subTitle) .fontSize($r('app.integer.limited_height_bottom_dialog_section_item_sub_title_font_size')) .fontColor(Color.Gray) .margin({ left: $r('app.integer.limited_height_bottom_dialog_section_item_sub_title_left_margin') }) Blank() Image($r("app.media.limited_height_bottom_dialog_right_arrow")) .width($r('app.integer.limited_height_bottom_dialog_right_arrow_width')) .height($r('app.integer.limited_height_bottom_dialog_right_arrow_height')) } .alignItems(VerticalAlign.Center) .width($r('app.string.limited_height_bottom_dialog_full_width')) .height($r('app.integer.limited_height_bottom_dialog_section_item_height')) .onClick(() => { if (onClickItem) { onClickItem(actionItem.id) } else { promptAction.showToast({ message: $r('app.string.limited_height_bottom_dialog_toast_tips') }); } }) } @Builder createDivider() { Divider() .vertical(false) .strokeWidth(0.5) .color($r('app.color.limited_height_bottom_dialog_divider_color')) } @Styles sectionStyle() { .width($r('app.string.limited_height_bottom_dialog_full_width')) .backgroundColor(Color.White) .borderRadius($r('app.integer.limited_height_bottom_dialog_section_border_radius')) .padding({ left: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding'), right: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding') }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets#L22-L105
d5088a285bc0e1b6b5d36b330b8bf8df16ec872c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
encode
加密 @param encodeStr 待加密的字符串 @param pubKey SM2公钥
static async encode(str: string, pubKey: string): Promise<string> { return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256); }
AST#method_declaration#Left static async encode AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . encodeAsym AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left 'SM2_256' AST#expression#Right , AST#expression#Left 'SM2_256|SM3' AST#expression#Right , AST#expression#Left 256 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async encode(str: string, pubKey: string): Promise<string> { return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L41-L43
fa6a1242acbffa341ce42a0099953b86246d0a37
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
搜索任务 @param userId 用户ID @param keyword 搜索关键词 @param page 页码 @param size 每页大小 @returns 任务列表分页结果
export function searchTasks(userId: number, keyword: string, page: number = 0, size: number = 20): Promise<PageResponse<Task>> { const params: TaskQueryParams = { userId, keyword, page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/search`, params ); } catch (error) { console.error(`搜索任务失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`搜索任务失败: ${error instanceof Error ? error.message : String(error)}`); } }
AST#export_declaration#Left export AST#function_declaration#Left function searchTasks 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#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 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 AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left TaskQueryParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left userId AST#property_assignment#Right , AST#property_assignment#Left keyword AST#property_assignment#Right , AST#property_assignment#Left page AST#property_assignment#Right , AST#property_assignment#Left size 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Task 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /tasks/search ` AST#template_literal#Right AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 搜索任务失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 搜索任务失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function searchTasks(userId: number, keyword: string, page: number = 0, size: number = 20): Promise<PageResponse<Task>> { const params: TaskQueryParams = { userId, keyword, page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/search`, params ); } catch (error) { console.error(`搜索任务失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`搜索任务失败: ${error instanceof Error ? error.message : String(error)}`); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L310-L322
97396391f922fbc2dc2f636d02a5dd3c2eb37492
github
Running-Turtle1/club-enroll-system.git
341bee0399c08bf9a61282f69dcac70e97558d76
clubhy/entry/src/main/ets/views/MyInput.ets
arkts
MyInput
struct 做组件或页面时,要使用struct关键字 class 做数据结构时用class
@Preview //可预览组件 @Component //这个结构体是一个Component组件,@State 具有数据双向绑定的功能,实时更新 export struct MyInput{ @State placeholder:string = '请输入' @State text:string = '' callback = (v:string)=>{} //callback是一个function(v:string)函数 build() { TextInput({placeholder:this.placeholder,text:this.text}) .fontSize(25) .placeholderFont({size:25}) .backgroundColor(Color.Transparent) .borderWidth({bottom:1}) .borderRadius(0) .borderColor('#ccc') .margin({top:20}) .onChange(v=>this.callback(v)) //回调函数 } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right //可预览组件 AST#decorator#Left @ Component AST#decorator#Right //这个结构体是一个Component组件,@State 具有数据双向绑定的功能,实时更新 export struct MyInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right placeholder : 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 AST#decorator#Left @ State AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left '' AST#expression#Right callback AST#ERROR#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left v : 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right //callback是一个function(v:string)函数 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 TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 25 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left '#ccc' 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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left v => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left v AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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
@Preview @Component export struct MyInput{ @State placeholder:string = '请输入' @State text:string = '' callback = (v:string)=>{} build() { TextInput({placeholder:this.placeholder,text:this.text}) .fontSize(25) .placeholderFont({size:25}) .backgroundColor(Color.Transparent) .borderWidth({bottom:1}) .borderRadius(0) .borderColor('#ccc') .margin({top:20}) .onChange(v=>this.callback(v)) } }
https://github.com/Running-Turtle1/club-enroll-system.git/blob/341bee0399c08bf9a61282f69dcac70e97558d76/clubhy/entry/src/main/ets/views/MyInput.ets#L3-L20
16860e87a7491ac02151db43800ab1cc505ee7ee
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets
arkts
getCurrentScreenWidth
获取当前屏幕宽度
getCurrentScreenWidth(): number { let screenW: number = px2vp(display.getDefaultDisplaySync().width); // 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。 if (screenW >= this.DEVICESIZE) { return screenW / 2; } else { return screenW; } }
AST#method_declaration#Left getCurrentScreenWidth 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 screenW : 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 px2vp AST#expression#Right AST#argument_list#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 display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width 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 // 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。 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 screenW AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEVICESIZE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left screenW AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left screenW AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getCurrentScreenWidth(): number { let screenW: number = px2vp(display.getDefaultDisplaySync().width); if (screenW >= this.DEVICESIZE) { return screenW / 2; } else { return screenW; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets#L102-L110
5c88af6af2edd5b392108630c484cd5fad5ebd01
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets
arkts
快截图标区域3 左右之间间隔
build() { if (this.isChange) { Row() { IconList3({ marginSpace: this.marginSpace }) } .backgroundColor($r('app.color.component_stack_product_background')) .width('100%') .height($r("app.integer.component_stack_icon_list_height3")) .opacity(this.opacity1) // TODO: 知识点:组件的Z序,设置组件的堆叠顺序,zIndex值越大,显示层级越高。 .zIndex(ZINDEX) } else { Row() { IconList1() } .width('100%') .height($r("app.integer.component_stack_icon_list_height1")) .opacity(this.opacity1) } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isChange AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IconList3 ( AST#component_parameters#Left { AST#component_parameter#Left marginSpace : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginSpace AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.component_stack_product_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.component_stack_icon_list_height3" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right AST#expression#Right ) // TODO: 知识点:组件的Z序,设置组件的堆叠顺序,zIndex值越大,显示层级越高。 AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left ZINDEX AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { 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 IconList1 ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.component_stack_icon_list_height1" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#build_body#Right AST#build_method#Right
build() { if (this.isChange) { Row() { IconList3({ marginSpace: this.marginSpace }) } .backgroundColor($r('app.color.component_stack_product_background')) .width('100%') .height($r("app.integer.component_stack_icon_list_height3")) .opacity(this.opacity1) .zIndex(ZINDEX) } else { Row() { IconList1() } .width('100%') .height($r("app.integer.component_stack_icon_list_height1")) .opacity(this.opacity1) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets#L228-L247
90ad581511a26344798f443f03df94bb9b811b20
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
ToolBar
Declare Component ToolBar @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare Component ToolBar @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare Component ToolBar @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@Component export declare struct ToolBar { /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @ObjectLink toolBarList: ToolBarOptions; /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop activateIndex?: number; /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ controller: TabsController; /** * Define divider Modifier. * @type { ?DividerModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Define divider Modifier. * @type { ?DividerModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop dividerModifier?: DividerModifier; /** * Define toolbar modifier. * @type { ?ToolBarModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Define toolbar modifier. * @type { ?ToolBarModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Prop toolBarModifier?: ToolBarModifier; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ToolBar AST#component_body#Left { /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar list array. * @type { ToolBarOptions }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right toolBarList : AST#type_annotation#Left AST#primary_type#Left ToolBarOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar activate item index, default is -1. * @type { ?number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right activateIndex ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Define toolbar controller. * @type { TabsController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left TabsController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Define divider Modifier. * @type { ?DividerModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Define divider Modifier. * @type { ?DividerModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right dividerModifier ? : AST#type_annotation#Left AST#primary_type#Left DividerModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Define toolbar modifier. * @type { ?ToolBarModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Define toolbar modifier. * @type { ?ToolBarModifier }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right toolBarModifier ? : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier 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 ToolBar { @ObjectLink toolBarList: ToolBarOptions; @Prop activateIndex?: number; controller: TabsController; @Prop dividerModifier?: DividerModifier; @Prop toolBarModifier?: ToolBarModifier; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L517-L617
7b7d0f8eb6ef028067e435591a9083d9b8d85eeb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptECB
加密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。 @returns
static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.encrypt(data, symKey, null, transformation); }
AST#method_declaration#Left static async encryptECB 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#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SM4 AST#expression#Right . encrypt 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 async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.encrypt(data, symKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L163-L166
fdda1b6656797e52edf5d42cd973679008841ab1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/StateManagementPage.ets
arkts
StateManagementContent
状态管理示例页内容视图 @returns {void} 无返回值
@Builder private StateManagementContent() { MediumPaddingVerticalScroll() { Column() { Column() { Column() { Text($r("app.string.demo_state_management_count_label")) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_subtitle")); SpaceVerticalSmall(); Text(`${this.vm.counterState.count}`) .fontSize($r("app.float.display_large")) .fontColor($r("app.color.text_primary")) .fontWeight(FontWeight.Bold); }; } .width(P100) .padding($r("app.float.space_padding_medium")) .backgroundColor($r("app.color.bg_white")) .borderRadius($r("app.float.radius_medium")); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_decrement"), type: "default", btnWidth: P100, round: true, onBtnClick: (): void => { this.vm.decrement(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_increment"), type: "primary", btnWidth: P100, round: true, onBtnClick: (): void => { this.vm.increment(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_reset"), type: "danger", btnWidth: P100, plain: true, round: true, onBtnClick: (): void => { this.vm.reset(); } }) }; }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private StateManagementContent 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 MediumPaddingVerticalScroll ( ) 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 Column ( ) 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 Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_state_management_count_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_subtitle" 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . counterState AST#member_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.display_large" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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#ERROR#Left ; AST#ERROR#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalLarge ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_state_management_action_decrement" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "default" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . decrement AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalLarge ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_state_management_action_increment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "primary" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . increment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalLarge ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_state_management_action_reset" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "danger" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left plain : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#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#builder_function_body#Right AST#method_declaration#Right
@Builder private StateManagementContent() { MediumPaddingVerticalScroll() { Column() { Column() { Column() { Text($r("app.string.demo_state_management_count_label")) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_subtitle")); SpaceVerticalSmall(); Text(`${this.vm.counterState.count}`) .fontSize($r("app.float.display_large")) .fontColor($r("app.color.text_primary")) .fontWeight(FontWeight.Bold); }; } .width(P100) .padding($r("app.float.space_padding_medium")) .backgroundColor($r("app.color.bg_white")) .borderRadius($r("app.float.radius_medium")); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_decrement"), type: "default", btnWidth: P100, round: true, onBtnClick: (): void => { this.vm.decrement(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_increment"), type: "primary", btnWidth: P100, round: true, onBtnClick: (): void => { this.vm.increment(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_state_management_action_reset"), type: "danger", btnWidth: P100, plain: true, round: true, onBtnClick: (): void => { this.vm.reset(); } }) }; }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/StateManagementPage.ets#L37-L98
427373cc088a622451334087bba2af5a79dacd16
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
deleteAccount
Delete account method
async deleteAccount(accountId: string) { const success = await AccountDataManager.deleteAccount(accountId); if (success) { // Reload account data after deletion await this.loadAccountData(); promptAction.showToast({ message: '删除成功', duration: 2000 }); } else { promptAction.showToast({ message: '删除失败,请重试', duration: 2000 }); } }
AST#method_declaration#Left async deleteAccount AST#parameter_list#Left ( AST#parameter#Left accountId : 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 success = 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 AccountDataManager AST#expression#Right AST#await_expression#Right AST#expression#Right . deleteAccount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left accountId 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 success AST#expression#Right ) AST#block_statement#Left { // Reload account data after deletion AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . loadAccountData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async deleteAccount(accountId: string) { const success = await AccountDataManager.deleteAccount(accountId); if (success) { await this.loadAccountData(); promptAction.showToast({ message: '删除成功', duration: 2000 }); } else { promptAction.showToast({ message: '删除失败,请重试', duration: 2000 }); } }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1580-L1595
cc66d5403e3b2f627d581157db3a13c61399e708
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
updateGenerationRating
更新生成历史评分
async updateGenerationRating(historyId: string, rating: number): Promise<boolean> { const history = this.generationHistory.find(h => h.id === historyId); if (!history) { return false; } history.rating = rating; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Updated rating for history: ${historyId} to ${rating}`); return true; }
AST#method_declaration#Left async updateGenerationRating AST#parameter_list#Left ( AST#parameter#Left historyId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rating : 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#variable_declaration#Left const AST#variable_declarator#Left history = 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 . generationHistory AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left h => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left h AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left historyId AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left history 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#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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left history AST#expression#Right . rating AST#member_expression#Right = AST#expression#Left rating 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Updated rating for history: AST#template_substitution#Left $ { AST#expression#Left historyId AST#expression#Right } AST#template_substitution#Right to AST#template_substitution#Left $ { AST#expression#Left rating AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async updateGenerationRating(historyId: string, rating: number): Promise<boolean> { const history = this.generationHistory.find(h => h.id === historyId); if (!history) { return false; } history.rating = rating; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Updated rating for history: ${historyId} to ${rating}`); return true; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L147-L158
82a6f9f34a2a72fbb07ee0a2909b273eb9c63853
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/Renderer.ets
arkts
Abstract baseclass of all Renderers.
export default abstract class Renderer { /** * the component that handles the drawing area of the chart and it's offsets */ protected mViewPortHandler: ViewPortHandler | null = null; constructor(viewPortHandler: ViewPortHandler) { if (viewPortHandler) { this.mViewPortHandler = viewPortHandler; } } }
AST#export_declaration#Left export default AST#class_declaration#Left abstract class Renderer AST#class_body#Left { /** * the component that handles the drawing area of the chart and it's offsets */ AST#property_declaration#Left protected mViewPortHandler : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ViewPortHandler AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left viewPortHandler : AST#type_annotation#Left AST#primary_type#Left ViewPortHandler 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 viewPortHandler 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 . mViewPortHandler AST#member_expression#Right = AST#expression#Left viewPortHandler 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#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default abstract class Renderer { protected mViewPortHandler: ViewPortHandler | null = null; constructor(viewPortHandler: ViewPortHandler) { if (viewPortHandler) { this.mViewPortHandler = viewPortHandler; } } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/Renderer.ets#L23-L34
ed9cfbd66b01df5ca1623b9b218b6a9e025860ee
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
judgeHasNet
获取网络是否开启,返回布尔值
judgeHasNet(): boolean { try { // Get current network connection let netHandle = connection.getDefaultNetSync(); // 0-100 Reserved connections for the system if (!netHandle || netHandle.netId < 100) { return false; } // Get the properties of the connection let netCapability = connection.getNetCapabilitiesSync(netHandle); let cap = netCapability.networkCap; if (!cap) { return false; } for (let em of cap) { if (connection.NetCap.NET_CAPABILITY_VALIDATED === em) { return true; } } } catch (e) { // let err = e as BusinessError; console.info('get netInfo error :' + JSON.stringify(e)); } return false; }
AST#method_declaration#Left judgeHasNet 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 { // Get current network connection AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left netHandle = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . getDefaultNetSync 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 // 0-100 Reserved connections for the system 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#unary_expression#Left ! AST#expression#Left netHandle AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left netHandle AST#expression#Right AST#binary_expression#Right AST#expression#Right . netId AST#member_expression#Right AST#expression#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 // Get the properties of the connection AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left netCapability = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . getNetCapabilitiesSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left netHandle 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 cap = AST#expression#Left AST#member_expression#Left AST#expression#Left netCapability AST#expression#Right . networkCap 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#unary_expression#Left ! AST#expression#Left cap 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#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#for_statement#Left for ( let em of AST#expression#Left cap AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . NetCap AST#member_expression#Right AST#expression#Right . NET_CAPABILITY_VALIDATED AST#member_expression#Right AST#expression#Right === AST#expression#Left em AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // let err = e as BusinessError; 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 'get netInfo error :' 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 e 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#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
judgeHasNet(): boolean { try { let netHandle = connection.getDefaultNetSync(); if (!netHandle || netHandle.netId < 100) { return false; } let netCapability = connection.getNetCapabilitiesSync(netHandle); let cap = netCapability.networkCap; if (!cap) { return false; } for (let em of cap) { if (connection.NetCap.NET_CAPABILITY_VALIDATED === em) { return true; } } } catch (e) { console.info('get netInfo error :' + JSON.stringify(e)); } return false; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L477-L503
e60f6626035e0fbe48a65c43cb2e7929061a58a5
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Ready.ets
arkts
handle
应用约束:45. 需要显式标注函数返回类型
handle(packet: any): void { const client = this.packetManager.client; const data = packet.d; client.ws.heartbeat(); // 应用约束:2. 禁止在运行时变更对象布局 data.user.user_settings = data.user_settings; data.user.user_guild_settings = data.user_guild_settings; // 应用约束:10. 使用具体的类型而非any const clientUser = new ClientUser(client, data.user); client.user = clientUser; client.readyAt = new Date(); client.users.set(clientUser.id, clientUser); // 应用约束:41. 不支持for .. in,改用常规for循环 for (const guild of data.guilds) { if (!client.guilds.has(guild.id)) { client.dataManager.newGuild(guild); } } for (const privateDM of data.private_channels) { client.dataManager.newChannel(privateDM); } for (const relation of data.relationships) { const user = client.dataManager.newUser(relation.user); if (relation.type === 1) { client.user.friends.set(user.id, user); } else if (relation.type === 2) { client.user.blocked.set(user.id, user); } } data.presences = data.presences || []; for (const presence of data.presences) { client.dataManager.newUser(presence.user); client._setPresence(presence.user.id, presence); } if (data.notes) { // 应用约束:21. 不支持通过索引访问字段 for (const user of Object.keys(data.notes)) { let note = data.notes[user]; if (!note.length) note = null; client.user.notes.set(user, note); } } if (!client.user.bot && client.options.sync) { // 应用约束:26. 使用箭头函数而非函数表达式 client.setInterval(() => client.syncGuilds(), 30000); } if (!client.users.has('1')) { client.dataManager.newUser({ id: '1', username: 'Clyde', discriminator: '0000', avatar: 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png', bot: true, status: 'online', game: null, verified: true, }); } // 应用约束:30. 类型转换仅支持as T语法 const t = client.setTimeout(() => { client.ws.connection.triggerReady(); }, 1200 * (data.guilds.length as number)); client.setMaxListeners(data.guilds.length + 10); // 应用约束:47. 不支持在函数内声明函数,改用lambda client.once('ready', () => { client.syncGuilds(); client.setMaxListeners(10); client.clearTimeout(t); }); const ws = this.packetManager.ws; ws.sessionID = data.session_id; ws._trace = data._trace; client.emit('debug', `READY ${ws._trace.join(' -> ')} ${ws.sessionID}`); ws.checkIfReady(); }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left client = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . packetManager AST#member_expression#Right AST#expression#Right . client 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 data = AST#expression#Left AST#member_expression#Left AST#expression#Left packet AST#expression#Right . d 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#member_expression#Left AST#expression#Left client AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . heartbeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束:2. 禁止在运行时变更对象布局 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . user AST#member_expression#Right AST#expression#Right . user_settings AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . user_settings 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 AST#member_expression#Left AST#expression#Left data AST#expression#Right . user AST#member_expression#Right AST#expression#Right . user_guild_settings AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . user_guild_settings AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束:10. 使用具体的类型而非any AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left clientUser = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ClientUser AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left client AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . user AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . user AST#member_expression#Right = AST#expression#Left clientUser 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 client AST#expression#Right . readyAt AST#member_expression#Right = 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . users AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left clientUser AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left clientUser AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束:41. 不支持for .. in,改用常规for循环 AST#statement#Left AST#for_statement#Left for ( const guild of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . guilds AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left client AST#expression#Right AST#unary_expression#Right AST#expression#Right . guilds AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left guild AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . dataManager AST#member_expression#Right AST#expression#Right . newGuild AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left guild AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const privateDM of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . private_channels AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . dataManager AST#member_expression#Right AST#expression#Right . newChannel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left privateDM AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const relation of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . relationships AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left user = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . dataManager AST#member_expression#Right AST#expression#Right . newUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left relation AST#expression#Right . user AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left relation AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . user AST#member_expression#Right AST#expression#Right . friends AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left user 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 AST#member_expression#Left AST#expression#Left relation AST#expression#Right . type AST#member_expression#Right 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . user AST#member_expression#Right AST#expression#Right . blocked AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left user 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#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . presences AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . presences AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const presence of AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . presences AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . dataManager AST#member_expression#Right AST#expression#Right . newUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left presence AST#expression#Right . user AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . _setPresence 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 presence AST#expression#Right . user AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left presence 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . notes AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 应用约束:21. 不支持通过索引访问字段 AST#statement#Left AST#for_statement#Left for ( const user of 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 AST#member_expression#Left AST#expression#Left data AST#expression#Right . notes AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left note = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . notes AST#member_expression#Right AST#expression#Right [ AST#expression#Left user 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 AST#unary_expression#Left ! AST#expression#Left note AST#expression#Right AST#unary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left note = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#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#member_expression#Left AST#expression#Left client AST#expression#Right . user AST#member_expression#Right AST#expression#Right . notes AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left user AST#expression#Right , AST#expression#Left note AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 AST#unary_expression#Left ! AST#expression#Left client AST#expression#Right AST#unary_expression#Right AST#expression#Right . user AST#member_expression#Right AST#expression#Right . bot AST#member_expression#Right AST#expression#Right && AST#expression#Left client AST#expression#Right AST#binary_expression#Right AST#expression#Right . options AST#member_expression#Right AST#expression#Right . sync AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 应用约束:26. 使用箭头函数而非函数表达式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . setInterval 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . syncGuilds 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#expression#Left 30000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 client AST#expression#Right AST#unary_expression#Right AST#expression#Right . users AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 client AST#expression#Right . dataManager AST#member_expression#Right AST#expression#Right . newUser 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 id AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username AST#property_name#Right : AST#expression#Left 'Clyde' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left discriminator AST#property_name#Right : AST#expression#Left '0000' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avatar AST#property_name#Right : AST#expression#Left 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bot 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 status AST#property_name#Right : AST#expression#Left 'online' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left game AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left verified 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 // 应用约束:30. 类型转换仅支持as T语法 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . setTimeout 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . connection AST#member_expression#Right AST#expression#Right . triggerReady AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 1200 AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . guilds AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . setMaxListeners AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . guilds AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left 10 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 // 应用约束:47. 不支持在函数内声明函数,改用lambda AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . once AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ready' 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 client AST#expression#Right . syncGuilds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . setMaxListeners AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 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 client AST#expression#Right . clearTimeout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t 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#variable_declaration#Left const AST#variable_declarator#Left ws = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . packetManager AST#member_expression#Right AST#expression#Right . ws 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left ws AST#expression#Right . sessionID AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . session_id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ws AST#expression#Right . _trace AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . _trace AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'debug' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` READY 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 ws AST#expression#Right . _trace AST#member_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ' -> ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left ws AST#expression#Right . sessionID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ws AST#expression#Right . checkIfReady AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
handle(packet: any): void { const client = this.packetManager.client; const data = packet.d; client.ws.heartbeat(); data.user.user_settings = data.user_settings; data.user.user_guild_settings = data.user_guild_settings; const clientUser = new ClientUser(client, data.user); client.user = clientUser; client.readyAt = new Date(); client.users.set(clientUser.id, clientUser); for (const guild of data.guilds) { if (!client.guilds.has(guild.id)) { client.dataManager.newGuild(guild); } } for (const privateDM of data.private_channels) { client.dataManager.newChannel(privateDM); } for (const relation of data.relationships) { const user = client.dataManager.newUser(relation.user); if (relation.type === 1) { client.user.friends.set(user.id, user); } else if (relation.type === 2) { client.user.blocked.set(user.id, user); } } data.presences = data.presences || []; for (const presence of data.presences) { client.dataManager.newUser(presence.user); client._setPresence(presence.user.id, presence); } if (data.notes) { for (const user of Object.keys(data.notes)) { let note = data.notes[user]; if (!note.length) note = null; client.user.notes.set(user, note); } } if (!client.user.bot && client.options.sync) { client.setInterval(() => client.syncGuilds(), 30000); } if (!client.users.has('1')) { client.dataManager.newUser({ id: '1', username: 'Clyde', discriminator: '0000', avatar: 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png', bot: true, status: 'online', game: null, verified: true, }); } const t = client.setTimeout(() => { client.ws.connection.triggerReady(); }, 1200 * (data.guilds.length as number)); client.setMaxListeners(data.guilds.length + 10); client.once('ready', () => { client.syncGuilds(); client.setMaxListeners(10); client.clearTimeout(t); }); const ws = this.packetManager.ws; ws.sessionID = data.session_id; ws._trace = data._trace; client.emit('debug', `READY ${ws._trace.join(' -> ')} ${ws.sessionID}`); ws.checkIfReady(); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Ready.ets#L12-L101
1ff60d6278a56fe80b780e273add3df61ec7ae7e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
createPreparationReminder
创建准备提醒
async createPreparationReminder(contact: Contact, reminderTime: Date, message: string): Promise<string> { try { const reminderId = this.generateReminderId(ReminderType.PREPARATION_REMINDER, contact.id); const reminderRequest: reminderAgentManager.ReminderRequestAlarm = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, hour: reminderTime.getHours(), minute: reminderTime.getMinutes(), title: `📝 准备提醒`, content: message, expiredContent: '准备提醒已过期', notificationId: parseInt(reminderId.replace(/\D/g, ''), 10), slotType: reminderAgentManager.SlotType.SERVICE_INFORMATION }; const publishedId = await reminderAgentManager.publishReminder(reminderRequest); const config: ReminderConfig = { id: reminderId, type: ReminderType.PREPARATION_REMINDER, title: reminderRequest.title, content: reminderRequest.content, triggerTime: reminderTime, contactId: contact.id, enabled: true }; this.activeReminders.set(reminderId, config); await this.saveReminderConfig(config); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Preparation reminder created, published ID: ${publishedId}`); return reminderId; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed to create preparation reminder: ${error}`); throw error; } }
AST#method_declaration#Left async createPreparationReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reminderTime : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reminderId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generateReminderId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ReminderType AST#expression#Right . PREPARATION_REMINDER AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . id 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 const AST#variable_declarator#Left reminderRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left reminderAgentManager . ReminderRequestAlarm 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 reminderType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderAgentManager AST#expression#Right . ReminderType AST#member_expression#Right AST#expression#Right . REMINDER_TYPE_ALARM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left hour AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderTime AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minute AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderTime AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 📝 准备提醒 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expiredContent AST#property_name#Right : AST#expression#Left '准备提醒已过期' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notificationId AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderId AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \D AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#ERROR#Left , AST#property_name#Left 10 AST#property_name#Right ) AST#ERROR#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderAgentManager AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . SERVICE_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left publishedId = 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 reminderAgentManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publishReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderRequest 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 config : AST#type_annotation#Left AST#primary_type#Left ReminderConfig 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 reminderId 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 ReminderType AST#expression#Right . PREPARATION_REMINDER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left reminderRequest AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left reminderRequest AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left triggerTime AST#property_name#Right : AST#expression#Left reminderTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contactId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeReminders AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#expression#Right , AST#expression#Left config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveReminderConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Preparation reminder created, published ID: AST#template_substitution#Left $ { AST#expression#Left publishedId 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 reminderId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to create preparation reminder: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left error AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async createPreparationReminder(contact: Contact, reminderTime: Date, message: string): Promise<string> { try { const reminderId = this.generateReminderId(ReminderType.PREPARATION_REMINDER, contact.id); const reminderRequest: reminderAgentManager.ReminderRequestAlarm = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM, hour: reminderTime.getHours(), minute: reminderTime.getMinutes(), title: `📝 准备提醒`, content: message, expiredContent: '准备提醒已过期', notificationId: parseInt(reminderId.replace(/\D/g, ''), 10), slotType: reminderAgentManager.SlotType.SERVICE_INFORMATION }; const publishedId = await reminderAgentManager.publishReminder(reminderRequest); const config: ReminderConfig = { id: reminderId, type: ReminderType.PREPARATION_REMINDER, title: reminderRequest.title, content: reminderRequest.content, triggerTime: reminderTime, contactId: contact.id, enabled: true }; this.activeReminders.set(reminderId, config); await this.saveReminderConfig(config); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Preparation reminder created, published ID: ${publishedId}`); return reminderId; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed to create preparation reminder: ${error}`); throw error; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L228-L267
5ec26197ec77a5fe995bd7abc42bb3bb764fc38d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/FunctionalScenes.ets
arkts
FunctionalScenes
主页瀑布流列表
@Component export struct FunctionalScenes { @Link listData: SceneModuleInfo[]; dataSource: WaterFlowDataSource = new WaterFlowDataSource(this.listData); @State tabsIndex: number = 0; @State tabColumns: string = '1fr 1fr'; tabsController: TabsController = new TabsController(); private scrollController: Scroller = new Scroller(); isFoldable: boolean | undefined = AppStorage.get('isFoldable'); @Provide itemWidth: number = 0 aboutToAppear(): void { // 34为左右边距+两个瀑布流中间的距离 this.itemWidth = (AppStorage.get('windowsWidth') as number - 34) / 2 }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FunctionalScenes AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right listData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left dataSource : AST#type_annotation#Left AST#primary_type#Left WaterFlowDataSource 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 WaterFlowDataSource 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 . listData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tabsIndex : 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 AST#decorator#Left @ State AST#decorator#Right tabColumns : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '1fr 1fr' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left tabsController : AST#type_annotation#Left AST#primary_type#Left TabsController 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 TabsController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private scrollController : 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#property_declaration#Left isFoldable : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isFoldable' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right itemWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left AST#object_literal#Left { // 34为左右边距+两个瀑布流中间的距离 AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . itemWidth AST#member_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#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowsWidth' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right - AST#expression#Left 34 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#assignment_expression#Right AST#expression#Right AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct FunctionalScenes { @Link listData: SceneModuleInfo[]; dataSource: WaterFlowDataSource = new WaterFlowDataSource(this.listData); @State tabsIndex: number = 0; @State tabColumns: string = '1fr 1fr'; tabsController: TabsController = new TabsController(); private scrollController: Scroller = new Scroller(); isFoldable: boolean | undefined = AppStorage.get('isFoldable'); @Provide itemWidth: number = 0 aboutToAppear(): void { this.itemWidth = (AppStorage.get('windowsWidth') as number - 34) / 2 }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/FunctionalScenes.ets#L28-L42
8790474afca2995573f89bc3339f327420a1ae59
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/mine/mine.ets
arkts
获取账号头像
export function getAvatar(name:string) : string{ switch (name){ case '瘦成一道闪电': return '/image/mine/pho.png' default: return '/image/mine/head.png'; }
AST#export_declaration#Left export AST#function_declaration#Left function getAvatar AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string 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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left '瘦成一道闪电' AST#property_name#Right : AST#expression#Left return AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '/image/mine/pho.png' AST#expression#Right AST#expression_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 '/image/mine/head.png' AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getAvatar(name:string) : string{ switch (name){ case '瘦成一道闪电': return '/image/mine/pho.png' default: return '/image/mine/head.png'; }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/mine/mine.ets#L8-L14
1461231461cbc931cf6c466161d4d4ba6ed1cbc9
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
get_link
Link of this bookmark object. @returns The link if is a bookmark, empty string if is a folder.
get_link() { return this.link; }
AST#method_declaration#Left get_link AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . link AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
get_link() { return this.link; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L733-L735
b8e210d9bf426bbd9b075d2eea71178522f3e1fe
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
toDatabase
跳转到数据库示例页 @returns {void} 无返回值
static toDatabase(): void { navigateTo(DemoRoutes.Database); }
AST#method_declaration#Left static toDatabase 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 navigateTo ( AST#expression#Left AST#member_expression#Left AST#expression#Left DemoRoutes AST#expression#Right . Database AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static toDatabase(): void { navigateTo(DemoRoutes.Database); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L31-L33
0f0f22e26b9a85bed4a5390166088047c13705d8
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/anarchy/0.0.1/package/install.ets
arkts
应用规则18
constructor(x: number, y: number) { // 显式类型标注 this.x = x; this.y = y; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 . x AST#member_expression#Right = AST#expression#Left x 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 . y AST#member_expression#Right = AST#expression#Left y AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(x: number, y: number) { this.x = x; this.y = y; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/anarchy/0.0.1/package/install.ets#L14-L17
a70e676d7b131a133245a6e7833ef818b7cd74ba
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets
arkts
setCircleRadius
Sets the radius of the drawn circles. Default radius = 4f, Min = 1f @param radius
public setCircleRadius(radius: number): void { if (radius >= 1) { this.mCircleRadius = radius; } else { console.log('LineDataSet', 'Circle radius cannot be < 1'); } }
AST#method_declaration#Left public setCircleRadius AST#parameter_list#Left ( AST#parameter#Left radius : 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left radius AST#expression#Right >= AST#expression#Left 1 AST#expression#Right AST#binary_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 . mCircleRadius AST#member_expression#Right = AST#expression#Left radius AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'LineDataSet' AST#expression#Right , AST#expression#Left 'Circle radius cannot be < 1' 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 setCircleRadius(radius: number): void { if (radius >= 1) { this.mCircleRadius = radius; } else { console.log('LineDataSet', 'Circle radius cannot be < 1'); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L155-L161
a318bd3fc4dff45849cec4c5789cb4e89c263d2f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets
arkts
addHar1
[Start export_add_har1]
export { addHar1 } from './src/main/ets/utils/Calc';
AST#export_declaration#Left export { addHar1 } from './src/main/ets/utils/Calc' ; AST#export_declaration#Right
export { addHar1 } from './src/main/ets/utils/Calc';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets#L19-L19
1ae52014bff963fdf7b863d79193ba1e31df48f6
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/CommemorationDAO.ets
arkts
纪念日数据访问对象 负责纪念日表的所有CRUD操作
export class CommemorationDAO { private dbManager: DatabaseManager; constructor() { this.dbManager = DatabaseManager.getInstance(); } /** * 插入新纪念日 * @param commemoration 纪念日实体 * @returns 插入的记录ID */ async insertCommemoration(commemoration: CommemorationEntity): Promise<number> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const currentTime = new Date().toISOString(); const valueBucket: relationalStore.ValuesBucket = { contact_id: commemoration.contact_id, title: commemoration.title, commemoration_date: commemoration.commemoration_date, type: commemoration.type || '', is_lunar: commemoration.is_lunar ? 1 : 0, reminder_enabled: commemoration.reminder_enabled ? 1 : 0, reminder_days_advance: commemoration.reminder_days_advance, notes: commemoration.notes || '', created_at: currentTime, updated_at: currentTime }; const rowId = await rdbStore.insert('commemorations', valueBucket); console.info(`[CommemorationDAO] Commemoration inserted with ID: ${rowId}`); return rowId; } catch (error) { const err = error as Error; throw new Error(`Failed to insert commemoration: ${err.message}`); } } /** * 根据ID查询纪念日 * @param id 纪念日ID * @returns 纪念日实体或null */ async getCommemorationById(id: number): Promise<CommemorationEntity | null> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates('commemorations'); predicates.equalTo('id', id); const resultSet = await rdbStore.query(predicates); if (resultSet.goToFirstRow()) { const commemoration = this.mapResultSetToCommemoration(resultSet); resultSet.close(); return commemoration; } resultSet.close(); return null; } catch (error) { const err = error as Error; throw new Error(`Failed to get commemoration by ID: ${err.message}`); } } /** * 获取所有纪念日 * @returns 纪念日数组 */ async getAllCommemorations(): Promise<CommemorationEntity[]> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates('commemorations'); predicates.orderByAsc('commemoration_date'); const resultSet = await rdbStore.query(predicates); const commemorations: CommemorationEntity[] = []; if (resultSet.goToFirstRow()) { do { commemorations.push(this.mapResultSetToCommemoration(resultSet)); } while (resultSet.goToNextRow()); } resultSet.close(); return commemorations; } catch (error) { const err = error as Error; throw new Error(`Failed to get all commemorations: ${err.message}`); } }
AST#export_declaration#Left export AST#class_declaration#Left class CommemorationDAO AST#class_body#Left { AST#property_declaration#Left private dbManager : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbManager AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DatabaseManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * 插入新纪念日 * @param commemoration 纪念日实体 * @returns 插入的记录ID */ AST#method_declaration#Left async insertCommemoration AST#parameter_list#Left ( AST#parameter#Left commemoration : AST#type_annotation#Left AST#primary_type#Left CommemorationEntity 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rdbStore = 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 . dbManager AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left rdbStore AST#expression#Right AST#unary_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 'Database not initialized' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket 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 contact_id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . contact_id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . commemoration_date AST#member_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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . type AST#member_expression#Right 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 is_lunar AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . is_lunar AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_enabled AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . reminder_enabled AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . reminder_days_advance AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left commemoration AST#expression#Right . notes AST#member_expression#Right 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 created_at AST#property_name#Right : AST#expression#Left currentTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left currentTime AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rowId = 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 rdbStore AST#expression#Right AST#await_expression#Right AST#expression#Right . insert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'commemorations' AST#expression#Right , AST#expression#Left valueBucket AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [CommemorationDAO] Commemoration inserted with ID: AST#template_substitution#Left $ { AST#expression#Left rowId 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 rowId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to insert commemoration: 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#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 根据ID查询纪念日 * @param id 纪念日ID * @returns 纪念日实体或null */ AST#method_declaration#Left async getCommemorationById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CommemorationEntity AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rdbStore = 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 . dbManager AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left rdbStore AST#expression#Right AST#unary_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 'Database not initialized' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'commemorations' 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 predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right , AST#expression#Left id 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 resultSet = 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 rdbStore AST#expression#Right AST#await_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left commemoration = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mapResultSetToCommemoration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet 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 resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left commemoration 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to get commemoration by ID: 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#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取所有纪念日 * @returns 纪念日数组 */ AST#method_declaration#Left async getAllCommemorations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommemorationEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rdbStore = 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 . dbManager AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left rdbStore AST#expression#Right AST#unary_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 'Database not initialized' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'commemorations' 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 predicates AST#expression#Right . orderByAsc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'commemoration_date' 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 resultSet = 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 rdbStore AST#expression#Right AST#await_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right ) AST#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 commemorations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommemorationEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left do 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#object_literal#Left { AST#property_assignment#Left commemorations AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mapResultSetToCommemoration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#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 resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left commemorations AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left catch AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to get all commemorations: 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#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommemorationDAO { private dbManager: DatabaseManager; constructor() { this.dbManager = DatabaseManager.getInstance(); } async insertCommemoration(commemoration: CommemorationEntity): Promise<number> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const currentTime = new Date().toISOString(); const valueBucket: relationalStore.ValuesBucket = { contact_id: commemoration.contact_id, title: commemoration.title, commemoration_date: commemoration.commemoration_date, type: commemoration.type || '', is_lunar: commemoration.is_lunar ? 1 : 0, reminder_enabled: commemoration.reminder_enabled ? 1 : 0, reminder_days_advance: commemoration.reminder_days_advance, notes: commemoration.notes || '', created_at: currentTime, updated_at: currentTime }; const rowId = await rdbStore.insert('commemorations', valueBucket); console.info(`[CommemorationDAO] Commemoration inserted with ID: ${rowId}`); return rowId; } catch (error) { const err = error as Error; throw new Error(`Failed to insert commemoration: ${err.message}`); } } async getCommemorationById(id: number): Promise<CommemorationEntity | null> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates('commemorations'); predicates.equalTo('id', id); const resultSet = await rdbStore.query(predicates); if (resultSet.goToFirstRow()) { const commemoration = this.mapResultSetToCommemoration(resultSet); resultSet.close(); return commemoration; } resultSet.close(); return null; } catch (error) { const err = error as Error; throw new Error(`Failed to get commemoration by ID: ${err.message}`); } } async getAllCommemorations(): Promise<CommemorationEntity[]> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates('commemorations'); predicates.orderByAsc('commemoration_date'); const resultSet = await rdbStore.query(predicates); const commemorations: CommemorationEntity[] = []; if (resultSet.goToFirstRow()) { do { commemorations.push(this.mapResultSetToCommemoration(resultSet)); } while (resultSet.goToNextRow()); } resultSet.close(); return commemorations; } catch (error) { const err = error as Error; throw new Error(`Failed to get all commemorations: ${err.message}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/CommemorationDAO.ets#L42-L144
31e2af5b50909be127ea58cd4322929cfa44890e
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
分页信息
export interface PageInfo { total: string; current: string; hitCount: boolean; size: string; optimizeCountSql: boolean; records: MessageItem[]; //orders: any[]; // 文档中未定义具体结构 isSearchCount: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PageInfo AST#object_type#Left { AST#type_member#Left total : 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 current : 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 hitCount : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left size : 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 optimizeCountSql : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left records : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MessageItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //orders: any[]; // 文档中未定义具体结构 AST#type_member#Left isSearchCount : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PageInfo { total: string; current: string; hitCount: boolean; size: string; optimizeCountSql: boolean; records: MessageItem[]; isSearchCount: boolean; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L154-L163
d7039bbcdefc3f0f957c1f2d4a3287058666452a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets
arkts
将十六进制颜色字符串转换为 RGB 对象。 @param {string} hex - 十六进制颜色字符串,可以以 "#" 开头或不带 "#"。 @returns {RgbType | null} - 返回一个 RgbType 对象,如果输入无效则返回 null。
export function hexToRgb(hex: string): RgbType | null { // 使用正则表达式匹配十六进制颜色字符串 const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (result) { // 将匹配的十六进制值转换为十进制 RGB 值 return { red: parseInt(result[1], 16), green: parseInt(result[2], 16), blue: parseInt(result[3], 16) } } else { // 如果输入无效,返回 null return null; } }
AST#export_declaration#Left export AST#function_declaration#Left function hexToRgb AST#parameter_list#Left ( AST#parameter#Left hex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RgbType 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#variable_declaration#Left const AST#variable_declarator#Left result = AST#ERROR#Left / ^ # ? AST#ERROR#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#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left f AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left \d AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 2 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left f AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left \d AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right { AST#property_name#Left 2 AST#property_name#Right } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left f AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left \d AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right { AST#property_name#Left 2 AST#property_name#Right } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left $ AST#ERROR#Right / AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right . exec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hex 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 result AST#expression#Right ) AST#block_statement#Left { // 将匹配的十六进制值转换为十进制 RGB 值 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left red AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left 16 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 green AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left 16 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 blue AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 如果输入无效,返回 null AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function hexToRgb(hex: string): RgbType | null { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (result) { return { red: parseInt(result[1], 16), green: parseInt(result[2], 16), blue: parseInt(result[3], 16) } } else { return null; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L129-L143
63fb7c298c6da373961aad1dcae2842fa18349e2
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/FileUtils.ets
arkts
getInstance
单例实现FileUtils类
public static getInstance(): FileUtils { if (!FileUtils.sInstance) { FileUtils.sInstance = new FileUtils(); } return FileUtils.sInstance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FileUtils AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left FileUtils AST#expression#Right AST#unary_expression#Right AST#expression#Right . sInstance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . sInstance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left FileUtils AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . sInstance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static getInstance(): FileUtils { if (!FileUtils.sInstance) { FileUtils.sInstance = new FileUtils(); } return FileUtils.sInstance; }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L30-L35
fde18926caac47c7dd630605253259f9fd3c32a0
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
needsOffset
Returns true if this axis needs horizontal offset, false if no offset is needed. @return
public needsOffset(): boolean { if (super.isEnabled() && super.isDrawLabelsEnabled() && this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART) return true; else return false; }
AST#method_declaration#Left public needsOffset 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . isEnabled 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 super AST#expression#Right AST#binary_expression#Right AST#expression#Right . isDrawLabelsEnabled 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 . getLabelPosition 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 YAxisLabelPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . OUTSIDE_CHART AST#member_expression#Right AST#expression#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 else AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public needsOffset(): boolean { if (super.isEnabled() && super.isDrawLabelsEnabled() && this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART) return true; else return false; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L452-L457
fca5abb2e16ec37e187f4214c4d944337b0fd295
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/pages/RegisterPage.ets
arkts
validateContact
验证联系方式
private validateContact(): boolean { if (this.contactType === 'phone') { // 简单的手机号验证 const phoneRegex = /^(\+86)?1[3-9]\d{9}$/ // 允许带+86 if (!phoneRegex.test(this.contactValue)) { this.showMessage('请输入正确的手机号码', 'error') return false } } else { // 简单的邮箱验证 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ if (!emailRegex.test(this.contactValue)) { this.showMessage('请输入正确的邮箱地址', 'error') return false } } return true } // 发送验证码 private async sendVerificationCode() { if (!this.validateContact()) { return } this.isSendingCode = true try { // 在实际应用中,这里应该调用后端API发送验证码 // 这里只是模拟API调用 // 模拟API延迟 await new Promise<void>(resolve => setTimeout(resolve, 1000)) const simulatedCode = '6666' // 模拟验证码 console.log(`模拟发送验证码: ${simulatedCode}`) // 输出验证码到控制台 // 开始倒计时 this.codeSent = true this.countdown = 60 this.countdownTimer = setInterval(() => { if (this.countdown > 1) { this.countdown-- } else { clearInterval(this.countdownTimer) this.countdownTimer = -1 this.codeSent = false } }, 1000) this.showMessage(`验证码已发送至${this.contactType === 'phone' ? '手机' : '邮箱'}`, 'success') console.log("验证码发送成功") } catch (error) { this.showMessage('验证码发送失败,请重试', 'error') console.error('发送验证码失败:', JSON.stringify(error)) }
AST#method_declaration#Left private validateContact 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#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 . contactType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'phone' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 简单的手机号验证 AST#ERROR#Left const phoneRegex = AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \ AST#ERROR#Right AST#expression#Left AST#unary_expression#Left + AST#expression#Left 86 AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#ERROR#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 3 AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right \d { AST#property_name#Left 9 AST#property_name#Right } AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#state_binding_expression#Left $ AST#state_binding_expression#Right AST#expression#Right / // 允许带+86 AST#expression#Left if AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left phoneRegex AST#expression#Right AST#unary_expression#Right AST#expression#Right . test 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 . contactValue 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#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . showMessage 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 return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right } } else { // 简单的邮箱验证 AST#property_name#Left const AST#property_name#Right emailRegex = / ^ [ ^ \s @ ] AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left + AST#ERROR#Left @ AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s @ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right + AST#ERROR#Left \ . AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s @ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#state_binding_expression#Left $ AST#state_binding_expression#Right AST#expression#Right / AST#expression#Left if AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left emailRegex AST#expression#Right AST#unary_expression#Right AST#expression#Right . test 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 . contactValue 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#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . showMessage 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 return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right } } return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right } // 发送验证码 private async AST#ERROR#Left sendVerificationCode AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right { AST#property_name#Left if AST#property_name#Right ( AST#expression#Left AST#call_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 . validateContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left return AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . isSendingCode AST#member_expression#Right = AST#ERROR#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right try { // 在实际应用中,这里应该调用后端API发送验证码 // 这里只是模拟API调用 // 模拟API延迟 AST#property_name#Left await AST#property_name#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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 1000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left simulatedCode = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left '6666' AST#expression#Right // 模拟验证码 AST#ERROR#Left console AST#ERROR#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 simulatedCode 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#ERROR#Left this AST#ERROR#Right . codeSent AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . countdown AST#member_expression#Right = AST#expression#Left 60 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . countdownTimer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#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 . countdown AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdown AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdownTimer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdownTimer 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#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 . codeSent 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#expression#Left 1000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . showMessage 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contactType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'phone' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '手机' AST#expression#Right : AST#expression#Left '邮箱' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left 'success' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . log 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#assignment_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left catch 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . showMessage 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private validateContact(): boolean { if (this.contactType === 'phone') { const phoneRegex = /^(\+86)?1[3-9]\d{9}$/ if (!phoneRegex.test(this.contactValue)) { this.showMessage('请输入正确的手机号码', 'error') return false } } else { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ if (!emailRegex.test(this.contactValue)) { this.showMessage('请输入正确的邮箱地址', 'error') return false } } return true } private async sendVerificationCode() { if (!this.validateContact()) { return } this.isSendingCode = true try { await new Promise<void>(resolve => setTimeout(resolve, 1000)) const simulatedCode = '6666' console.log(`模拟发送验证码: ${simulatedCode}`) this.codeSent = true this.countdown = 60 this.countdownTimer = setInterval(() => { if (this.countdown > 1) { this.countdown-- } else { clearInterval(this.countdownTimer) this.countdownTimer = -1 this.codeSent = false } }, 1000) this.showMessage(`验证码已发送至${this.contactType === 'phone' ? '手机' : '邮箱'}`, 'success') console.log("验证码发送成功") } catch (error) { this.showMessage('验证码发送失败,请重试', 'error') console.error('发送验证码失败:', JSON.stringify(error)) }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/RegisterPage.ets#L73-L128
751b2c3411dba2b1d44fa05255102de404570016
github
xsdkhlgz/ATSOBJECT_OF_FIRST.git
8c14e875d7ec3f418bb7cdaae123a8fea87a7e76
entry/src/main/ets/model/ItemModel.ets
arkts
list
提供接口,查询全部的食物清单或者运动清单
list(isFood: boolean = true): RecordItem[]{ return isFood ? foods : workouts } //按类型查询 listItemGroupByCategory(isFood: boolean = true){ // 1.判断要处理的是食物还是运动 let categories = isFood ? FoodCategories:WorkoutCategories let items = isFood ? foods:workouts // 2.创建空的分组 let groups = categories.map(itemCategory => new GroupInfo(itemCategory,[])) // 3.遍历记录项列表,将食物添加到对应的分组 items.forEach(item =>groups[item.categoryId].items.push(item)) // 4.返回结果 return groups }
AST#method_declaration#Left list AST#parameter_list#Left ( AST#parameter#Left isFood : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RecordItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#ERROR#Left return AST#expression#Left isFood AST#expression#Right ? foods AST#ERROR#Left : AST#ERROR#Left workouts } //按类型查询 listItemGroupByCategory AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left isFood : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right { // 1.判断要处理的是食物还是运动 let categories AST#ERROR#Right = AST#expression#Left isFood AST#expression#Right ? FoodCategories : WorkoutCategories let items = AST#expression#Left isFood AST#expression#Right ? foods : workouts AST#ERROR#Right // 2.创建空的分组 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left groups = 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 categories AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left itemCategory => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GroupInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemCategory AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // 3.遍历记录项列表,将食物添加到对应的分组 AST#ERROR#Left items AST#ERROR#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => 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#subscript_expression#Left AST#expression#Left groups AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . categoryId AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . items AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 4.返回结果 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left groups AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
list(isFood: boolean = true): RecordItem[]{ return isFood ? foods : workouts } listItemGroupByCategory(isFood: boolean = true){ let categories = isFood ? FoodCategories:WorkoutCategories let items = isFood ? foods:workouts let groups = categories.map(itemCategory => new GroupInfo(itemCategory,[])) items.forEach(item =>groups[item.categoryId].items.push(item)) return groups }
https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/ItemModel.ets#L60-L75
516746815a510cb09afe48814640b985a7c16dbf
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets
arkts
[Start sourcecode_router_module]
export class RouterModule { // [StartExclude sourcecode_router_module] // WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储 static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>(); // [EndExclude sourcecode_router_module] // 初始化路由栈,需要关联Navigation组件 static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); // 通过名称注册路由栈 public static createRouter(routerName: string, router: NavPathStack): void { RouterModule.routerMap.set(routerName, router); } // 通过名称获取路由栈 public static getRouter(routerName: string): NavPathStack { return RouterModule.routerMap.get(routerName) as NavPathStack; } // 通过传入RouterModule跳转到指定页面组件,RouterModule中需要增加routerName字段用于获取路由栈 public static async push(router: RouterModel): Promise<void> { const harName = router.builderName.split('_')[0]; await import(harName).then((ns: ESObject): Promise<void> => ns.harInit(router.builderName)); RouterModule.getRouter(router.routerName).pushPath({ name: router.builderName, param: router.param }); } // [StartExclude sourcecode_router_module] // 注册页面组件到路由表,builderName是路由名字,builder参数是包裹了页面组件的WrappedBuilder对象 public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void { RouterModule.builderMap.set(builderName, builder); } // 获取路由表中指定的页面组件 public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = RouterModule.builderMap.get(builderName); if (!builder) { Logger.info('not found builder ' + builderName); } return builder as WrappedBuilder<[object]>; } // 通过路由栈名routerName获取对应的NavPathStack对象,并使用该对象的pop方法实现返回上个路由 public static pop(routerName: string): void { RouterModule.getRouter(routerName).pop(); } // 获取页面栈并清空 public static clear(routerName: string): void { RouterModule.getRouter(routerName).clear(); } // 直接跳转到指定路由 public static popToName(routerName: string, builderName: string): void { RouterModule.getRouter(routerName).popToName(builderName); } // [EndExclude sourcecode_router_module] }
AST#export_declaration#Left export AST#class_declaration#Left class RouterModule AST#class_body#Left { // [StartExclude sourcecode_router_module] // WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储 AST#property_declaration#Left static builderMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // [EndExclude sourcecode_router_module] // 初始化路由栈,需要关联Navigation组件 AST#property_declaration#Left static routerMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#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 NavPathStack 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#property_declaration#Right // 通过名称注册路由栈 AST#method_declaration#Left public static createRouter AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left router : AST#type_annotation#Left AST#primary_type#Left NavPathStack 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 RouterModule AST#expression#Right . routerMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right , AST#expression#Left router 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#method_declaration#Left public static getRouter AST#parameter_list#Left ( AST#parameter#Left routerName : 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 NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . routerMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 通过传入RouterModule跳转到指定页面组件,RouterModule中需要增加routerName字段用于获取路由栈 AST#method_declaration#Left public static async push AST#parameter_list#Left ( AST#parameter#Left router : AST#type_annotation#Left AST#primary_type#Left RouterModel 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 harName = AST#expression#Left AST#subscript_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 router AST#expression#Right . builderName AST#member_expression#Right AST#expression#Right . split 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#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 AST#import_expression#Left import ( AST#expression#Left harName AST#expression#Right ) AST#import_expression#Right AST#expression#Right AST#await_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 ns : AST#type_annotation#Left AST#primary_type#Left ESObject 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ns AST#expression#Right . harInit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . builderName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . routerName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pushPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . builderName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left param AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . param 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // [StartExclude sourcecode_router_module] // 注册页面组件到路由表,builderName是路由名字,builder参数是包裹了页面组件的WrappedBuilder对象 AST#method_declaration#Left public static registerBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 RouterModule AST#expression#Right . builderMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName AST#expression#Right , AST#expression#Left builder 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#method_declaration#Left public static getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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 WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left builder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . builderMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left builder AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'not found builder ' AST#expression#Right + AST#expression#Left builderName 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left builder AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 通过路由栈名routerName获取对应的NavPathStack对象,并使用该对象的pop方法实现返回上个路由 AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 获取页面栈并清空 AST#method_declaration#Left public static clear AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 直接跳转到指定路由 AST#method_declaration#Left public static popToName AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . popToName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName 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 // [EndExclude sourcecode_router_module] } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class RouterModule { static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>(); static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); public static createRouter(routerName: string, router: NavPathStack): void { RouterModule.routerMap.set(routerName, router); } public static getRouter(routerName: string): NavPathStack { return RouterModule.routerMap.get(routerName) as NavPathStack; } public static async push(router: RouterModel): Promise<void> { const harName = router.builderName.split('_')[0]; await import(harName).then((ns: ESObject): Promise<void> => ns.harInit(router.builderName)); RouterModule.getRouter(router.routerName).pushPath({ name: router.builderName, param: router.param }); } public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void { RouterModule.builderMap.set(builderName, builder); } public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = RouterModule.builderMap.get(builderName); if (!builder) { Logger.info('not found builder ' + builderName); } return builder as WrappedBuilder<[object]>; } public static pop(routerName: string): void { RouterModule.getRouter(routerName).pop(); } public static clear(routerName: string): void { RouterModule.getRouter(routerName).clear(); } public static popToName(routerName: string, builderName: string): void { RouterModule.getRouter(routerName).popToName(builderName); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L20-L76
53021295829f6034221dcde3142e909e438e94fb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
initializePage
初始化页面
private async initializePage(): Promise<void> { try { this.loading = true; // 加载联系人信息 this.contact = await this.contactService.getContactById(this.contactId); if (!this.contact) { throw new Error('联系人不存在'); } // 如果指定了祝福语ID,加载祝福语 if (this.greetingId) { this.selectedGreeting = await this.greetingService.getGreetingById(this.greetingId); if (this.selectedGreeting) { this.customContent = this.selectedGreeting.content; this.selectedStyle = this.selectedGreeting.style; this.selectedOccasion = this.selectedGreeting.occasion; } } // 根据联系人生日情况设置默认场合 if (this.contact.birthday.daysUntilBirthday === 0) { this.selectedOccasion = GreetingOccasion.BIRTHDAY; } // 生成AI祝福语建议 await this.generateAISuggestions(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize page: ${error}`); } finally { this.loading = false; } }
AST#method_declaration#Left private async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loading 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 . contact 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 . contactService AST#member_expression#Right AST#expression#Right . getContactById 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 . contactId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 . contact AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '联系人不存在' AST#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 // 如果指定了祝福语ID,加载祝福语 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . greetingId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreeting 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 . greetingService AST#member_expression#Right AST#expression#Right . getGreetingById 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 . greetingId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreeting AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreeting AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreeting AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedOccasion AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreeting AST#member_expression#Right AST#expression#Right . occasion AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 根据联系人生日情况设置默认场合 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . daysUntilBirthday AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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 . selectedOccasion AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . BIRTHDAY 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 // 生成AI祝福语建议 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . generateAISuggestions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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 initialize page: 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#finally_clause#Left finally 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 . loading 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async initializePage(): Promise<void> { try { this.loading = true; this.contact = await this.contactService.getContactById(this.contactId); if (!this.contact) { throw new Error('联系人不存在'); } if (this.greetingId) { this.selectedGreeting = await this.greetingService.getGreetingById(this.greetingId); if (this.selectedGreeting) { this.customContent = this.selectedGreeting.content; this.selectedStyle = this.selectedGreeting.style; this.selectedOccasion = this.selectedGreeting.occasion; } } if (this.contact.birthday.daysUntilBirthday === 0) { this.selectedOccasion = GreetingOccasion.BIRTHDAY; } await this.generateAISuggestions(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize page: ${error}`); } finally { this.loading = false; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L61-L95
8ca6c77eaa7295fe5ce173e60ca51cb2cd88e666
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/model/Table.ets
arkts
关系型数据库数据表。
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/Table.ets#L4-L4
e6d4dddb295718d027db3923b56d5469d30616ab
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets
arkts
[Start test] somePackage.ets
export class Test { foo(){} }
AST#export_declaration#Left export AST#class_declaration#Left class Test AST#class_body#Left { AST#method_declaration#Left foo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Test { foo(){} }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets#L22-L24
3ea29be50ecefc456a374286f6328a5bbbdf23a6
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment1.ets
arkts
example
[Start Custom_Components]
@Component export struct example { build() { Column(){ Text('Custom Component Sample Code') // ... } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct example AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Custom Component Sample Code' 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#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 example { build() { Column(){ Text('Custom Component Sample Code') } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment1.ets#L2-L10
30a71e3a26fed74d603a0ee6b9c610ede9c367a5
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookHistoryType.ets
arkts
@author 2008 @datetime 2024/7/24 22:03 @className: BookGroupType
export interface BookHistoryTypeParams { //类型 0 小说;1 漫画;2 有声书; type?: number, //排序 sort?: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface BookHistoryTypeParams AST#object_type#Left { //类型 0 小说;1 漫画;2 有声书; AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , //排序 AST#type_member#Left sort ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface BookHistoryTypeParams { type?: number, sort?: number }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookHistoryType.ets#L6-L11
27c27842fcabe9ad944522e53635ee6353f1fb1c
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/LocalStoragePage.ets
arkts
ActionSection
操作区域 @returns {void} 无返回值
@Builder private ActionSection(): void { IBestButton({ text: $r("app.string.demo_local_storage_action_save"), round: true, type: "primary", buttonSize: "normal", btnWidth: P100, onBtnClick: (): void => { void this.vm.saveAccount(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_local_storage_action_load"), round: true, buttonSize: "normal", btnWidth: P100, onBtnClick: (): void => { void this.vm.loadAccount(); } }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ActionSection 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 IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_local_storage_action_save" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "primary" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonSize : AST#expression#Left "normal" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . saveAccount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalLarge ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_local_storage_action_load" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonSize : AST#expression#Left "normal" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . loadAccount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private ActionSection(): void { IBestButton({ text: $r("app.string.demo_local_storage_action_save"), round: true, type: "primary", buttonSize: "normal", btnWidth: P100, onBtnClick: (): void => { void this.vm.saveAccount(); } }); SpaceVerticalLarge(); IBestButton({ text: $r("app.string.demo_local_storage_action_load"), round: true, buttonSize: "normal", btnWidth: P100, onBtnClick: (): void => { void this.vm.loadAccount(); } }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/LocalStoragePage.ets#L72-L96
d2030aed7f278b70035f8c68ca41e1353b875e12
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
getAesEncryptProperties
AES加密密钥属性信息
function getAesEncryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PADDING, value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, value: huks.HuksCipherMode.HUKS_MODE_CBC }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_IV, value: stringToUint8Array(IV) }; return; }
AST#function_declaration#Left function getAesEncryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_ALGORITHM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyAlg AST#member_expression#Right AST#expression#Right . HUKS_ALG_AES AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_KEY_SIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeySize AST#member_expression#Right AST#expression#Right . HUKS_AES_KEY_SIZE_128 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_PURPOSE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyPurpose AST#member_expression#Right AST#expression#Right . HUKS_KEY_PURPOSE_ENCRYPT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyPadding AST#member_expression#Right AST#expression#Right . HUKS_PADDING_PKCS7 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_BLOCK_MODE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksCipherMode AST#member_expression#Right AST#expression#Right . HUKS_MODE_CBC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 properties AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_IV AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left stringToUint8Array AST#expression#Right AST#argument_list#Left ( AST#expression#Left IV 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_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#function_declaration#Right
function getAesEncryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PADDING, value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, value: huks.HuksCipherMode.HUKS_MODE_CBC }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_IV, value: stringToUint8Array(IV) }; return; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L136-L163
a824bb886f76411e00f356fcba54ed07c8de08ba
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
TODO 通知工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class NotificationUtil { private static defaultConfig: NotificationConfig = new NotificationConfig(); //默认配置 /** * 设置通知的默认统一配置 * @param configs */ static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtil.defaultConfig); } /** * 查询通知是否授权 */ static async isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); //查询通知是否授权。 } /** * 查询通知是否授权 */ static isNotificationEnabledSync(): boolean { return notificationManager.isNotificationEnabledSync(); //查询通知是否授权。 } /** * 应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。 * @param context * @returns */ static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) } /** * 拉起应用的通知设置界面,该页面以半模态形式呈现,可用于设置通知开关、通知提醒方式等。使用Promise异步回调。 * @param context * @returns */ static async openNotificationSettings(context: common.UIAbilityContext = AppUtil.getContext()): Promise<void> { if (AppUtil.isApiSupported(13)) { return await notificationManager.openNotificationSettings(context); } else { //兜底 return await WantUtil.toNotificationSetting(); } } /** * 请求通知授权,第一次调用会弹窗让用户选择。 * @returns */ static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtil.isNotificationEnabled(); if (!isEnabled) { //未授权,拉起授权 try { await notificationManager.requestEnableNotification(AppUtil.getContext()); isEnabled = await NotificationUtil.isNotificationEnabled(); callBack?.(isEnabled); return isEnabled; } catch (e) { isEnabled = await NotificationUtil.isNotificationEnabled(); callBack?.(isEnabled); return isEnabled; } } else { callBack?.(true); return true; } } /** * 查询模板是否存在,目前仅支持进度条模板。 * @param templateName 模板名称。当前仅支持'downloadTemplate'。 * @returns */ static async isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> { return notificationManager.isSupportTemplate(templateName); } /** * 查询设备是否支持分布式通知 * @returns */ static async isDistributedEnabled(): Promise<boolean> { return notificationManager.isDistributedEnabled() } /** * 发布普通文本通知 * @param options 通知实体 * @returns */ static async publishBasic(options: NotificationBasicOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { basicContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { basicContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); //发送通知 return notificationId } /** * 发布长文本通知 * @param options 通知实体 * @returns */ static async publishLongText(options: NotificationLongTextOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const longTextContent: notificationManager.NotificationLongTextContent = { title: options.title, text: options.text, briefText: options.briefText, longText: options.longText, expandedTitle: options.expandedTitle } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { longTextContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { longTextContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, longText: longTextContent } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); //发送通知 return notificationId; } /** * 发布多文本通知 * @param options 通知实体 * @returns */ static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const multiLineContent: notificationManager.NotificationMultiLineContent = { title: options.title, text: options.text, briefText: options.briefText, longTitle: options.longTitle, lines: options.lines } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { multiLineContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { multiLineContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, multiLine: multiLineContent } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); //发送通知 return notificationId; } /** * 发布带有图片的通知 * @param options 通知实体 * @returns */ static async publishPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const pictureContent: notificationManager.NotificationPictureContent = { title: options.title, text: options.text, briefText: options.briefText, expandedTitle: options.expandedTitle, picture: options.picture } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { pictureContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { pictureContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, picture: pictureContent } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); //发送通知 return notificationId; } /** * 发布模板的通知 * @param options */ static async publishTemplate(options: NotificationTemplateOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { basicContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { basicContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent } //模板对象 let template: notificationManager.NotificationTemplate = { name: 'downloadTemplate', data: { title: options.title, fileName: options.fileName, progressValue: options.progressValue } } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent, template); await notificationManager.publish(notificationRequest); //发送通知 return notificationId; } /** * 取消通知,通过通知ID和通知标签取消已发布的通知,若label为空表示取消与指定通知ID相匹配的已发布通知。 * @param id 通知id * @param label 通知标签,默认为空。 * @returns */ static async cancel(id: number, label?: string): Promise<void> { return notificationManager.cancel(id, label); } /** * 取消本应用指定组下的通知 * @param groupName 通知组名称,此名称需要在发布通知时通过NotificationRequest对象指定。 * @returns */ static async cancelGroup(groupName: string): Promise<void> { return notificationManager.cancelGroup(groupName); } /** * 取消所有通知,取消当前应用所有已发布的通知。 * @returns */ static async cancelAll(): Promise<void> { return notificationManager.cancelAll() } /** * 设置桌面角标个数,在应用的桌面图标上呈现。 */ static async setBadge(badgeNumber: number): Promise<void> { return notificationManager.setBadgeNumber(badgeNumber); } /** * 清空桌面角标,在应用的桌面图标上呈现。 */ static async clearBadge(): Promise<void> { return notificationManager.setBadgeNumber(0); } /** * 获取当前应用未删除的通知数量。 */ static async getActiveNotificationCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); } /** * 设置桌面角标数量,来自于通知数量。 */ static async setBadgeFromNotificationCount(): Promise<void> { let count = await NotificationUtil.getActiveNotificationCount(); return notificationManager.setBadgeNumber(count); //设置角标 } /** * 获取当前应用未删除的通知列表。 */ static async getActiveNotifications(): Promise<Array<notificationManager.NotificationRequest>> { return notificationManager.getActiveNotifications(); } /** * 创建指定类型的通知渠道。 * @param type 要创建的通知渠道的类型 */ static async addSlot(type: notificationManager.SlotType) { return notificationManager.addSlot(type); } /** * 获取一个指定类型的通知渠道。 * @param type 要创建的通知渠道的类型 */ static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> { return notificationManager.getSlot(type); } /** * 获取此应用程序的所有通知渠道 * @returns */ static async getSlots(): Promise<Array<notificationManager.NotificationSlot>> { return notificationManager.getSlots(); } /** * 删除此应用程序指定类型的通知渠道 * @param type 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 * @returns */ static async removeSlot(type: notificationManager.SlotType) { return notificationManager.removeSlot(type); } /** * 删除此应用程序所有通知渠道 * @returns */ static async removeAllSlots() { return notificationManager.removeAllSlots(); } /** * 生成通知id(用时间戳当id) * @returns */ static generateNotificationId(): number { return systemDateTime.getTime(true); } /** * 获取压缩通知的图片(图像像素的总字节数不能超过2MB) * @param pixelMap:原始待压缩图片的PixelMap对象 * @returns 返回压缩后的图片数据 */ static async getCompressedPicture(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 2 * 1024 * 1024; //通知的图片内容(图像像素的总字节数不能超过2MB)。 let pixelBytes = pixelMap.getPixelBytesNumber(); //图像像素的总字节数 while (pixelBytes > pictureMaxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); //缩放 pixelBytes = pixelMap.getPixelBytesNumber(); //图像像素的总字节数 } return pixelMap; } /** * 获取压缩通知图标(图标像素的总字节数不超过192KB) * @param pixelMap:原始待压缩图片的PixelMap对象 * @returns */ static async getCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 192 * 1024; //通知图标(图标像素的总字节数不超过192KB)。 let pixelBytes = pixelMap.getPixelBytesNumber(); //图像像素的总字节数 while (pixelBytes > pictureMaxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); //缩放 pixelBytes = pixelMap.getPixelBytesNumber(); //图像像素的总字节数 } return pixelMap; } /** * 创建一个可拉起Ability的Want * @returns */ static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> { const context = AppUtil.getContext(); //获取当前上下文对象 const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { deviceId: '', bundleName: context.abilityInfo.bundleName, moduleName: context.abilityInfo.moduleName, abilityName: context.abilityInfo.name, action: 'action_notice', entities: [], uri: uri, } ], actionType: wantAgent.OperationType.START_ABILITY | wantAgent.OperationType.SEND_COMMON_EVENT, requestCode: 0, actionFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG] }; return wantAgent.getWantAgent(wantAgentInfo); } /** * 构建NotificationRequest对象 * @param notificationId 通知ID * @param options 描述通知的请求参数 * @param content 通知内容 * @param template 模板 * @returns */ private static getNotificationRequest(notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest { const request: notificationManager.NotificationRequest = { content: content }; request.id = notificationId; //通知ID。 if (template) { request.template = template; //模板 } if (options.notificationSlotType || NotificationUtil.defaultConfig.notificationSlotType) { request.notificationSlotType = options.notificationSlotType ?? NotificationUtil.defaultConfig.notificationSlotType; //通道类型。 } if (options.deliveryTime || NotificationUtil.defaultConfig.deliveryTime) { request.deliveryTime = options.deliveryTime ?? NotificationUtil.defaultConfig.deliveryTime; //通知发送时间。 } request.showDeliveryTime = options.showDeliveryTime ?? NotificationUtil.defaultConfig.showDeliveryTime; //是否显示分发时间。 request.tapDismissed = options.tapDismissed ?? NotificationUtil.defaultConfig.tapDismissed; //通知是否自动清除。 if (options.autoDeletedTime || NotificationUtil.defaultConfig.autoDeletedTime) { request.autoDeletedTime = options.autoDeletedTime ?? NotificationUtil.defaultConfig.autoDeletedTime; //自动清除的时间。 } request.isAlertOnce = options.isAlertOnce ?? NotificationUtil.defaultConfig.isAlertOnce; //设置是否仅有一次此通知提醒。 request.isStopwatch = options.isStopwatch ?? NotificationUtil.defaultConfig.isStopwatch; //是否显示已用时间。 request.isCountDown = options.isCountDown ?? NotificationUtil.defaultConfig.isCountDown; //是否显示倒计时时间。 request.isFloatingIcon = options.isFloatingIcon ?? NotificationUtil.defaultConfig.isFloatingIcon; //是否显示状态栏图标。 if (options.label || NotificationUtil.defaultConfig.label) { request.label = options.label ?? NotificationUtil.defaultConfig.label; //通知标签。 } if (options.actionButtons || NotificationUtil.defaultConfig.actionButtons) { request.actionButtons = options.actionButtons ?? NotificationUtil.defaultConfig.actionButtons; //通知按钮,最多三个按钮。 } if (options.smallIcon || NotificationUtil.defaultConfig.smallIcon) { request.smallIcon = options.smallIcon ?? NotificationUtil.defaultConfig.smallIcon; //通知小图标。可选字段,图像像素的总字节数不超过100KB。实际显示效果依赖于设备能力和通知中心UI样式。 } if (options.largeIcon || NotificationUtil.defaultConfig.largeIcon) { request.largeIcon = options.largeIcon ?? NotificationUtil.defaultConfig.largeIcon; //通知大图标。可选字段,图像像素的总字节数不超过100KB。实际显示效果依赖于设备能力和通知中心UI样式。 } if (options.groupName || NotificationUtil.defaultConfig.groupName) { request.groupName = options.groupName ?? NotificationUtil.defaultConfig.groupName; //组通知名称。 } if (options.template || NotificationUtil.defaultConfig.template) { request.template = options.template ?? NotificationUtil.defaultConfig.template; //通知模板。 } if (options.distributedOption || NotificationUtil.defaultConfig.distributedOption) { request.distributedOption = options.distributedOption ?? NotificationUtil.defaultConfig.distributedOption; //分布式通知的选项。 } if (options.appMessageId || NotificationUtil.defaultConfig.appMessageId) { request.appMessageId = options.appMessageId ?? NotificationUtil.defaultConfig.appMessageId; //应用发送通知携带的唯一标识字段, 用于通知去重。如果同一应用通过本地和云端等不同途径发布携带相同appMessageId的通知,设备只展示一条消息,之后收到的重复通知会被静默去重,不展示、不提醒。去重标识仅在通知发布的24小时内有效,超过24小时或者设备重启失效。。 } if (options.sound || NotificationUtil.defaultConfig.sound) { request.sound = options.sound ?? NotificationUtil.defaultConfig.sound; //应用通知自定义铃声,需要通过Push云侧获取自定义发送铃声权限后,该字段才会生效。 } if (options.badgeNumber || NotificationUtil.defaultConfig.badgeNumber) { request.badgeNumber = options.badgeNumber ?? NotificationUtil.defaultConfig.badgeNumber; //应用程序图标上显示的通知数。 } if (options.extraInfo || NotificationUtil.defaultConfig.extraInfo) { request.extraInfo = options.extraInfo ?? NotificationUtil.defaultConfig.extraInfo; //扩展参数。 } if (options.wantAgent || NotificationUtil.defaultConfig.wantAgent) { request.wantAgent = options.wantAgent ?? NotificationUtil.defaultConfig.wantAgent; //WantAgent封装了应用的行为意图,点击通知时触发该行为。 } if (options.removalWantAgent || NotificationUtil.defaultConfig.removalWantAgent) { request.removalWantAgent = options.removalWantAgent ?? NotificationUtil.defaultConfig.removalWantAgent; //当移除通知时,通知将被重定向到的WantAgent实例。 } return request; } /** * 获取错误msg * @param code * @param defaultMsg */ public static getErrorMsg(code: number, defaultMsg: string) { if (201 == code) { return '权限校验失败!' } else if (202 == code) { return '系统API权限校验失败!' } else if (401 == code) { return '参数检查失败!' } else if (801 == code) { return '该设备不支持此API!' } else if (1600001 == code) { return '应用通知,内部错误!' } else if (1600002 == code) { return '序列化或反序列化错误!' } else if (1600003 == code) { return '应用连接通知服务失败!' } else if (1600004 == code) { return '请开启应用通知开关!' } else if (1600005 == code) { return '通知渠道关闭!' } else if (1600006 == code) { return '通知删除失败!' } else if (1600007 == code) { return '通知不存在!' } else if (1600008 == code) { return '用户不存在!' } else if (1600009 == code) { return '通知发布频度超过限制!' } else if (1600010 == code) { return '分布式操作失败!' } else if (1600011 == code) { return '读模板配置文件错误!' } else if (1600012 == code) { return '内存空间不够!' } else if (17700001 == code) { return '包名不存在!' } else { return defaultMsg } } }
AST#export_declaration#Left export AST#class_declaration#Left class NotificationUtil AST#class_body#Left { AST#property_declaration#Left private static defaultConfig : AST#type_annotation#Left AST#primary_type#Left NotificationConfig 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 NotificationConfig 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 //默认配置 /** * 设置通知的默认统一配置 * @param configs */ AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left configs ( AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 查询通知是否授权 */ AST#method_declaration#Left static async isNotificationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isNotificationEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //查询通知是否授权。 } AST#block_statement#Right AST#method_declaration#Right /** * 查询通知是否授权 */ AST#method_declaration#Left static isNotificationEnabledSync 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isNotificationEnabledSync 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 /** * 应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。 * @param context * @returns */ AST#method_declaration#Left static async requestEnableNotification AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 /** * 拉起应用的通知设置界面,该页面以半模态形式呈现,可用于设置通知开关、通知提醒方式等。使用Promise异步回调。 * @param context * @returns */ AST#method_declaration#Left static async openNotificationSettings AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . isApiSupported AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 13 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . openNotificationSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 else 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#await_expression#Left await AST#expression#Left WantUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . toNotificationSetting 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#block_statement#Right AST#method_declaration#Right /** * 请求通知授权,第一次调用会弹窗让用户选择。 * @returns */ AST#method_declaration#Left static async authorizeNotification AST#parameter_list#Left ( AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left grant : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NotificationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isEnabled AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { //未授权,拉起授权 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NotificationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left isEnabled 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 isEnabled 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#assignment_expression#Left isEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NotificationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left isEnabled 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 isEnabled AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 查询模板是否存在,目前仅支持进度条模板。 * @param templateName 模板名称。当前仅支持'downloadTemplate'。 * @returns */ AST#method_declaration#Left static async isSupportTemplate AST#parameter_list#Left ( AST#parameter#Left templateName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'downloadTemplate' AST#expression#Right AST#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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isSupportTemplate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left templateName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 查询设备是否支持分布式通知 * @returns */ AST#method_declaration#Left static async isDistributedEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isDistributedEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 发布普通文本通知 * @param options 通知实体 * @returns */ AST#method_declaration#Left static async publishBasic AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationBasicOptions 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationBasicContent 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . additionalText 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 . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#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 . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . lockscreenPicture 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 . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left basicContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //发送通知 AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 发布长文本通知 * @param options 通知实体 * @returns */ AST#method_declaration#Left static async publishLongText AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationLongTextOptions 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left longTextContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationLongTextContent 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left briefText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . briefText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left longText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . longText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expandedTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . expandedTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left longTextContent AST#expression#Right . additionalText 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 . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#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 . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left longTextContent AST#expression#Right . lockscreenPicture 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 . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_LONG_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left longText AST#property_name#Right : AST#expression#Left longTextContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //发送通知 AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 发布多文本通知 * @param options 通知实体 * @returns */ AST#method_declaration#Left static async publishMultiLine AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationMultiLineOptions 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left multiLineContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationMultiLineContent 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left briefText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . briefText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left longTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . longTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lines AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . lines AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left multiLineContent AST#expression#Right . additionalText 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 . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#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 . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left multiLineContent AST#expression#Right . lockscreenPicture 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 . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_MULTILINE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left multiLine AST#property_name#Right : AST#expression#Left multiLineContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //发送通知 AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 发布带有图片的通知 * @param options 通知实体 * @returns */ AST#method_declaration#Left static async publishPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pictureContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationPictureContent 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left briefText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . briefText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expandedTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . expandedTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . picture AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pictureContent AST#expression#Right . additionalText 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 . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#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 . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pictureContent AST#expression#Right . lockscreenPicture 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 . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_PICTURE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left pictureContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //发送通知 AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 发布模板的通知 * @param options */ AST#method_declaration#Left static async publishTemplate AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationTemplateOptions 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationBasicContent 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . additionalText 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 . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#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 . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left basicContent AST#expression#Right . lockscreenPicture 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 . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_BASIC_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left basicContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //模板对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left template : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationTemplate 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 name AST#property_name#Right : AST#expression#Left 'downloadTemplate' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left progressValue AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . progressValue 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#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent AST#expression#Right , AST#expression#Left template 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //发送通知 AST#statement#Left AST#return_statement#Left return AST#expression#Left notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 取消通知,通过通知ID和通知标签取消已发布的通知,若label为空表示取消与指定通知ID相匹配的已发布通知。 * @param id 通知id * @param label 通知标签,默认为空。 * @returns */ AST#method_declaration#Left static async cancel 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 label ? : 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 notificationManager AST#expression#Right . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left label 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 groupName 通知组名称,此名称需要在发布通知时通过NotificationRequest对象指定。 * @returns */ AST#method_declaration#Left static async cancelGroup AST#parameter_list#Left ( AST#parameter#Left groupName : 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 notificationManager AST#expression#Right . cancelGroup AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left groupName 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 cancelAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 notificationManager AST#expression#Right . cancelAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 设置桌面角标个数,在应用的桌面图标上呈现。 */ AST#method_declaration#Left static async setBadge AST#parameter_list#Left ( AST#parameter#Left badgeNumber : 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#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . setBadgeNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left badgeNumber AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 清空桌面角标,在应用的桌面图标上呈现。 */ AST#method_declaration#Left static async clearBadge 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 notificationManager AST#expression#Right . setBadgeNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取当前应用未删除的通知数量。 */ AST#method_declaration#Left static async getActiveNotificationCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . getActiveNotificationCount 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 async setBadgeFromNotificationCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left NotificationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getActiveNotificationCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . setBadgeNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left count AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //设置角标 } AST#block_statement#Right AST#method_declaration#Right /** * 获取当前应用未删除的通知列表。 */ AST#method_declaration#Left static async getActiveNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest 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#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 notificationManager AST#expression#Right . getActiveNotifications 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 /** * 创建指定类型的通知渠道。 * @param type 要创建的通知渠道的类型 */ AST#method_declaration#Left static async addSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . addSlot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取一个指定类型的通知渠道。 * @param type 要创建的通知渠道的类型 */ AST#method_declaration#Left static async getSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationSlot AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . getSlot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取此应用程序的所有通知渠道 * @returns */ AST#method_declaration#Left static async getSlots AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationSlot 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#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 notificationManager AST#expression#Right . getSlots 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 /** * 删除此应用程序指定类型的通知渠道 * @param type 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 * @returns */ AST#method_declaration#Left static async removeSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . removeSlot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 删除此应用程序所有通知渠道 * @returns */ AST#method_declaration#Left static async removeAllSlots AST#parameter_list#Left ( ) AST#parameter_list#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 notificationManager AST#expression#Right . removeAllSlots 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 /** * 生成通知id(用时间戳当id) * @returns */ AST#method_declaration#Left static generateNotificationId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemDateTime AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取压缩通知的图片(图像像素的总字节数不能超过2MB) * @param pixelMap:原始待压缩图片的PixelMap对象 * @returns 返回压缩后的图片数据 */ AST#method_declaration#Left static async getCompressedPicture AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#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 PixelMap AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right == AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left src = 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 ImageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getPixelMapFromMedia AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelMap = AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pictureMaxSize = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //通知的图片内容(图像像素的总字节数不能超过2MB)。 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelBytes AST#expression#Right > AST#expression#Left pictureMaxSize AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left pixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . AntiAliasingLevel AST#member_expression#Right AST#expression#Right . LOW 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#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left pixelMap AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 获取压缩通知图标(图标像素的总字节数不超过192KB) * @param pixelMap:原始待压缩图片的PixelMap对象 * @returns */ AST#method_declaration#Left static async getCompressedIcon AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#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 PixelMap AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right == AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left src = 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 ImageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getPixelMapFromMedia AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelMap = AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pictureMaxSize = AST#expression#Left AST#binary_expression#Left AST#expression#Left 192 AST#expression#Right * AST#expression#Left 1024 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //通知图标(图标像素的总字节数不超过192KB)。 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelBytes AST#expression#Right > AST#expression#Left pictureMaxSize AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left pixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . AntiAliasingLevel AST#member_expression#Right AST#expression#Right . LOW 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#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left pixelMap AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 创建一个可拉起Ability的Want * @returns */ AST#method_declaration#Left static async getDefaultWantAgent 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#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 WantAgent 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 context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取当前上下文对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wantAgentInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left wantAgent . WantAgentInfo 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 wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left deviceId AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left moduleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . moduleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'action_notice' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left entities AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionType AST#property_name#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 wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right | AST#expression#Left wantAgent AST#expression#Right AST#binary_expression#Right AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . SEND_COMMON_EVENT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . CONSTANT_FLAG AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#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 wantAgent AST#expression#Right . getWantAgent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wantAgentInfo 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 /** * 构建NotificationRequest对象 * @param notificationId 通知ID * @param options 描述通知的请求参数 * @param content 通知内容 * @param template 模板 * @returns */ AST#method_declaration#Left private static getNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left template ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationTemplate AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left request : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest 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 content AST#property_name#Right : AST#expression#Left content AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . id AST#member_expression#Right = AST#expression#Left notificationId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //通知ID。 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left template AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . template AST#member_expression#Right = AST#expression#Left template AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //模板 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . notificationSlotType AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . notificationSlotType AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . notificationSlotType 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 . notificationSlotType AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . notificationSlotType 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#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 . deliveryTime AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . deliveryTime AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . deliveryTime 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 . deliveryTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . deliveryTime 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . showDeliveryTime 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 . showDeliveryTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . showDeliveryTime 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 request AST#expression#Right . tapDismissed 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 . tapDismissed AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . tapDismissed AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //通知是否自动清除。 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . autoDeletedTime AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . autoDeletedTime AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . autoDeletedTime 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 . autoDeletedTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . autoDeletedTime 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . isAlertOnce 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 . isAlertOnce AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . isAlertOnce 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 request AST#expression#Right . isStopwatch 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 . isStopwatch AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . isStopwatch 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 request AST#expression#Right . isCountDown 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 . isCountDown AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . isCountDown 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 request AST#expression#Right . isFloatingIcon 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 . isFloatingIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . isFloatingIcon AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //是否显示状态栏图标。 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . label AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . label 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 . label AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . label 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#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 . actionButtons AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . actionButtons AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . actionButtons 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 . actionButtons AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . actionButtons 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#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 . smallIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . smallIcon AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . smallIcon 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 . smallIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . smallIcon AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //通知小图标。可选字段,图像像素的总字节数不超过100KB。实际显示效果依赖于设备能力和通知中心UI样式。 } 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . largeIcon 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 . largeIcon AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . largeIcon AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //通知大图标。可选字段,图像像素的总字节数不超过100KB。实际显示效果依赖于设备能力和通知中心UI样式。 } 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . groupName AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . groupName AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . groupName 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 . groupName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . groupName 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#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 . template AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . template AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . template 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 . template AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . template 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#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 . distributedOption AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . distributedOption AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . distributedOption 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 . distributedOption AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . distributedOption 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#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 . appMessageId AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . appMessageId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . appMessageId 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 . appMessageId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . appMessageId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //应用发送通知携带的唯一标识字段, 用于通知去重。如果同一应用通过本地和云端等不同途径发布携带相同appMessageId的通知,设备只展示一条消息,之后收到的重复通知会被静默去重,不展示、不提醒。去重标识仅在通知发布的24小时内有效,超过24小时或者设备重启失效。。 } 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . sound AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . sound AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . sound 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 . sound AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . sound AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //应用通知自定义铃声,需要通过Push云侧获取自定义发送铃声权限后,该字段才会生效。 } 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . badgeNumber AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . badgeNumber AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . badgeNumber 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 . badgeNumber AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . badgeNumber 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#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 . extraInfo AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . extraInfo AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . extraInfo 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 . extraInfo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . extraInfo 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#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 . wantAgent AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . wantAgent AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . wantAgent 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 . wantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . wantAgent AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //WantAgent封装了应用的行为意图,点击通知时触发该行为。 } 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . removalWantAgent AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . removalWantAgent AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . removalWantAgent 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 . removalWantAgent AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . removalWantAgent AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //当移除通知时,通知将被重定向到的WantAgent实例。 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left request AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取错误msg * @param code * @param defaultMsg */ AST#method_declaration#Left public static getErrorMsg AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultMsg : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 201 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 202 AST#expression#Right == AST#expression#Left code 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 '系统API权限校验失败!' AST#expression#Right AST#return_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 401 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 801 AST#expression#Right == AST#expression#Left code 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 '该设备不支持此API!' AST#expression#Right AST#return_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 1600001 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600002 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600003 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600004 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600005 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600006 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600007 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600008 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600009 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600010 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600011 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 1600012 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_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 17700001 AST#expression#Right == AST#expression#Left code 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#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left defaultMsg AST#expression#Right AST#return_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#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_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 NotificationUtil { private static defaultConfig: NotificationConfig = new NotificationConfig(); static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtil.defaultConfig); } static async isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); } static isNotificationEnabledSync(): boolean { return notificationManager.isNotificationEnabledSync(); } static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) } static async openNotificationSettings(context: common.UIAbilityContext = AppUtil.getContext()): Promise<void> { if (AppUtil.isApiSupported(13)) { return await notificationManager.openNotificationSettings(context); } else { return await WantUtil.toNotificationSetting(); } } static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtil.isNotificationEnabled(); if (!isEnabled) { try { await notificationManager.requestEnableNotification(AppUtil.getContext()); isEnabled = await NotificationUtil.isNotificationEnabled(); callBack?.(isEnabled); return isEnabled; } catch (e) { isEnabled = await NotificationUtil.isNotificationEnabled(); callBack?.(isEnabled); return isEnabled; } } else { callBack?.(true); return true; } } static async isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> { return notificationManager.isSupportTemplate(templateName); } static async isDistributedEnabled(): Promise<boolean> { return notificationManager.isDistributedEnabled() } static async publishBasic(options: NotificationBasicOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { basicContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { basicContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); return notificationId } static async publishLongText(options: NotificationLongTextOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const longTextContent: notificationManager.NotificationLongTextContent = { title: options.title, text: options.text, briefText: options.briefText, longText: options.longText, expandedTitle: options.expandedTitle } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { longTextContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { longTextContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, longText: longTextContent } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); return notificationId; } static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const multiLineContent: notificationManager.NotificationMultiLineContent = { title: options.title, text: options.text, briefText: options.briefText, longTitle: options.longTitle, lines: options.lines } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { multiLineContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { multiLineContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, multiLine: multiLineContent } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); return notificationId; } static async publishPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const pictureContent: notificationManager.NotificationPictureContent = { title: options.title, text: options.text, briefText: options.briefText, expandedTitle: options.expandedTitle, picture: options.picture } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { pictureContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { pictureContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, picture: pictureContent } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); return notificationId; } static async publishTemplate(options: NotificationTemplateOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { basicContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { basicContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent } let template: notificationManager.NotificationTemplate = { name: 'downloadTemplate', data: { title: options.title, fileName: options.fileName, progressValue: options.progressValue } } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent, template); await notificationManager.publish(notificationRequest); return notificationId; } static async cancel(id: number, label?: string): Promise<void> { return notificationManager.cancel(id, label); } static async cancelGroup(groupName: string): Promise<void> { return notificationManager.cancelGroup(groupName); } static async cancelAll(): Promise<void> { return notificationManager.cancelAll() } static async setBadge(badgeNumber: number): Promise<void> { return notificationManager.setBadgeNumber(badgeNumber); } static async clearBadge(): Promise<void> { return notificationManager.setBadgeNumber(0); } static async getActiveNotificationCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); } static async setBadgeFromNotificationCount(): Promise<void> { let count = await NotificationUtil.getActiveNotificationCount(); return notificationManager.setBadgeNumber(count); } static async getActiveNotifications(): Promise<Array<notificationManager.NotificationRequest>> { return notificationManager.getActiveNotifications(); } static async addSlot(type: notificationManager.SlotType) { return notificationManager.addSlot(type); } static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> { return notificationManager.getSlot(type); } static async getSlots(): Promise<Array<notificationManager.NotificationSlot>> { return notificationManager.getSlots(); } static async removeSlot(type: notificationManager.SlotType) { return notificationManager.removeSlot(type); } static async removeAllSlots() { return notificationManager.removeAllSlots(); } static generateNotificationId(): number { return systemDateTime.getTime(true); } static async getCompressedPicture(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 2 * 1024 * 1024; let pixelBytes = pixelMap.getPixelBytesNumber(); while (pixelBytes > pictureMaxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); pixelBytes = pixelMap.getPixelBytesNumber(); } return pixelMap; } static async getCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 192 * 1024; let pixelBytes = pixelMap.getPixelBytesNumber(); while (pixelBytes > pictureMaxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); pixelBytes = pixelMap.getPixelBytesNumber(); } return pixelMap; } static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> { const context = AppUtil.getContext(); const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { deviceId: '', bundleName: context.abilityInfo.bundleName, moduleName: context.abilityInfo.moduleName, abilityName: context.abilityInfo.name, action: 'action_notice', entities: [], uri: uri, } ], actionType: wantAgent.OperationType.START_ABILITY | wantAgent.OperationType.SEND_COMMON_EVENT, requestCode: 0, actionFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG] }; return wantAgent.getWantAgent(wantAgentInfo); } private static getNotificationRequest(notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest { const request: notificationManager.NotificationRequest = { content: content }; request.id = notificationId; if (template) { request.template = template; } if (options.notificationSlotType || NotificationUtil.defaultConfig.notificationSlotType) { request.notificationSlotType = options.notificationSlotType ?? NotificationUtil.defaultConfig.notificationSlotType; } if (options.deliveryTime || NotificationUtil.defaultConfig.deliveryTime) { request.deliveryTime = options.deliveryTime ?? NotificationUtil.defaultConfig.deliveryTime; } request.showDeliveryTime = options.showDeliveryTime ?? NotificationUtil.defaultConfig.showDeliveryTime; request.tapDismissed = options.tapDismissed ?? NotificationUtil.defaultConfig.tapDismissed; if (options.autoDeletedTime || NotificationUtil.defaultConfig.autoDeletedTime) { request.autoDeletedTime = options.autoDeletedTime ?? NotificationUtil.defaultConfig.autoDeletedTime; } request.isAlertOnce = options.isAlertOnce ?? NotificationUtil.defaultConfig.isAlertOnce; request.isStopwatch = options.isStopwatch ?? NotificationUtil.defaultConfig.isStopwatch; request.isCountDown = options.isCountDown ?? NotificationUtil.defaultConfig.isCountDown; request.isFloatingIcon = options.isFloatingIcon ?? NotificationUtil.defaultConfig.isFloatingIcon; if (options.label || NotificationUtil.defaultConfig.label) { request.label = options.label ?? NotificationUtil.defaultConfig.label; } if (options.actionButtons || NotificationUtil.defaultConfig.actionButtons) { request.actionButtons = options.actionButtons ?? NotificationUtil.defaultConfig.actionButtons; } if (options.smallIcon || NotificationUtil.defaultConfig.smallIcon) { request.smallIcon = options.smallIcon ?? NotificationUtil.defaultConfig.smallIcon; } if (options.largeIcon || NotificationUtil.defaultConfig.largeIcon) { request.largeIcon = options.largeIcon ?? NotificationUtil.defaultConfig.largeIcon; } if (options.groupName || NotificationUtil.defaultConfig.groupName) { request.groupName = options.groupName ?? NotificationUtil.defaultConfig.groupName; } if (options.template || NotificationUtil.defaultConfig.template) { request.template = options.template ?? NotificationUtil.defaultConfig.template; } if (options.distributedOption || NotificationUtil.defaultConfig.distributedOption) { request.distributedOption = options.distributedOption ?? NotificationUtil.defaultConfig.distributedOption; } if (options.appMessageId || NotificationUtil.defaultConfig.appMessageId) { request.appMessageId = options.appMessageId ?? NotificationUtil.defaultConfig.appMessageId; } if (options.sound || NotificationUtil.defaultConfig.sound) { request.sound = options.sound ?? NotificationUtil.defaultConfig.sound; } if (options.badgeNumber || NotificationUtil.defaultConfig.badgeNumber) { request.badgeNumber = options.badgeNumber ?? NotificationUtil.defaultConfig.badgeNumber; } if (options.extraInfo || NotificationUtil.defaultConfig.extraInfo) { request.extraInfo = options.extraInfo ?? NotificationUtil.defaultConfig.extraInfo; } if (options.wantAgent || NotificationUtil.defaultConfig.wantAgent) { request.wantAgent = options.wantAgent ?? NotificationUtil.defaultConfig.wantAgent; } if (options.removalWantAgent || NotificationUtil.defaultConfig.removalWantAgent) { request.removalWantAgent = options.removalWantAgent ?? NotificationUtil.defaultConfig.removalWantAgent; } return request; } public static getErrorMsg(code: number, defaultMsg: string) { if (201 == code) { return '权限校验失败!' } else if (202 == code) { return '系统API权限校验失败!' } else if (401 == code) { return '参数检查失败!' } else if (801 == code) { return '该设备不支持此API!' } else if (1600001 == code) { return '应用通知,内部错误!' } else if (1600002 == code) { return '序列化或反序列化错误!' } else if (1600003 == code) { return '应用连接通知服务失败!' } else if (1600004 == code) { return '请开启应用通知开关!' } else if (1600005 == code) { return '通知渠道关闭!' } else if (1600006 == code) { return '通知删除失败!' } else if (1600007 == code) { return '通知不存在!' } else if (1600008 == code) { return '用户不存在!' } else if (1600009 == code) { return '通知发布频度超过限制!' } else if (1600010 == code) { return '分布式操作失败!' } else if (1600011 == code) { return '读模板配置文件错误!' } else if (1600012 == code) { return '内存空间不够!' } else if (17700001 == code) { return '包名不存在!' } else { return defaultMsg } } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L41-L596
44782dfaf5337333ed01c604694f410e8809619e
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/ext/UIExt.ets
arkts
显示软键盘 @param id 需要focus的输入控件key
export function extUIShowKeybroad(key: string) { sendEventByKey(key, 10, "弹出键盘") }
AST#export_declaration#Left export AST#function_declaration#Left function extUIShowKeybroad AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sendEventByKey AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left "弹出键盘" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function extUIShowKeybroad(key: string) { sendEventByKey(key, 10, "弹出键盘") }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ext/UIExt.ets#L21-L23
29afdd2a8fe28a21f29070ab5c2e2c447c251351
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Camera/entry/src/main/ets/views/FlashingLightPage.ets
arkts
getImageDefault
Return to selected image
getImageDefault() { if (this.flashingNum == 0) { return this.flashIcon.iconOff; } if (this.flashingNum == 1) { return this.flashIcon.iconOn; } if (this.flashingNum == 2) { return this.flashIcon.iconAuto; } if (this.flashingNum == 3) { return this.flashIcon.iconAlwaysOn; } return; }
AST#method_declaration#Left getImageDefault 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 . flashingNum AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashIcon AST#member_expression#Right AST#expression#Right . iconOff 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#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 . flashingNum AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashIcon AST#member_expression#Right AST#expression#Right . iconOn 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#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 . flashingNum AST#member_expression#Right 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashIcon AST#member_expression#Right AST#expression#Right . iconAuto 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#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 . flashingNum AST#member_expression#Right 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashIcon AST#member_expression#Right AST#expression#Right . iconAlwaysOn 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#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getImageDefault() { if (this.flashingNum == 0) { return this.flashIcon.iconOff; } if (this.flashingNum == 1) { return this.flashIcon.iconOn; } if (this.flashingNum == 2) { return this.flashIcon.iconAuto; } if (this.flashingNum == 3) { return this.flashIcon.iconAlwaysOn; } return; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/FlashingLightPage.ets#L40-L54
89694bdd8fae38e1bca3ed7d24a606ecb066d7b2
gitee
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
waitSync
eglWaitSync https://registry.khronos.org/EGL/sdk/docs/man/html/eglWaitSync.xhtml @param flag must be 0?
waitSync(sync: EGLSync, flags: number): boolean;
AST#method_declaration#Left waitSync AST#parameter_list#Left ( AST#parameter#Left sync : AST#type_annotation#Left AST#primary_type#Left EGLSync AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left flags : 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#method_declaration#Right
waitSync(sync: EGLSync, flags: number): boolean;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L213-L213
633ee6296ce7c019bbddba14be7ec20777670bed
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/anim/card/ResourceString.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export function getResourceString(resource: Resource, __this: object): string { let resourceString = getContext(__this).resourceManager.getStringSync(resource.id); return resourceString; }
AST#export_declaration#Left export AST#function_declaration#Left function getResourceString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left __this : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left resourceString = 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 . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left resource AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left resourceString AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getResourceString(resource: Resource, __this: object): string { let resourceString = getContext(__this).resourceManager.getStringSync(resource.id); return resourceString; }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/anim/card/ResourceString.ets#L16-L19
2703e58b1f78c012a05de26e5c23be6d712cf664
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
open
打开文件,支持使用URI打开文件。使用Promise异步回调。 @param path string 文件的应用沙箱路径或URI。 @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 @returns
static open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> { return fs.open(path, mode); }
AST#method_declaration#Left static open 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 mode : 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right 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 AST#qualified_type#Left fs . File AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left mode 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 open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> { return fs.open(path, mode); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L105-L107
0f05b70bf034a3052dbd9a427671d8f1cbc7c531
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@xvideos_alerts/581.2.14/package/app.ets
arkts
应用约束26:使用箭头函数而非函数表达式
export const printMsg = () => {};
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left printMsg = 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#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const printMsg = () => {};
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@xvideos_alerts/581.2.14/package/app.ets#L2-L2
e1b9827a55987d33fe303f751d65eec149e160ed
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
searchFestivals
搜索节日
public static searchFestivals(keyword: string): FestivalInfo[] { const lowerKeyword = keyword.toLowerCase(); return FestivalData2025.getAllFestivals().filter(festival => festival.name.toLowerCase().includes(lowerKeyword) || festival.englishName?.toLowerCase().includes(lowerKeyword) || festival.alias?.some(alias => alias.toLowerCase().includes(lowerKeyword)) ); }
AST#method_declaration#Left public static searchFestivals AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FestivalInfo [ ] 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 lowerKeyword = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left keyword AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FestivalData2025 AST#expression#Right . getAllFestivals AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left festival => 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#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left festival AST#expression#Right . name AST#member_expression#Right AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lowerKeyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left festival AST#expression#Right AST#binary_expression#Right AST#expression#Right . englishName AST#member_expression#Right AST#expression#Right ?. toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lowerKeyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left festival AST#expression#Right AST#binary_expression#Right AST#expression#Right . alias AST#member_expression#Right AST#expression#Right ?. some AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left alias => 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 alias AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lowerKeyword 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#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
public static searchFestivals(keyword: string): FestivalInfo[] { const lowerKeyword = keyword.toLowerCase(); return FestivalData2025.getAllFestivals().filter(festival => festival.name.toLowerCase().includes(lowerKeyword) || festival.englishName?.toLowerCase().includes(lowerKeyword) || festival.alias?.some(alias => alias.toLowerCase().includes(lowerKeyword)) ); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L327-L334
d137d748ab966a14f948098eacb2245996d6f665
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets
arkts
reset
重置
reset(): void { this.currentRotate = 0; this.lastRotate = 0; }
AST#method_declaration#Left reset 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 . currentRotate AST#member_expression#Right = AST#expression#Left 0 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 . lastRotate AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
reset(): void { this.currentRotate = 0; this.lastRotate = 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets#L31-L34
0b67c739679cd367c36de0786e83c02c3448f188
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/web/src/main/ets/WebView.ets
arkts
WebView
@author open_9527 @date 2025/5/16 @desc web 包装层
@ComponentV2 export struct WebView { @Require @Param webviewController: webview.WebviewController @Require @Param webviewSrc: ResourceStr @Param webViewOptions: WebViewOptions = new WebViewOptions() @Param webViewProxy: WebViewProxy = new BaseWebViewProxyImp() build() { Column() { Web({ src: this.webviewSrc, controller: this.webviewController }) .size({ width: '100%', height: '100%' }) .domStorageAccess(this.webViewOptions.domStorageAccess) .javaScriptAccess(this.webViewOptions.javaScriptAccess) .fileAccess(this.webViewOptions.fileAccess) .imageAccess(this.webViewOptions.imageAccess) .onlineImageAccess(this.webViewOptions.onlineImageAccess) .overScrollMode(this.webViewOptions.overScrollMode) .mixedMode(this.webViewOptions.mixedMode) .zoomAccess(this.webViewOptions.zoomAccess) .overviewModeAccess(this.webViewOptions.overviewModeAccess) .databaseAccess(this.webViewOptions.databaseAccess) .geolocationAccess(this.webViewOptions.geolocationAccess) .mediaPlayGestureAccess(this.webViewOptions.mediaPlayGestureAccess) .multiWindowAccess(this.webViewOptions.multiWindowAccess) .horizontalScrollBarAccess(this.webViewOptions.horizontalScrollBarAccess) .verticalScrollBarAccess(this.webViewOptions.verticalScrollBarAccess) .cacheMode(this.webViewOptions.cacheMode) .copyOptions(this.webViewOptions.copyOptions) .textZoomRatio(this.webViewOptions.textZoomRatio) .initialScale(this.webViewOptions.initialScale) .blockNetwork(this.webViewOptions.blockNetwork) .defaultFixedFontSize(this.webViewOptions.defaultFixedFontSize) .defaultFontSize(this.webViewOptions.defaultFontSize) .minFontSize(this.webViewOptions.minFontSize) .minLogicalFontSize(this.webViewOptions.minLogicalFontSize) .webFixedFont(this.webViewOptions.webFixedFont) .webSansSerifFont(this.webViewOptions.webSansSerifFont) .webSerifFont(this.webViewOptions.webSerifFont) .webStandardFont(this.webViewOptions.webStandardFont) .webFantasyFont(this.webViewOptions.webFantasyFont) .webCursiveFont(this.webViewOptions.webCursiveFont) .darkMode(this.webViewOptions.darkMode) .forceDarkAccess(this.webViewOptions.forceDarkAccess) .pinchSmooth(this.webViewOptions.pinchSmooth) .allowWindowOpenMethod(this.webViewOptions.allowWindowOpenMethod) .mediaOptions(this.webViewOptions.mediaOptions) .javaScriptOnDocumentStart(this.webViewOptions.javaScriptOnDocumentStart) .javaScriptOnDocumentEnd(this.webViewOptions.javaScriptOnDocumentEnd) .layoutMode(this.webViewOptions.layoutMode) .nestedScroll(this.webViewOptions.nestedScroll) .enableNativeEmbedMode(this.webViewOptions.enableNativeEmbedMode) .defaultTextEncodingFormat(this.webViewOptions.defaultTextEncodingFormat) .metaViewport(this.webViewOptions.metaViewport) .textAutosizing(this.webViewOptions.textAutosizing) .enableNativeMediaPlayer(this.webViewOptions.enableNativeMediaPlayer) .selectionMenuOptions(this.webViewOptions.selectionMenuOptions) .keyboardAvoidMode(this.webViewOptions.keyboardAvoidMode) .onControllerAttached(() => { this.webViewProxy.onControllerAttached?.(); Logger.debug(`onControllerAttached => 事件回调`); }) .onPageBegin((event) => { this.webViewProxy.onPageBegin?.(event); Logger.debug(`onPageBegin => ${event.url}`); }) .onPageEnd((event) => { this.webViewProxy.onPageEnd?.(event); }) .onProgressChange((event) => { this.webViewProxy.onProgressChange?.(event); Logger.debug(`onProgressChange => ${event.newProgress}`); }) .onPageVisible((event) => { this.webViewProxy.onPageVisible?.(event); Logger.debug(`onPageVisible => ${event.url}`); }) .onLoadIntercept((event) => { Logger.debug(`onLoadIntercept => 事件回调`); return this.webViewProxy.onLoadIntercept?.(event) ?? false; }) .onOverrideUrlLoading((request) => { Logger.debug(`onOverrideUrlLoading => 事件回调`); if (request && request.getRequestUrl() == "about:blank") { return true; //不加载空白页 } return this.webViewProxy.onOverrideUrlLoading?.(request) ?? false; }) .onInterceptRequest((event) => { Logger.debug(`onInterceptRequest => 事件回调`); return this.webViewProxy?.onInterceptRequest?.(event) ?? null; }) .onTitleReceive((event) => { this.webViewProxy.onTitleReceive?.(event); Logger.debug(`onTitleReceive => ${event.title}`); }) .onErrorReceive((event) => { this.webViewProxy.onErrorReceive?.(event); Logger.debug(`onErrorReceive => errorCode:${event.error.getErrorCode()} - errorMsg:${event.error.getErrorInfo()}`); }) .onHttpErrorReceive((event) => { this.webViewProxy.onHttpErrorReceive?.(event); Logger.debug(`onHttpErrorReceive => responseCode:${event.response.getResponseCode()}`); }) .onSslErrorEventReceive((event) => { this.webViewProxy.onSslErrorEventReceive?.(event); Logger.debug(`onSslErrorEventReceive => 事件回调`); }) .onSslErrorEvent((event) => { this.webViewProxy.onSslErrorEvent?.(event); Logger.debug(`onSslErrorEvent => isMainFrame:${event.isMainFrame}`); }) .onHttpAuthRequest((event) => { Logger.debug(`onHttpAuthRequest => 事件回调`); return this.webViewProxy?.onHttpAuthRequest?.(event) ?? true; }) .onClientAuthenticationRequest((event) => { this.webViewProxy.onClientAuthenticationRequest?.(event); Logger.debug(`onClientAuthenticationRequest => 事件回调`); }) .onRenderExited((event) => { this.webViewProxy.onRenderExited?.(event); Logger.debug(`onRenderExited => 事件回调`); }) .onDownloadStart((event) => { if (this.webViewProxy.onDownloadStart) { this.webViewProxy.onDownloadStart(event); } Logger.debug(`onDownloadStart => 事件回调`); }) .onShowFileSelector((event) => { Logger.debug(`onShowFileSelector => 事件回调`); if (this.webViewProxy.onShowFileSelector) { return this.webViewProxy.onShowFileSelector(event); } return false; }) .onPermissionRequest((event) => { if (this.webViewProxy.onPermissionRequest) { this.webViewProxy.onPermissionRequest(event); } Logger.debug(`onPermissionRequest => 事件回调`); }) .onGeolocationShow((event) => { if (this.webViewProxy.onGeolocationShow) { this.webViewProxy.onGeolocationShow(event); } Logger.debug(`onGeolocationShow => 事件回调`); }) .onGeolocationHide(() => { if (this.webViewProxy.onGeolocationHide) { this.webViewProxy.onGeolocationHide(); } Logger.debug(`onGeolocationHide => 事件回调`); }) .onFullScreenEnter((event) => { if (this.webViewProxy.onFullScreenEnter) { this.webViewProxy.onFullScreenEnter(event); } Logger.debug(`onFullScreenEnter => 事件回调`); }) .onFullScreenExit(() => { if (this.webViewProxy.onFullScreenExit) { this.webViewProxy.onFullScreenExit(); } Logger.debug(`onFullScreenExit => 事件回调`); }) .onContextMenuShow((event) => { Logger.debug(`onContextMenuShow => 事件回调`); if (this.webViewProxy.onContextMenuShow) { return this.webViewProxy.onContextMenuShow(event); } return false; }) .onContextMenuHide(() => { if (this.webViewProxy.onContextMenuHide) { this.webViewProxy.onContextMenuHide(); } Logger.debug(`onContextMenuHide => 事件回调`); }) .onScaleChange((event) => { this.webViewProxy.onScaleChange?.(event); Logger.debug(`onScaleChange => changed from ${event.oldScale} to ${event.newScale}`); }) .onScroll((event) => { this.webViewProxy.onScroll?.(event); Logger.debug(`onScroll => x=${event.xOffset},y=${event.yOffset}`); }) .onOverScroll((event) => { this.webViewProxy.onOverScroll?.(event); Logger.debug(`onOverScroll => x=${event.xOffset},y=${event.yOffset}`); }) .onRequestSelected(() => { this.webViewProxy.onRequestSelected?.(); Logger.debug(`onRequestSelected => 事件回调`); }) .onScreenCaptureRequest((event) => { this.webViewProxy.onScreenCaptureRequest?.(event); Logger.debug(`onScreenCaptureRequest => ${event.handler.getOrigin()}`); }) .onWindowNew((event) => { this.webViewProxy.onWindowNew?.(event); Logger.debug(`onWindowNew => 事件回调`); }) .onWindowExit(() => { this.webViewProxy.onWindowExit?.(); Logger.debug(`onWindowExit => 事件回调`); }) .onResourceLoad((event) => { this.webViewProxy.onResourceLoad?.(event); Logger.debug(`onResourceLoad => ${event.url}`); }) .onRefreshAccessedHistory((event) => { this.webViewProxy.onRefreshAccessedHistory?.(event); Logger.debug(`onRefreshAccessedHistory => 事件回调`); }) .onBeforeUnload((event) => { Logger.debug(`onBeforeUnload => ${event.url}`); return this.webViewProxy.onBeforeUnload?.(event) ?? false; }) .onRenderProcessNotResponding((event) => { this.webViewProxy.onRenderProcessNotResponding?.(event); Logger.debug(`onRenderProcessNotResponding => 事件回调`); }) .onRenderProcessResponding(() => { this.webViewProxy.onRenderProcessResponding?.(); Logger.debug(`onRenderProcessResponding => 事件回调`); }) .onSearchResultReceive((event) => { this.webViewProxy.onSearchResultReceive?.(event); Logger.debug(`onSearchResultReceive => 事件回调`); }) .onDataResubmitted((event) => { this.webViewProxy.onDataResubmitted?.(event); Logger.debug(`onDataResubmitted => 事件回调`); }) .onInterceptKeyEvent((event) => { Logger.debug(`onInterceptKeyEvent => keyCode=${event.keyCode}`); return this.webViewProxy.onInterceptKeyEvent?.(event) ?? false; }) .onTouchIconUrlReceived((event) => { this.webViewProxy.onTouchIconUrlReceived?.(event); Logger.debug(`onTouchIconUrlReceived => 事件回调`); }) .onFaviconReceived((event) => { this.webViewProxy.onFaviconReceived?.(event); Logger.debug(`onFaviconReceived => 事件回调`); }) .onAudioStateChanged((event) => { this.webViewProxy.onAudioStateChanged?.(event); Logger.debug(`onAudioStateChanged => 事件回调`); }) .onFirstContentfulPaint((event) => { this.webViewProxy.onFirstContentfulPaint?.(event); Logger.debug(`onFirstContentfulPaint => 事件回调`); }) .onFirstMeaningfulPaint((paint) => { this.webViewProxy.onFirstMeaningfulPaint?.(paint); Logger.debug(`onFirstMeaningfulPaint => 事件回调`); }) .onLargestContentfulPaint((paint) => { this.webViewProxy.onLargestContentfulPaint?.(paint); Logger.debug(`onLargestContentfulPaint => 事件回调`); }) .onNavigationEntryCommitted((details) => { this.webViewProxy.onNavigationEntryCommitted?.(details); Logger.debug(`onNavigationEntryCommitted => 事件回调`); }) .onNativeEmbedLifecycleChange((event) => { this.webViewProxy.onNativeEmbedLifecycleChange?.(event); Logger.debug(`onNativeEmbedLifecycleChange => 事件回调`); }) .onNativeEmbedGestureEvent((event) => { this.webViewProxy.onNativeEmbedGestureEvent?.(event); Logger.debug(`onNativeEmbedGestureEvent => 事件回调`); }) .onNativeEmbedVisibilityChange((info) => { this.webViewProxy.onNativeEmbedVisibilityChange?.(info); Logger.debug(`onNativeEmbedVisibilityChange => 事件回调`); }) .onSafeBrowsingCheckResult((threatType) => { this.webViewProxy.onSafeBrowsingCheckResult?.(threatType); Logger.debug(`onSafeBrowsingCheckResult => 事件回调`); }) .onIntelligentTrackingPreventionResult((details) => { this.webViewProxy.onIntelligentTrackingPreventionResult?.(details); Logger.debug(`onNativeEmbedVisibilityChange => 事件回调`); }) .onViewportFitChanged((viewportFit) => { this.webViewProxy.onViewportFitChanged?.(viewportFit); Logger.debug(`onViewportFitChanged => 事件回调`); }) .onInterceptKeyboardAttach((keyboardCallbackInfo) => { Logger.debug(`onInterceptKeyboardAttach => 事件回调`); const option: WebKeyboardOptions = { useSystemKeyboard: true }; //option初始化,默认使用系统默认键盘 return this.webViewProxy.onInterceptKeyboardAttach?.(keyboardCallbackInfo) ?? option; }) .onAdsBlocked((details) => { if (this.webViewProxy.onAdsBlocked) { this.webViewProxy.onAdsBlocked(details); } Logger.debug(`onAdsBlocked => 事件回调`); }) .onAlert((event) => { Logger.debug(`onAlert => ${event.url}`); if (this.webViewProxy.onAlert) { return this.webViewProxy.onAlert(event); } return true }) .onConfirm((event) => { Logger.debug(`onConfirm => ${event.url}`); if (this.webViewProxy.onConfirm) { return this.webViewProxy.onConfirm(event); } return true; }) .onPrompt((event) => { Logger.debug(`onPrompt => ${event.url} - ${event.value}`); if (this.webViewProxy.onPrompt) { return this.webViewProxy.onPrompt(event); } return true; }) .onConsole((event) => { Logger.debug(`onConsole => 事件回调`); return this.webViewProxy.onConsole?.(event) ?? false; }) } .size({ width: '100%', height: '100%' }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct WebView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right webviewController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right webviewSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right webViewOptions : AST#type_annotation#Left AST#primary_type#Left WebViewOptions 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 WebViewOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right webViewProxy : AST#type_annotation#Left AST#primary_type#Left WebViewProxy 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 BaseWebViewProxyImp 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 Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewSrc AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#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 . domStorageAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . domStorageAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . javaScriptAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . javaScriptAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fileAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . fileAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . imageAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . imageAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onlineImageAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . onlineImageAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . overScrollMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . overScrollMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . mixedMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . mixedMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zoomAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . zoomAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . overviewModeAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . overviewModeAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . databaseAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . databaseAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . geolocationAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . geolocationAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . mediaPlayGestureAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . mediaPlayGestureAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . multiWindowAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . multiWindowAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . horizontalScrollBarAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . horizontalScrollBarAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . verticalScrollBarAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . verticalScrollBarAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . cacheMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . cacheMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . copyOptions ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . copyOptions AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textZoomRatio ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . textZoomRatio AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . initialScale ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . initialScale AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . blockNetwork ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . blockNetwork AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . defaultFixedFontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . defaultFixedFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . defaultFontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . defaultFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . minFontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . minFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . minLogicalFontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . minLogicalFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webFixedFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webFixedFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webSansSerifFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webSansSerifFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webSerifFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webSerifFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webStandardFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webStandardFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webFantasyFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webFantasyFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . webCursiveFont ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . webCursiveFont AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . darkMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . darkMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . forceDarkAccess ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . forceDarkAccess AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . pinchSmooth ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . pinchSmooth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . allowWindowOpenMethod ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . allowWindowOpenMethod AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . mediaOptions ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . mediaOptions AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . javaScriptOnDocumentStart ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . javaScriptOnDocumentStart AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . javaScriptOnDocumentEnd ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . javaScriptOnDocumentEnd AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . layoutMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . nestedScroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . nestedScroll AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableNativeEmbedMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . enableNativeEmbedMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . defaultTextEncodingFormat ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . defaultTextEncodingFormat AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . metaViewport ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . metaViewport AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAutosizing ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . textAutosizing AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableNativeMediaPlayer ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . enableNativeMediaPlayer AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectionMenuOptions ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . selectionMenuOptions AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . keyboardAvoidMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewOptions AST#member_expression#Right AST#expression#Right . keyboardAvoidMode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onControllerAttached ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onControllerAttached AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onControllerAttached => 事件回调 ` 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#modifier_chain_expression#Left . onPageBegin ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPageBegin AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onPageBegin => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#modifier_chain_expression#Left . onPageEnd ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPageEnd AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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#Left . onProgressChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onProgressChange AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onProgressChange => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . newProgress 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#modifier_chain_expression#Left . onPageVisible ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPageVisible AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onPageVisible => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#modifier_chain_expression#Left . onLoadIntercept ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onLoadIntercept => 事件回调 ` 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onLoadIntercept AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onOverrideUrlLoading ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left request AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onOverrideUrlLoading => 事件回调 ` 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left request AST#expression#Right && AST#expression#Left request AST#expression#Right AST#binary_expression#Right AST#expression#Right . getRequestUrl 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 "about:blank" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left 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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onOverrideUrlLoading AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left request AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onInterceptRequest ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onInterceptRequest => 事件回调 ` 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right ?. onInterceptRequest AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTitleReceive ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onTitleReceive AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onTitleReceive => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onErrorReceive ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onErrorReceive AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onErrorReceive => errorCode: 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 event AST#expression#Right . error AST#member_expression#Right AST#expression#Right . getErrorCode 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 - errorMsg: 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 event AST#expression#Right . error AST#member_expression#Right AST#expression#Right . getErrorInfo 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onHttpErrorReceive ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onHttpErrorReceive AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onHttpErrorReceive => responseCode: 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 event AST#expression#Right . response AST#member_expression#Right AST#expression#Right . getResponseCode 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onSslErrorEventReceive ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onSslErrorEventReceive AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onSslErrorEventReceive => 事件回调 ` 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#modifier_chain_expression#Left . onSslErrorEvent ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onSslErrorEvent AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onSslErrorEvent => isMainFrame: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . isMainFrame 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#modifier_chain_expression#Left . onHttpAuthRequest ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onHttpAuthRequest => 事件回调 ` 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right ?. onHttpAuthRequest AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClientAuthenticationRequest ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onClientAuthenticationRequest AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onClientAuthenticationRequest => 事件回调 ` 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#modifier_chain_expression#Left . onRenderExited ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onRenderExited AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onRenderExited => 事件回调 ` 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#modifier_chain_expression#Left . onDownloadStart ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onDownloadStart AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onDownloadStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onDownloadStart => 事件回调 ` 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#modifier_chain_expression#Left . onShowFileSelector ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onShowFileSelector => 事件回调 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onShowFileSelector AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onShowFileSelector AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onPermissionRequest ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPermissionRequest AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPermissionRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onPermissionRequest => 事件回调 ` 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#modifier_chain_expression#Left . onGeolocationShow ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onGeolocationShow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onGeolocationShow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onGeolocationShow => 事件回调 ` 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#modifier_chain_expression#Left . onGeolocationHide ( 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 . webViewProxy AST#member_expression#Right AST#expression#Right . onGeolocationHide AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onGeolocationHide AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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#template_literal#Left ` onGeolocationHide => 事件回调 ` 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#modifier_chain_expression#Left . onFullScreenEnter ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFullScreenEnter AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFullScreenEnter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onFullScreenEnter => 事件回调 ` 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#modifier_chain_expression#Left . onFullScreenExit ( 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 . webViewProxy AST#member_expression#Right AST#expression#Right . onFullScreenExit AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFullScreenExit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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#template_literal#Left ` onFullScreenExit => 事件回调 ` 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#modifier_chain_expression#Left . onContextMenuShow ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onContextMenuShow => 事件回调 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onContextMenuShow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onContextMenuShow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onContextMenuHide ( 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 . webViewProxy AST#member_expression#Right AST#expression#Right . onContextMenuHide AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onContextMenuHide AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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#template_literal#Left ` onContextMenuHide => 事件回调 ` 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#modifier_chain_expression#Left . onScaleChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onScaleChange AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onScaleChange => changed from AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . oldScale AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right to AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . newScale 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#modifier_chain_expression#Left . onScroll ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onScroll AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onScroll => x= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . xOffset AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,y= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . yOffset 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#modifier_chain_expression#Left . onOverScroll ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onOverScroll AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onOverScroll => x= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . xOffset AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,y= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . yOffset 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#modifier_chain_expression#Left . onRequestSelected ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onRequestSelected AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onRequestSelected => 事件回调 ` 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#modifier_chain_expression#Left . onScreenCaptureRequest ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onScreenCaptureRequest AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onScreenCaptureRequest => 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 event AST#expression#Right . handler AST#member_expression#Right AST#expression#Right . getOrigin 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onWindowNew ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onWindowNew AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onWindowNew => 事件回调 ` 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#modifier_chain_expression#Left . onWindowExit ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onWindowExit AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onWindowExit => 事件回调 ` 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#modifier_chain_expression#Left . onResourceLoad ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onResourceLoad AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onResourceLoad => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#modifier_chain_expression#Left . onRefreshAccessedHistory ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onRefreshAccessedHistory AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onRefreshAccessedHistory => 事件回调 ` 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#modifier_chain_expression#Left . onBeforeUnload ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onBeforeUnload => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onBeforeUnload AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onRenderProcessNotResponding ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onRenderProcessNotResponding AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onRenderProcessNotResponding => 事件回调 ` 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#modifier_chain_expression#Left . onRenderProcessResponding ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onRenderProcessResponding AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onRenderProcessResponding => 事件回调 ` 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#modifier_chain_expression#Left . onSearchResultReceive ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onSearchResultReceive AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onSearchResultReceive => 事件回调 ` 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#modifier_chain_expression#Left . onDataResubmitted ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onDataResubmitted AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onDataResubmitted => 事件回调 ` 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#modifier_chain_expression#Left . onInterceptKeyEvent ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onInterceptKeyEvent => keyCode= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . keyCode 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onInterceptKeyEvent AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTouchIconUrlReceived ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onTouchIconUrlReceived AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onTouchIconUrlReceived => 事件回调 ` 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#modifier_chain_expression#Left . onFaviconReceived ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFaviconReceived AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onFaviconReceived => 事件回调 ` 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#modifier_chain_expression#Left . onAudioStateChanged ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onAudioStateChanged AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onAudioStateChanged => 事件回调 ` 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#modifier_chain_expression#Left . onFirstContentfulPaint ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFirstContentfulPaint AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onFirstContentfulPaint => 事件回调 ` 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#modifier_chain_expression#Left . onFirstMeaningfulPaint ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left paint AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onFirstMeaningfulPaint AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left paint 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onFirstMeaningfulPaint => 事件回调 ` 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#modifier_chain_expression#Left . onLargestContentfulPaint ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left paint AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onLargestContentfulPaint AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left paint 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onLargestContentfulPaint => 事件回调 ` 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#modifier_chain_expression#Left . onNavigationEntryCommitted ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left details AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onNavigationEntryCommitted AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left details 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onNavigationEntryCommitted => 事件回调 ` 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#modifier_chain_expression#Left . onNativeEmbedLifecycleChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onNativeEmbedLifecycleChange AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onNativeEmbedLifecycleChange => 事件回调 ` 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#modifier_chain_expression#Left . onNativeEmbedGestureEvent ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onNativeEmbedGestureEvent AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onNativeEmbedGestureEvent => 事件回调 ` 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#modifier_chain_expression#Left . onNativeEmbedVisibilityChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left info AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onNativeEmbedVisibilityChange AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left info 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onNativeEmbedVisibilityChange => 事件回调 ` 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#modifier_chain_expression#Left . onSafeBrowsingCheckResult ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left threatType AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onSafeBrowsingCheckResult AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left threatType 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onSafeBrowsingCheckResult => 事件回调 ` 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#modifier_chain_expression#Left . onIntelligentTrackingPreventionResult ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left details AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onIntelligentTrackingPreventionResult AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left details 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onNativeEmbedVisibilityChange => 事件回调 ` 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#modifier_chain_expression#Left . onViewportFitChanged ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left viewportFit AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onViewportFitChanged AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left viewportFit 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onViewportFitChanged => 事件回调 ` 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#modifier_chain_expression#Left . onInterceptKeyboardAttach ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left keyboardCallbackInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onInterceptKeyboardAttach => 事件回调 ` 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 option : AST#type_annotation#Left AST#primary_type#Left WebKeyboardOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left useSystemKeyboard AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //option初始化,默认使用系统默认键盘 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onInterceptKeyboardAttach AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left keyboardCallbackInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left option AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAdsBlocked ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left details AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onAdsBlocked AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onAdsBlocked AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left details AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onAdsBlocked => 事件回调 ` 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#modifier_chain_expression#Left . onAlert ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onAlert => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onAlert AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onAlert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onConfirm ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onConfirm => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onConfirm AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onConfirm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onPrompt ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onPrompt => AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . url AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . value 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onPrompt AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webViewProxy AST#member_expression#Right AST#expression#Right . onPrompt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onConsole ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onConsole => 事件回调 ` 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#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 . webViewProxy AST#member_expression#Right AST#expression#Right . onConsole AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#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
@ComponentV2 export struct WebView { @Require @Param webviewController: webview.WebviewController @Require @Param webviewSrc: ResourceStr @Param webViewOptions: WebViewOptions = new WebViewOptions() @Param webViewProxy: WebViewProxy = new BaseWebViewProxyImp() build() { Column() { Web({ src: this.webviewSrc, controller: this.webviewController }) .size({ width: '100%', height: '100%' }) .domStorageAccess(this.webViewOptions.domStorageAccess) .javaScriptAccess(this.webViewOptions.javaScriptAccess) .fileAccess(this.webViewOptions.fileAccess) .imageAccess(this.webViewOptions.imageAccess) .onlineImageAccess(this.webViewOptions.onlineImageAccess) .overScrollMode(this.webViewOptions.overScrollMode) .mixedMode(this.webViewOptions.mixedMode) .zoomAccess(this.webViewOptions.zoomAccess) .overviewModeAccess(this.webViewOptions.overviewModeAccess) .databaseAccess(this.webViewOptions.databaseAccess) .geolocationAccess(this.webViewOptions.geolocationAccess) .mediaPlayGestureAccess(this.webViewOptions.mediaPlayGestureAccess) .multiWindowAccess(this.webViewOptions.multiWindowAccess) .horizontalScrollBarAccess(this.webViewOptions.horizontalScrollBarAccess) .verticalScrollBarAccess(this.webViewOptions.verticalScrollBarAccess) .cacheMode(this.webViewOptions.cacheMode) .copyOptions(this.webViewOptions.copyOptions) .textZoomRatio(this.webViewOptions.textZoomRatio) .initialScale(this.webViewOptions.initialScale) .blockNetwork(this.webViewOptions.blockNetwork) .defaultFixedFontSize(this.webViewOptions.defaultFixedFontSize) .defaultFontSize(this.webViewOptions.defaultFontSize) .minFontSize(this.webViewOptions.minFontSize) .minLogicalFontSize(this.webViewOptions.minLogicalFontSize) .webFixedFont(this.webViewOptions.webFixedFont) .webSansSerifFont(this.webViewOptions.webSansSerifFont) .webSerifFont(this.webViewOptions.webSerifFont) .webStandardFont(this.webViewOptions.webStandardFont) .webFantasyFont(this.webViewOptions.webFantasyFont) .webCursiveFont(this.webViewOptions.webCursiveFont) .darkMode(this.webViewOptions.darkMode) .forceDarkAccess(this.webViewOptions.forceDarkAccess) .pinchSmooth(this.webViewOptions.pinchSmooth) .allowWindowOpenMethod(this.webViewOptions.allowWindowOpenMethod) .mediaOptions(this.webViewOptions.mediaOptions) .javaScriptOnDocumentStart(this.webViewOptions.javaScriptOnDocumentStart) .javaScriptOnDocumentEnd(this.webViewOptions.javaScriptOnDocumentEnd) .layoutMode(this.webViewOptions.layoutMode) .nestedScroll(this.webViewOptions.nestedScroll) .enableNativeEmbedMode(this.webViewOptions.enableNativeEmbedMode) .defaultTextEncodingFormat(this.webViewOptions.defaultTextEncodingFormat) .metaViewport(this.webViewOptions.metaViewport) .textAutosizing(this.webViewOptions.textAutosizing) .enableNativeMediaPlayer(this.webViewOptions.enableNativeMediaPlayer) .selectionMenuOptions(this.webViewOptions.selectionMenuOptions) .keyboardAvoidMode(this.webViewOptions.keyboardAvoidMode) .onControllerAttached(() => { this.webViewProxy.onControllerAttached?.(); Logger.debug(`onControllerAttached => 事件回调`); }) .onPageBegin((event) => { this.webViewProxy.onPageBegin?.(event); Logger.debug(`onPageBegin => ${event.url}`); }) .onPageEnd((event) => { this.webViewProxy.onPageEnd?.(event); }) .onProgressChange((event) => { this.webViewProxy.onProgressChange?.(event); Logger.debug(`onProgressChange => ${event.newProgress}`); }) .onPageVisible((event) => { this.webViewProxy.onPageVisible?.(event); Logger.debug(`onPageVisible => ${event.url}`); }) .onLoadIntercept((event) => { Logger.debug(`onLoadIntercept => 事件回调`); return this.webViewProxy.onLoadIntercept?.(event) ?? false; }) .onOverrideUrlLoading((request) => { Logger.debug(`onOverrideUrlLoading => 事件回调`); if (request && request.getRequestUrl() == "about:blank") { return true; } return this.webViewProxy.onOverrideUrlLoading?.(request) ?? false; }) .onInterceptRequest((event) => { Logger.debug(`onInterceptRequest => 事件回调`); return this.webViewProxy?.onInterceptRequest?.(event) ?? null; }) .onTitleReceive((event) => { this.webViewProxy.onTitleReceive?.(event); Logger.debug(`onTitleReceive => ${event.title}`); }) .onErrorReceive((event) => { this.webViewProxy.onErrorReceive?.(event); Logger.debug(`onErrorReceive => errorCode:${event.error.getErrorCode()} - errorMsg:${event.error.getErrorInfo()}`); }) .onHttpErrorReceive((event) => { this.webViewProxy.onHttpErrorReceive?.(event); Logger.debug(`onHttpErrorReceive => responseCode:${event.response.getResponseCode()}`); }) .onSslErrorEventReceive((event) => { this.webViewProxy.onSslErrorEventReceive?.(event); Logger.debug(`onSslErrorEventReceive => 事件回调`); }) .onSslErrorEvent((event) => { this.webViewProxy.onSslErrorEvent?.(event); Logger.debug(`onSslErrorEvent => isMainFrame:${event.isMainFrame}`); }) .onHttpAuthRequest((event) => { Logger.debug(`onHttpAuthRequest => 事件回调`); return this.webViewProxy?.onHttpAuthRequest?.(event) ?? true; }) .onClientAuthenticationRequest((event) => { this.webViewProxy.onClientAuthenticationRequest?.(event); Logger.debug(`onClientAuthenticationRequest => 事件回调`); }) .onRenderExited((event) => { this.webViewProxy.onRenderExited?.(event); Logger.debug(`onRenderExited => 事件回调`); }) .onDownloadStart((event) => { if (this.webViewProxy.onDownloadStart) { this.webViewProxy.onDownloadStart(event); } Logger.debug(`onDownloadStart => 事件回调`); }) .onShowFileSelector((event) => { Logger.debug(`onShowFileSelector => 事件回调`); if (this.webViewProxy.onShowFileSelector) { return this.webViewProxy.onShowFileSelector(event); } return false; }) .onPermissionRequest((event) => { if (this.webViewProxy.onPermissionRequest) { this.webViewProxy.onPermissionRequest(event); } Logger.debug(`onPermissionRequest => 事件回调`); }) .onGeolocationShow((event) => { if (this.webViewProxy.onGeolocationShow) { this.webViewProxy.onGeolocationShow(event); } Logger.debug(`onGeolocationShow => 事件回调`); }) .onGeolocationHide(() => { if (this.webViewProxy.onGeolocationHide) { this.webViewProxy.onGeolocationHide(); } Logger.debug(`onGeolocationHide => 事件回调`); }) .onFullScreenEnter((event) => { if (this.webViewProxy.onFullScreenEnter) { this.webViewProxy.onFullScreenEnter(event); } Logger.debug(`onFullScreenEnter => 事件回调`); }) .onFullScreenExit(() => { if (this.webViewProxy.onFullScreenExit) { this.webViewProxy.onFullScreenExit(); } Logger.debug(`onFullScreenExit => 事件回调`); }) .onContextMenuShow((event) => { Logger.debug(`onContextMenuShow => 事件回调`); if (this.webViewProxy.onContextMenuShow) { return this.webViewProxy.onContextMenuShow(event); } return false; }) .onContextMenuHide(() => { if (this.webViewProxy.onContextMenuHide) { this.webViewProxy.onContextMenuHide(); } Logger.debug(`onContextMenuHide => 事件回调`); }) .onScaleChange((event) => { this.webViewProxy.onScaleChange?.(event); Logger.debug(`onScaleChange => changed from ${event.oldScale} to ${event.newScale}`); }) .onScroll((event) => { this.webViewProxy.onScroll?.(event); Logger.debug(`onScroll => x=${event.xOffset},y=${event.yOffset}`); }) .onOverScroll((event) => { this.webViewProxy.onOverScroll?.(event); Logger.debug(`onOverScroll => x=${event.xOffset},y=${event.yOffset}`); }) .onRequestSelected(() => { this.webViewProxy.onRequestSelected?.(); Logger.debug(`onRequestSelected => 事件回调`); }) .onScreenCaptureRequest((event) => { this.webViewProxy.onScreenCaptureRequest?.(event); Logger.debug(`onScreenCaptureRequest => ${event.handler.getOrigin()}`); }) .onWindowNew((event) => { this.webViewProxy.onWindowNew?.(event); Logger.debug(`onWindowNew => 事件回调`); }) .onWindowExit(() => { this.webViewProxy.onWindowExit?.(); Logger.debug(`onWindowExit => 事件回调`); }) .onResourceLoad((event) => { this.webViewProxy.onResourceLoad?.(event); Logger.debug(`onResourceLoad => ${event.url}`); }) .onRefreshAccessedHistory((event) => { this.webViewProxy.onRefreshAccessedHistory?.(event); Logger.debug(`onRefreshAccessedHistory => 事件回调`); }) .onBeforeUnload((event) => { Logger.debug(`onBeforeUnload => ${event.url}`); return this.webViewProxy.onBeforeUnload?.(event) ?? false; }) .onRenderProcessNotResponding((event) => { this.webViewProxy.onRenderProcessNotResponding?.(event); Logger.debug(`onRenderProcessNotResponding => 事件回调`); }) .onRenderProcessResponding(() => { this.webViewProxy.onRenderProcessResponding?.(); Logger.debug(`onRenderProcessResponding => 事件回调`); }) .onSearchResultReceive((event) => { this.webViewProxy.onSearchResultReceive?.(event); Logger.debug(`onSearchResultReceive => 事件回调`); }) .onDataResubmitted((event) => { this.webViewProxy.onDataResubmitted?.(event); Logger.debug(`onDataResubmitted => 事件回调`); }) .onInterceptKeyEvent((event) => { Logger.debug(`onInterceptKeyEvent => keyCode=${event.keyCode}`); return this.webViewProxy.onInterceptKeyEvent?.(event) ?? false; }) .onTouchIconUrlReceived((event) => { this.webViewProxy.onTouchIconUrlReceived?.(event); Logger.debug(`onTouchIconUrlReceived => 事件回调`); }) .onFaviconReceived((event) => { this.webViewProxy.onFaviconReceived?.(event); Logger.debug(`onFaviconReceived => 事件回调`); }) .onAudioStateChanged((event) => { this.webViewProxy.onAudioStateChanged?.(event); Logger.debug(`onAudioStateChanged => 事件回调`); }) .onFirstContentfulPaint((event) => { this.webViewProxy.onFirstContentfulPaint?.(event); Logger.debug(`onFirstContentfulPaint => 事件回调`); }) .onFirstMeaningfulPaint((paint) => { this.webViewProxy.onFirstMeaningfulPaint?.(paint); Logger.debug(`onFirstMeaningfulPaint => 事件回调`); }) .onLargestContentfulPaint((paint) => { this.webViewProxy.onLargestContentfulPaint?.(paint); Logger.debug(`onLargestContentfulPaint => 事件回调`); }) .onNavigationEntryCommitted((details) => { this.webViewProxy.onNavigationEntryCommitted?.(details); Logger.debug(`onNavigationEntryCommitted => 事件回调`); }) .onNativeEmbedLifecycleChange((event) => { this.webViewProxy.onNativeEmbedLifecycleChange?.(event); Logger.debug(`onNativeEmbedLifecycleChange => 事件回调`); }) .onNativeEmbedGestureEvent((event) => { this.webViewProxy.onNativeEmbedGestureEvent?.(event); Logger.debug(`onNativeEmbedGestureEvent => 事件回调`); }) .onNativeEmbedVisibilityChange((info) => { this.webViewProxy.onNativeEmbedVisibilityChange?.(info); Logger.debug(`onNativeEmbedVisibilityChange => 事件回调`); }) .onSafeBrowsingCheckResult((threatType) => { this.webViewProxy.onSafeBrowsingCheckResult?.(threatType); Logger.debug(`onSafeBrowsingCheckResult => 事件回调`); }) .onIntelligentTrackingPreventionResult((details) => { this.webViewProxy.onIntelligentTrackingPreventionResult?.(details); Logger.debug(`onNativeEmbedVisibilityChange => 事件回调`); }) .onViewportFitChanged((viewportFit) => { this.webViewProxy.onViewportFitChanged?.(viewportFit); Logger.debug(`onViewportFitChanged => 事件回调`); }) .onInterceptKeyboardAttach((keyboardCallbackInfo) => { Logger.debug(`onInterceptKeyboardAttach => 事件回调`); const option: WebKeyboardOptions = { useSystemKeyboard: true }; return this.webViewProxy.onInterceptKeyboardAttach?.(keyboardCallbackInfo) ?? option; }) .onAdsBlocked((details) => { if (this.webViewProxy.onAdsBlocked) { this.webViewProxy.onAdsBlocked(details); } Logger.debug(`onAdsBlocked => 事件回调`); }) .onAlert((event) => { Logger.debug(`onAlert => ${event.url}`); if (this.webViewProxy.onAlert) { return this.webViewProxy.onAlert(event); } return true }) .onConfirm((event) => { Logger.debug(`onConfirm => ${event.url}`); if (this.webViewProxy.onConfirm) { return this.webViewProxy.onConfirm(event); } return true; }) .onPrompt((event) => { Logger.debug(`onPrompt => ${event.url} - ${event.value}`); if (this.webViewProxy.onPrompt) { return this.webViewProxy.onPrompt(event); } return true; }) .onConsole((event) => { Logger.debug(`onConsole => 事件回调`); return this.webViewProxy.onConsole?.(event) ?? false; }) } .size({ width: '100%', height: '100%' }) } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebView.ets#L13-L344
435abc774b71ea12dd7d7c87c6ff4fff2fffaf43
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
initializeAllReminders
初始化所有提醒
async initializeAllReminders(): Promise<void> { try { hilog.info(0x0000, 'SimpleNotificationManager', 'All reminders initialized (simplified version)'); } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize reminders'); } }
AST#method_declaration#Left async initializeAllReminders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'SimpleNotificationManager' AST#expression#Right , AST#expression#Left 'All reminders initialized (simplified version)' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'SimpleNotificationManager' AST#expression#Right , AST#expression#Left 'Failed to initialize reminders' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async initializeAllReminders(): Promise<void> { try { hilog.info(0x0000, 'SimpleNotificationManager', 'All reminders initialized (simplified version)'); } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize reminders'); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L177-L183
be5bfda2fcb1398ab28787aa8aba543adb6e2d6b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets
arkts
歌词数据类,待扩展
export class LyricsDataSource implements IDataSource { private lyricsTimeArr: Array<number> = []; private lyricsDataArr: Array<string> = []; constructor(lrcRes: string) { this.initLyricsDataArr(lrcRes); } async initLyricsDataArr(lrcRes: string) { const resourceManager = getContext().resourceManager; const lrcUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(lrcRes); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const lrcStr: string = textDecoder.decodeToString(lrcUInt8Arr, { stream: false }); const lrcStrArr = lrcStr.split('\n'); lrcStrArr.forEach((str) => { const strArrTmp = str.split(']'); // 每句歌词对应的时间,换算成毫秒 const timeStr = strArrTmp[0].substring(1); const timeStrArrTmp = timeStr.split(':'); const timeRaw = parseInt(timeStrArrTmp[0]) * CommonConstants.SECONDS_IN_MINUTE + parseFloat(timeStrArrTmp[1]); this.lyricsTimeArr.push(timeRaw * 1000); // 每句歌词数据 const lrcStrRaw = strArrTmp[1]; this.lyricsDataArr.push(lrcStrRaw); }) } getTimeByIndex(index: number): number { return this.lyricsTimeArr[index] || 0; } checkCurLine(time: number): number { let checkLineIndex = 0; while (checkLineIndex < this.lyricsTimeArr.length) { const checkLineTime = this.lyricsTimeArr[checkLineIndex]; if (time < checkLineTime) { checkLineIndex--; break; } checkLineIndex++; } return checkLineIndex; } totalCount(): number { return this.lyricsDataArr.length; } getData(index: number): string { return this.lyricsDataArr[index]; } registerDataChangeListener(listener: DataChangeListener): void { } unregisterDataChangeListener(listener: DataChangeListener): void { } }
AST#export_declaration#Left export AST#class_declaration#Left class LyricsDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private lyricsTimeArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private lyricsDataArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left lrcRes : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initLyricsDataArr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lrcRes 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#constructor_declaration#Right AST#method_declaration#Left async initLyricsDataArr AST#parameter_list#Left ( AST#parameter#Left lrcRes : 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 resourceManager = 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#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager 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 lrcUInt8Arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left resourceManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lrcRes 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 textDecoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lrcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textDecoder AST#expression#Right . decodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lrcUInt8Arr AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream 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#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 lrcStrArr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lrcStr AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '\n' 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 lrcStrArr AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left str AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left strArrTmp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . split 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 每句歌词对应的时间,换算成毫秒 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left strArrTmp AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeStrArrTmp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left timeStr AST#expression#Right . split 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeRaw = AST#expression#Left AST#call_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 parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left timeStrArrTmp AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SECONDS_IN_MINUTE AST#member_expression#Right AST#expression#Right + AST#expression#Left parseFloat AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left timeStrArrTmp AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsTimeArr AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left timeRaw AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 每句歌词数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lrcStrRaw = AST#expression#Left AST#subscript_expression#Left AST#expression#Left strArrTmp AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsDataArr AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lrcStrRaw AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getTimeByIndex 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 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#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsTimeArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left checkCurLine AST#parameter_list#Left ( AST#parameter#Left time : 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 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 checkLineIndex = AST#expression#Left 0 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left checkLineIndex AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lyricsTimeArr AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left checkLineTime = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsTimeArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left checkLineIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right < AST#expression#Left checkLineTime 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#update_expression#Left AST#expression#Left checkLineIndex AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left checkLineIndex AST#expression#Right ++ AST#update_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#return_statement#Left return AST#expression#Left checkLineIndex AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsDataArr AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lyricsDataArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class LyricsDataSource implements IDataSource { private lyricsTimeArr: Array<number> = []; private lyricsDataArr: Array<string> = []; constructor(lrcRes: string) { this.initLyricsDataArr(lrcRes); } async initLyricsDataArr(lrcRes: string) { const resourceManager = getContext().resourceManager; const lrcUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(lrcRes); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const lrcStr: string = textDecoder.decodeToString(lrcUInt8Arr, { stream: false }); const lrcStrArr = lrcStr.split('\n'); lrcStrArr.forEach((str) => { const strArrTmp = str.split(']'); const timeStr = strArrTmp[0].substring(1); const timeStrArrTmp = timeStr.split(':'); const timeRaw = parseInt(timeStrArrTmp[0]) * CommonConstants.SECONDS_IN_MINUTE + parseFloat(timeStrArrTmp[1]); this.lyricsTimeArr.push(timeRaw * 1000); const lrcStrRaw = strArrTmp[1]; this.lyricsDataArr.push(lrcStrRaw); }) } getTimeByIndex(index: number): number { return this.lyricsTimeArr[index] || 0; } checkCurLine(time: number): number { let checkLineIndex = 0; while (checkLineIndex < this.lyricsTimeArr.length) { const checkLineTime = this.lyricsTimeArr[checkLineIndex]; if (time < checkLineTime) { checkLineIndex--; break; } checkLineIndex++; } return checkLineIndex; } totalCount(): number { return this.lyricsDataArr.length; } getData(index: number): string { return this.lyricsDataArr[index]; } registerDataChangeListener(listener: DataChangeListener): void { } unregisterDataChangeListener(listener: DataChangeListener): void { } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets#L22-L82
7de98708402dbcb49200e3b650bf4b2a9e679dba
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/DateHelper.ets
arkts
getDays
获取指定月份的天数
static getDays(year: number, month: number): number { if (month == 2) { if (DateHelper.isLeapYear(year)) { return 29; } else { return 28; } } else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { return 31; } else { return 30; } }
AST#method_declaration#Left static getDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left month 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateHelper AST#expression#Right . isLeapYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 29 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 28 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( 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#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month 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#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right == AST#expression#Left 12 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#return_statement#Left return AST#expression#Left 31 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 30 AST#expression#Right ; AST#return_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#method_declaration#Right
static getDays(year: number, month: number): number { if (month == 2) { if (DateHelper.isLeapYear(year)) { return 29; } else { return 28; } } else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { return 31; } else { return 30; } }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L19-L31
ea9d509e9485a1f4166d6c8c35258e3271d27e59
github
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/pages/Index.ets
arkts
saveCurrentCity
保存当前城市到存储
async saveCurrentCity() { try { await StorageUtil.saveSelectedCity(this.currentCity, this.cityId); console.log('城市已保存到存储'); } catch (error) { console.error('保存城市失败:', JSON.stringify(error)); } }
AST#method_declaration#Left async saveCurrentCity 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#await_expression#Left await AST#expression#Left StorageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . saveSelectedCity 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 . currentCity AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '保存城市失败:' AST#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 error 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async saveCurrentCity() { try { await StorageUtil.saveSelectedCity(this.currentCity, this.cityId); console.log('城市已保存到存储'); } catch (error) { console.error('保存城市失败:', JSON.stringify(error)); } }
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L121-L128
41ebcd43f5f2c4486a3f8128a79704902123c6b6
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
parseSelectedGoodsList
解析已选商品列表 @param {SelectedGoodsJson[]} jsonList JSON 数据列表 @returns {SelectedGoods[]} 已选商品列表
private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] { const result: SelectedGoods[] = []; for (const item of jsonList) { const selectedGoods = new SelectedGoods(); selectedGoods.goodsId = item.goodsId ?? 0; selectedGoods.count = item.count ?? 0; // 解析商品信息 if (item.goodsInfo) { const goodsInfo = new Goods(); goodsInfo.id = item.goodsInfo.id ?? 0; goodsInfo.title = item.goodsInfo.title ?? ""; goodsInfo.mainPic = item.goodsInfo.mainPic ?? ""; selectedGoods.goodsInfo = goodsInfo; } // 解析规格信息 if (item.spec) { const spec = new GoodsSpec(); spec.id = item.spec.id ?? 0; spec.goodsId = item.spec.goodsId ?? 0; spec.name = item.spec.name ?? ""; spec.price = item.spec.price ?? 0; spec.stock = item.spec.stock ?? 0; spec.images = item.spec.images ?? null; selectedGoods.spec = spec; } result.push(selectedGoods); } return result; }
AST#method_declaration#Left private parseSelectedGoodsList AST#parameter_list#Left ( AST#parameter#Left jsonList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoodsJson [ ] 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 SelectedGoods [ ] 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 result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const item of AST#expression#Left jsonList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left selectedGoods = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SelectedGoods AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left selectedGoods AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 selectedGoods AST#expression#Right . count AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . count AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 解析商品信息 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left goodsInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Goods AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left goodsInfo AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 goodsInfo AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left goodsInfo AST#expression#Right . mainPic AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right . mainPic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left selectedGoods AST#expression#Right . goodsInfo AST#member_expression#Right = AST#expression#Left goodsInfo AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 解析规格信息 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left spec = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GoodsSpec AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 spec AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 spec AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . price AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 spec AST#expression#Right . stock AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 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 spec AST#expression#Right . images AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . images AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 selectedGoods AST#expression#Right . spec AST#member_expression#Right = AST#expression#Left spec 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 result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left selectedGoods 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 result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] { const result: SelectedGoods[] = []; for (const item of jsonList) { const selectedGoods = new SelectedGoods(); selectedGoods.goodsId = item.goodsId ?? 0; selectedGoods.count = item.count ?? 0; if (item.goodsInfo) { const goodsInfo = new Goods(); goodsInfo.id = item.goodsInfo.id ?? 0; goodsInfo.title = item.goodsInfo.title ?? ""; goodsInfo.mainPic = item.goodsInfo.mainPic ?? ""; selectedGoods.goodsInfo = goodsInfo; } if (item.spec) { const spec = new GoodsSpec(); spec.id = item.spec.id ?? 0; spec.goodsId = item.spec.goodsId ?? 0; spec.name = item.spec.name ?? ""; spec.price = item.spec.price ?? 0; spec.stock = item.spec.stock ?? 0; spec.images = item.spec.images ?? null; selectedGoods.spec = spec; } result.push(selectedGoods); } return result; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L199-L232
fbc5c4fd82ab6d5dfbcd5075a9407dc13b6af213
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/RowAttribute.ets
arkts
获取横向两端分布 + 垂直底部的 Row 对齐修饰器 @returns {AttributeModifier<RowAttribute>} Row 对齐修饰器 @example Row() { Text("A"); Text("B"); }.attributeModifier(rowSpaceBetweenBottom());
export function rowSpaceBetweenBottom(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.SpaceBetween); instance.alignItems(VerticalAlign.Bottom); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function rowSpaceBetweenBottom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left applyNormalAttribute AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance 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 . Bottom 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function rowSpaceBetweenBottom(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.SpaceBetween); instance.alignItems(VerticalAlign.Bottom); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L177-L184
d23ac9979cb607bb55b5c3ec342ba7724e72a6c5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/DESSync.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param aesKey 3DES密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeCBC(str: string, desKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . encodeCBC AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left desKey AST#expression#Right , AST#expression#Left iv AST#expression#Right , AST#expression#Left '3DES192' AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' AST#expression#Right , AST#expression#Left 192 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encodeCBC(str: string, desKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L60-L63
a31399424be2917ae1c4d41037b416d331e0cd83
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/SkeletonLayout.ets
arkts
SkeletonLayout
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.
@Component @Reusable export struct SkeletonLayout { isMine: boolean = false; aboutToReuse(params: Record<string, object>): void { } build() { Row() { Column() { Column({ space: 4 }) { // 标题 textArea($r('app.float.custom_animation_tab_ske_card_title_height')) // 内容 textArea($r('app.float.custom_animation_tab_ske_card_text_height')) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) // 判断是否自己作品来适配不同骨架布局 if (!this.isMine) { Row() { // 浏览量 actionArea() // 点赞数 actionArea() // 收藏量 actionArea() } .padding({ top: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) .height($r('app.float.custom_animation_tab_ske_row_height')) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .justifyContent(FlexAlign.SpaceBetween) } else { Row({ space: 12 }) { // 摄影作品标签 Row() .width($r('app.float.custom_animation_tab_ske_lg_topic_width')) .topicStyle() // 自然风光标签 Row() .width($r('app.float.custom_animation_tab_ske_lg_topic_width')) .topicStyle() } .padding({ top: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) .height($r('app.float.custom_animation_tab_ske_row_height')) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .justifyContent(FlexAlign.Start) } } .layoutWeight(1) .height($r('app.string.custom_animation_tab_one_hundred_percent')) Row() .backgroundColor($r('app.color.custom_animation_tab_skeleton_color_light')) .borderRadius($r('app.float.custom_animation_tab_ske_small_border_radius')) .width($r('app.float.custom_animation_tab_ske_image_width')) .height($r('app.float.custom_animation_tab_ske_image_height')) .margin({ left: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) } .padding($r('app.float.custom_animation_tab_ske_md_padding_margin')) .borderRadius($r('app.float.custom_animation_tab_ske_large_border_radius')) .backgroundColor(Color.White) .alignItems(VerticalAlign.Top) .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .height($r('app.float.custom_animation_tab_ske_card_height')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Reusable AST#decorator#Right export struct SkeletonLayout AST#component_body#Left { AST#property_declaration#Left isMine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } 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 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 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 textArea ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_card_title_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 内容 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left textArea ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_card_text_height' AST#expression#Right ) AST#resource_expression#Right 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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isMine AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 浏览量 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left actionArea ( ) 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 actionArea ( ) 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 actionArea ( ) 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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_md_padding_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_row_height' 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.custom_animation_tab_one_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 摄影作品标签 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_lg_topic_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . topicStyle ( ) 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_lg_topic_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . topicStyle ( ) 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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_md_padding_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_row_height' 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.custom_animation_tab_one_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_animation_tab_one_hundred_percent' 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 Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_animation_tab_skeleton_color_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_small_border_radius' 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.float.custom_animation_tab_ske_image_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_md_padding_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_md_padding_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_animation_tab_ske_large_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_animation_tab_one_hundred_percent' 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.custom_animation_tab_ske_card_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component @Reusable export struct SkeletonLayout { isMine: boolean = false; aboutToReuse(params: Record<string, object>): void { } build() { Row() { Column() { Column({ space: 4 }) { textArea($r('app.float.custom_animation_tab_ske_card_title_height')) textArea($r('app.float.custom_animation_tab_ske_card_text_height')) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) if (!this.isMine) { Row() { actionArea() actionArea() actionArea() } .padding({ top: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) .height($r('app.float.custom_animation_tab_ske_row_height')) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .justifyContent(FlexAlign.SpaceBetween) } else { Row({ space: 12 }) { Row() .width($r('app.float.custom_animation_tab_ske_lg_topic_width')) .topicStyle() Row() .width($r('app.float.custom_animation_tab_ske_lg_topic_width')) .topicStyle() } .padding({ top: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) .height($r('app.float.custom_animation_tab_ske_row_height')) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .justifyContent(FlexAlign.Start) } } .layoutWeight(1) .height($r('app.string.custom_animation_tab_one_hundred_percent')) Row() .backgroundColor($r('app.color.custom_animation_tab_skeleton_color_light')) .borderRadius($r('app.float.custom_animation_tab_ske_small_border_radius')) .width($r('app.float.custom_animation_tab_ske_image_width')) .height($r('app.float.custom_animation_tab_ske_image_height')) .margin({ left: $r('app.float.custom_animation_tab_ske_md_padding_margin') }) } .padding($r('app.float.custom_animation_tab_ske_md_padding_margin')) .borderRadius($r('app.float.custom_animation_tab_ske_large_border_radius')) .backgroundColor(Color.White) .alignItems(VerticalAlign.Top) .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.custom_animation_tab_one_hundred_percent')) .height($r('app.float.custom_animation_tab_ske_card_height')) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/SkeletonLayout.ets#L16-L85
6074b90093df4440392d9944cee2061d0fc3ae26
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getStatusColor
获取状态颜色
getStatusColor(): string { switch (this.status) { case OfferStatus.PENDING: return '#faad14'; case OfferStatus.RECEIVED: return '#1890ff'; case OfferStatus.ACCEPTED: return '#52c41a'; case OfferStatus.REJECTED: return '#ff4d4f'; case OfferStatus.EXPIRED: return '#d9d9d9'; default: return '#d9d9d9'; } }
AST#method_declaration#Left getStatusColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . PENDING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#faad14' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . RECEIVED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#1890ff' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . ACCEPTED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#52c41a' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . REJECTED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#ff4d4f' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OfferStatus AST#expression#Right . EXPIRED AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#d9d9d9' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#d9d9d9' AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
getStatusColor(): string { switch (this.status) { case OfferStatus.PENDING: return '#faad14'; case OfferStatus.RECEIVED: return '#1890ff'; case OfferStatus.ACCEPTED: return '#52c41a'; case OfferStatus.REJECTED: return '#ff4d4f'; case OfferStatus.EXPIRED: return '#d9d9d9'; default: return '#d9d9d9'; } }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L142-L157
5118d128af3d157ed6e387ef17aee5221d39e4d0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets
arkts
onFocusIndexChange
toast弹窗时长 更新中间变量
onFocusIndexChange() { this.middleIndex = this.focusIndex; }
AST#method_declaration#Left onFocusIndexChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . middleIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_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
onFocusIndexChange() { this.middleIndex = this.focusIndex; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets#L33-L35
f9552296f7a393ebbd4ce9f39c0f4f7eaad580d6
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/tabs_actions.ets
arkts
Web and Tabs Returns true if the current tab is doing in-page searching. @param storage The LocalStorage. @returns True if is searching, false otherwise.
export function is_current_in_page_searching(storage: LocalStorage) { return storage.get('current_in_page_searching_stats_total') as number > 0; }
AST#export_declaration#Left export AST#function_declaration#Left function is_current_in_page_searching AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_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 storage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'current_in_page_searching_stats_total' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_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 is_current_in_page_searching(storage: LocalStorage) { return storage.get('current_in_page_searching_stats_total') as number > 0; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L140-L142
a0d87e7deab0126bb21c9bb33ebeeacd59b6f4b9
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
common/component.ets
arkts
AppGrid
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 { AppGrid, AppName, AppIcon, AppMenu, AppBubble, ScrollerComponent, RemoveFormDialog, UninstallDialog, FolderComponent, FormManagerDialog, FormItemComponent, RemoteWindowWrapper } from './src/main/ets/default/uicomponents';
AST#export_declaration#Left export { AppGrid , AppName , AppIcon , AppMenu , AppBubble , ScrollerComponent , RemoveFormDialog , UninstallDialog , FolderComponent , FormManagerDialog , FormItemComponent , RemoteWindowWrapper } from './src/main/ets/default/uicomponents' ; AST#export_declaration#Right
export { AppGrid, AppName, AppIcon, AppMenu, AppBubble, ScrollerComponent, RemoveFormDialog, UninstallDialog, FolderComponent, FormManagerDialog, FormItemComponent, RemoteWindowWrapper } from './src/main/ets/default/uicomponents';
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/component.ets#L16-L29
05f77a8bfe2cf65302acd5627e89c3a4252d5b31
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildUserMessage
构建用户消息
@Builder buildUserMessage(message: ChatMessage) { Column({ space: 8 }) { Column() { Text(message.content) .fontSize(14) .fontColor(Color.White) .lineHeight(20) .maxLines(10) } .padding(12) .backgroundColor($r('app.color.primary')) .borderRadius(16) .constraintSize({ maxWidth: '75%' }) // 时间戳 Text(this.formatMessageTime(message.timestamp)) .fontSize(10) .fontColor($r('app.color.text_secondary')) .alignSelf(ItemAlign.End) } .alignItems(HorizontalAlign.End) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 10 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 . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxWidth AST#property_name#Right : AST#expression#Left '75%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 时间戳 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatMessageTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildUserMessage(message: ChatMessage) { Column({ space: 8 }) { Column() { Text(message.content) .fontSize(14) .fontColor(Color.White) .lineHeight(20) .maxLines(10) } .padding(12) .backgroundColor($r('app.color.primary')) .borderRadius(16) .constraintSize({ maxWidth: '75%' }) Text(this.formatMessageTime(message.timestamp)) .fontSize(10) .fontColor($r('app.color.text_secondary')) .alignSelf(ItemAlign.End) } .alignItems(HorizontalAlign.End) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L192-L214
6ef6be8cd89f917f0121b80c0cdeaf46f549e4d9
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DisplayUtil.ets
arkts
getWidth
获取设备的屏幕宽度,单位为px。 @returns
static getWidth(): number { return DisplayUtil.getDefaultDisplaySync().width; }
AST#method_declaration#Left static getWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DisplayUtil AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getWidth(): number { return DisplayUtil.getDefaultDisplaySync().width; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L63-L65
7dd0c091b607ebed5e28c27461449652d910464e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets
arkts
PowerManager
Copyright (c) 2023-2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { PowerManager } from './src/main/ets/capabilities/PowerManager';
AST#export_declaration#Left export { PowerManager } from './src/main/ets/capabilities/PowerManager' ; AST#export_declaration#Right
export { PowerManager } from './src/main/ets/capabilities/PowerManager';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets#L16-L16
c3cea8899471e447d774a3591d0f5666dfe38014
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets
arkts
getAddressJson
获取省市区信息的json文件数据 @param mockFileDir 要传入的json文件。这里指存放在rawfile下的address.json @returns 返回json中省信息数组
static getAddressJson(mockFileDir: string): Array<Province> { const jsonObj: JsonObject = new JsonObject(mockFileDir); const modelMockData: Array<Province> = jsonObj.getAddressData(); return modelMockData; }
AST#method_declaration#Left static getAddressJson AST#parameter_list#Left ( AST#parameter#Left mockFileDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Province 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 jsonObj : AST#type_annotation#Left AST#primary_type#Left JsonObject 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 JsonObject AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mockFileDir 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 modelMockData : 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 Province AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonObj AST#expression#Right . getAddressData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left modelMockData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getAddressJson(mockFileDir: string): Array<Province> { const jsonObj: JsonObject = new JsonObject(mockFileDir); const modelMockData: Array<Province> = jsonObj.getAddressData(); return modelMockData; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets#L28-L32
8b89d42fb3b8e4826f30e97443d608c10b0451a9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets
arkts
sendHttpRequest
[Start request_interface_development] 封装普通的 HTTP 请求逻辑
private sendHttpRequest(): void { this.normalReqResult = $r('app.string.testing'); let httpRequest = http.createHttp(); // 订阅HTTP响应头 httpRequest.on('headersReceive', (header) => { Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`); }); httpRequest.request( // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 TARGET_URL, { method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET // 开发者根据自身业务需要添加header字段 header: { 'contentType': 'application/json' }, // 当使用POST请求时此字段用于传递请求体内容,具体格式与服务端协商确定 extraData: 'data to send', expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 usingCache: true, // 可选,默认为true priority: 1, // 可选,默认为1 connectTimeout: 60000, // 可选,默认为60000ms readTimeout: 60000, // 可选,默认为60000ms usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 usingProxy: false, // 可选,默认不使用网络代理,自API 10开始支持该属性 // caPath:'/path/to/cacert.pem', // 可选,默认使用系统预制证书,自API 10开始支持该属性 // clientCert: { // 可选,默认不使用客户端证书,自API 11开始支持该属性 // certPath: '/path/to/client.pem', // 默认不使用客户端证书,自API 11开始支持该属性 // keyPath: '/path/to/client.key', // 若证书包含Key信息,传入空字符串,自API 11开始支持该属性 // certType: http.CertType.PEM, // 可选,默认使用PEM,自API 11开始支持该属性 // keyPassword: "passwordToKey" // 可选,输入key文件的密码,自API 11开始支持该属性 // }, multiFormDataList: [ // 可选,仅当Header中,'content-Type'为'multipart/form-data'时生效,自API 11开始支持该属性 { name: 'Part1', // 数据名,自API 11开始支持该属性 contentType: 'text/plain', // 数据类型,自API 11开始支持该属性 data: 'Example data', // 可选,数据内容,自API 11开始支持该属性 remoteFileName: 'example.txt' // 可选,自API 11开始支持该属性 }, { name: 'Part2', // 数据名,自API 11开始支持该属性 contentType: 'text/plain', // 数据类型,自API 11开始支持该属性 // data/app/el2/100/base/com.example.myapplication/haps/entry/files/fileName.txt filePath: `${getContext(this).filesDir}/fileName.txt`, // 可选,传入文件路径,自API 11开始支持该属性 remoteFileName: 'fileName.txt' // 可选,自API 11开始支持该属性 } ] }, (err: BusinessError, data: http.HttpResponse) => { if (!err) { // 请求成功,处理响应结果 this.normalReqResult = $r('app.string.httpSendSuccess'); promptAction.showToast({ message: this.normalReqResult, duration: 4000, // 持续时间 bottom: 300 // 与底间隔 }); Logger.info(`${LOG_TAG} Result: ${JSON.stringify(data.result)}`); Logger.info(`${LOG_TAG} code: ${JSON.stringify(data.responseCode)}`); Logger.info(`${LOG_TAG} header: ${JSON.stringify(data.header)}`); Logger.info(`${LOG_TAG} cookies: ${JSON.stringify(data.cookies)}`); httpRequest.destroy(); } else { this.normalReqResult = 'error:' + JSON.stringify(err); promptAction.showToast({ message: this.normalReqResult, duration: 4000, // 持续时间 bottom: 300 // 与底间隔 }); // 请求失败,处理错误 Logger.error(`${LOG_TAG} error: ${JSON.stringify(err)}`); // 取消订阅HTTP响应头事件 httpRequest.off('headersReceive'); // 当该请求使用完毕时,调用destroy方法主动销毁 httpRequest.destroy(); } } ); }
AST#method_declaration#Left private sendHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . normalReqResult AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.testing' 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#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 订阅HTTP响应头 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'headersReceive' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left header AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left LOG_TAG AST#expression#Right } AST#template_substitution#Right header: 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 header 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 AST#expression#Left TARGET_URL AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 可选,默认为http.RequestMethod.GET // 开发者根据自身业务需要添加header字段 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 'contentType' 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 , // 当使用POST请求时此字段用于传递请求体内容,具体格式与服务端协商确定 AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left 'data to send' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expectDataType 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 . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 可选,指定返回数据的类型 AST#property_assignment#Left AST#property_name#Left usingCache AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , // 可选,默认为true AST#property_assignment#Left AST#property_name#Left priority AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 可选,默认为1 AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left 60000 AST#expression#Right AST#property_assignment#Right , // 可选,默认为60000ms AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left 60000 AST#expression#Right AST#property_assignment#Right , // 可选,默认为60000ms AST#property_assignment#Left AST#property_name#Left usingProtocol 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 . HttpProtocol AST#member_expression#Right AST#expression#Right . HTTP1_1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 可选,协议类型默认值由系统自动指定 AST#property_assignment#Left AST#property_name#Left usingProxy AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , // 可选,默认不使用网络代理,自API 10开始支持该属性 // caPath:'/path/to/cacert.pem', // 可选,默认使用系统预制证书,自API 10开始支持该属性 // clientCert: { // 可选,默认不使用客户端证书,自API 11开始支持该属性 // certPath: '/path/to/client.pem', // 默认不使用客户端证书,自API 11开始支持该属性 // keyPath: '/path/to/client.key', // 若证书包含Key信息,传入空字符串,自API 11开始支持该属性 // certType: http.CertType.PEM, // 可选,默认使用PEM,自API 11开始支持该属性 // keyPassword: "passwordToKey" // 可选,输入key文件的密码,自API 11开始支持该属性 // }, AST#property_assignment#Left AST#property_name#Left multiFormDataList AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ // 可选,仅当Header中,'content-Type'为'multipart/form-data'时生效,自API 11开始支持该属性 AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'Part1' AST#expression#Right AST#property_assignment#Right , // 数据名,自API 11开始支持该属性 AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left 'text/plain' AST#expression#Right AST#property_assignment#Right , // 数据类型,自API 11开始支持该属性 AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left 'Example data' AST#expression#Right AST#property_assignment#Right , // 可选,数据内容,自API 11开始支持该属性 AST#property_assignment#Left AST#property_name#Left remoteFileName AST#property_name#Right : AST#expression#Left 'example.txt' AST#expression#Right AST#property_assignment#Right // 可选,自API 11开始支持该属性 } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'Part2' AST#expression#Right AST#property_assignment#Right , // 数据名,自API 11开始支持该属性 AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left 'text/plain' AST#expression#Right AST#property_assignment#Right , // 数据类型,自API 11开始支持该属性 // data/app/el2/100/base/com.example.myapplication/haps/entry/files/fileName.txt AST#property_assignment#Left AST#property_name#Left filePath AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#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 . filesDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /fileName.txt ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , // 可选,传入文件路径,自API 11开始支持该属性 AST#property_assignment#Left AST#property_name#Left remoteFileName AST#property_name#Right : AST#expression#Left 'fileName.txt' AST#expression#Right AST#property_assignment#Right // 可选,自API 11开始支持该属性 } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right 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#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#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left err AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 请求成功,处理响应结果 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . normalReqResult AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.httpSendSuccess' 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . normalReqResult AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 4000 AST#expression#Right AST#property_assignment#Right , // 持续时间 AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right // 与底间隔 } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 LOG_TAG AST#expression#Right } AST#template_substitution#Right Result: 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 data AST#expression#Right . result 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 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 LOG_TAG AST#expression#Right } AST#template_substitution#Right code: 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 data AST#expression#Right . responseCode 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 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 LOG_TAG AST#expression#Right } AST#template_substitution#Right header: 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 data AST#expression#Right . header 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 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 LOG_TAG AST#expression#Right } AST#template_substitution#Right cookies: 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 data AST#expression#Right . cookies 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 httpRequest 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#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . normalReqResult AST#member_expression#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 'error:' 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#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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . normalReqResult AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 4000 AST#expression#Right AST#property_assignment#Right , // 持续时间 AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right // 与底间隔 } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 请求失败,处理错误 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 LOG_TAG AST#expression#Right } AST#template_substitution#Right 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 // 取消订阅HTTP响应头事件 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'headersReceive' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 当该请求使用完毕时,调用destroy方法主动销毁 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest 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#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private sendHttpRequest(): void { this.normalReqResult = $r('app.string.testing'); let httpRequest = http.createHttp(); httpRequest.on('headersReceive', (header) => { Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`); }); httpRequest.request( TARGET_URL, { method: http.RequestMethod.POST, header: { 'contentType': 'application/json' }, extraData: 'data to send', expectDataType: http.HttpDataType.STRING, usingCache: true, priority: 1, connectTimeout: 60000, readTimeout: 60000, usingProtocol: http.HttpProtocol.HTTP1_1, usingProxy: false, multiFormDataList: [ { name: 'Part1', contentType: 'text/plain', data: 'Example data', remoteFileName: 'example.txt' }, { name: 'Part2', contentType: 'text/plain', filePath: `${getContext(this).filesDir}/fileName.txt`, remoteFileName: 'fileName.txt' } ] }, (err: BusinessError, data: http.HttpResponse) => { if (!err) { this.normalReqResult = $r('app.string.httpSendSuccess'); promptAction.showToast({ message: this.normalReqResult, duration: 4000, bottom: 300 }); Logger.info(`${LOG_TAG} Result: ${JSON.stringify(data.result)}`); Logger.info(`${LOG_TAG} code: ${JSON.stringify(data.responseCode)}`); Logger.info(`${LOG_TAG} header: ${JSON.stringify(data.header)}`); Logger.info(`${LOG_TAG} cookies: ${JSON.stringify(data.cookies)}`); httpRequest.destroy(); } else { this.normalReqResult = 'error:' + JSON.stringify(err); promptAction.showToast({ message: this.normalReqResult, duration: 4000, bottom: 300 }); Logger.error(`${LOG_TAG} error: ${JSON.stringify(err)}`); httpRequest.off('headersReceive'); httpRequest.destroy(); } } ); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets#L74-L154
5819ffb1709560785a60d9af0b05195be9aee346
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets
arkts
GridSceneView
示例Grid中子组件数目 实现Grid场景,拖拽交换子组件位置: 通过editMode()打开编辑模式、通过onItemDragStart() 指定拖拽时样式、通过onItemDrop()指定拖拽释放时的行为
@Component export struct GridSceneView { @State movedItem: AppInfo = new AppInfo(); @State dataSource: DataSource = new DataSource(); aboutToAppear() { for (let index = 1; index <= ICON_NUM_IN_GRID; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`), `App${index}`)); } } build() { Column() { Text($r("app.string.drag_and_exchange_grid_drag_title")) .fontColor(Color.White) .textAlign(TextAlign.Center) .fontSize($r("app.string.drag_and_exchange_opt_title_font_size")) Row() { Grid() { // TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料: // https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ LazyForEach(this.dataSource, (item: AppInfo) => { GridItem() { IconWithNameView({ app: item }); } .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_layout_70")) }, (item: AppInfo) => item.name.toString()) } .columnsTemplate('1fr 1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr 1fr') .columnsGap($r("app.string.drag_and_exchange_layout_10")) .rowsGap($r("app.string.drag_and_exchange_layout_10")) .editMode(true) // TODO:知识点:设置Grid进入编辑模式,方可拖拽Grid组件内部GridItem .onItemDragStart((event: ItemDragInfo, itemIndex: number) => { // TODO:知识点:在Grid层,通过onItemDragStart实现拖拽开始时的回调行为 this.movedItem = this.dataSource.getData(itemIndex); return this.itemWhileDrag(); //设置拖拽过程中显示的图形 }) .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { // TODO:知识点:在Grid层,通过onItemDrop实现拖拽结束后的回调行为 // isSuccess=false时,说明drop的位置在grid外部;insertIndex > length时,说明有新增元素的事件发生 if (isSuccess && insertIndex < this.dataSource.totalCount()) { let temp: AppInfo = this.dataSource.getData(itemIndex); this.dataSource.setData(itemIndex, this.dataSource.getData(insertIndex)); this.dataSource.setData(insertIndex, temp); this.dataSource.notifyDataReload(); } }) .padding({ top: $r("app.string.drag_and_exchange_layout_10"), bottom: $r("app.string.drag_and_exchange_layout_10"), left: $r("app.string.drag_and_exchange_layout_5"), right: $r("app.string.drag_and_exchange_layout_5") }) } .width($r("app.string.drag_and_exchange_layout_90_percent")) .height($r("app.string.drag_and_exchange_layout_250")) .borderRadius($r("app.string.drag_and_exchange_layout_20")) .opacity($r("app.string.drag_and_exchange_background_opacity")) .backgroundColor($r('app.color.drag_and_exchange_background_color')) } } /** * 设置GridItem拖拽过程中显示的图形 */ @Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_icon_square_size")) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right movedItem : AST#type_annotation#Left AST#primary_type#Left AppInfo 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 AppInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left DataSource 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 DataSource 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#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right <= AST#expression#Left ICON_NUM_IN_GRID AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AppInfo 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 AST#template_literal#Left ` app.media.drag_and_exchange_ic_public_app AST#template_substitution#Left $ { AST#expression#Left index AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` App AST#template_substitution#Left $ { AST#expression#Left index 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_grid_drag_title" 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 . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_opt_title_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Grid ( ) AST#container_content_body#Left { // TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料: // https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ 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 . dataSource 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 AppInfo 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 GridItem ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IconWithNameView ( AST#component_parameters#Left { AST#component_parameter#Left app : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_icon_square_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.drag_and_exchange_layout_70" 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#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 AppInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_10" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_10" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . editMode ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) // TODO:知识点:设置Grid进入编辑模式,方可拖拽Grid组件内部GridItem AST#modifier_chain_expression#Left . onItemDragStart ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ItemDragInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemIndex : 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 { // TODO:知识点:在Grid层,通过onItemDragStart实现拖拽开始时的回调行为 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 . movedItem AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemWhileDrag 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onItemDrop ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ItemDragInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left insertIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSuccess : 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 { // TODO:知识点:在Grid层,通过onItemDrop实现拖拽结束后的回调行为 // isSuccess=false时,说明drop的位置在grid外部;insertIndex > length时,说明有新增元素的事件发生 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left isSuccess AST#expression#Right && AST#expression#Left insertIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . totalCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_annotation#Left AST#primary_type#Left AppInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemIndex 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 . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left insertIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left insertIndex AST#expression#Right , AST#expression#Left temp 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 . dataSource AST#member_expression#Right AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_10" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_10" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_5" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_5" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.drag_and_exchange_layout_90_percent" 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.drag_and_exchange_layout_250" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_20" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_background_opacity" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.drag_and_exchange_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 /** * 设置GridItem拖拽过程中显示的图形 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemWhileDrag 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 IconWithNameView ( AST#component_parameters#Left { AST#component_parameter#Left app : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . movedItem AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_icon_square_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.drag_and_exchange_icon_square_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#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct GridSceneView { @State movedItem: AppInfo = new AppInfo(); @State dataSource: DataSource = new DataSource(); aboutToAppear() { for (let index = 1; index <= ICON_NUM_IN_GRID; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`), `App${index}`)); } } build() { Column() { Text($r("app.string.drag_and_exchange_grid_drag_title")) .fontColor(Color.White) .textAlign(TextAlign.Center) .fontSize($r("app.string.drag_and_exchange_opt_title_font_size")) Row() { Grid() { LazyForEach(this.dataSource, (item: AppInfo) => { GridItem() { IconWithNameView({ app: item }); } .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_layout_70")) }, (item: AppInfo) => item.name.toString()) } .columnsTemplate('1fr 1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr 1fr') .columnsGap($r("app.string.drag_and_exchange_layout_10")) .rowsGap($r("app.string.drag_and_exchange_layout_10")) .editMode(true) .onItemDragStart((event: ItemDragInfo, itemIndex: number) => { this.movedItem = this.dataSource.getData(itemIndex); return this.itemWhileDrag(); }) .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { if (isSuccess && insertIndex < this.dataSource.totalCount()) { let temp: AppInfo = this.dataSource.getData(itemIndex); this.dataSource.setData(itemIndex, this.dataSource.getData(insertIndex)); this.dataSource.setData(insertIndex, temp); this.dataSource.notifyDataReload(); } }) .padding({ top: $r("app.string.drag_and_exchange_layout_10"), bottom: $r("app.string.drag_and_exchange_layout_10"), left: $r("app.string.drag_and_exchange_layout_5"), right: $r("app.string.drag_and_exchange_layout_5") }) } .width($r("app.string.drag_and_exchange_layout_90_percent")) .height($r("app.string.drag_and_exchange_layout_250")) .borderRadius($r("app.string.drag_and_exchange_layout_20")) .opacity($r("app.string.drag_and_exchange_background_opacity")) .backgroundColor($r('app.color.drag_and_exchange_background_color')) } } @Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_icon_square_size")) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets#L25-L97
471c5354ee671560788ed085fd4935ab227bd69a
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/pages/StatisticPage.ets
arkts
refreshClassifiedStatistics
刷新分类统计信息
private refreshClassifiedStatistics() { this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate); this.totalAmount = this.classifiedStatistics .map(classifiedStatistic => classifiedStatistic.amount) .reduce((total, cur) => total + cur, 0); this.ratios = getRatios(this.classifiedStatistics); }
AST#method_declaration#Left private refreshClassifiedStatistics AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left statisticByType AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accounts AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beginDate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endDate 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalAmount AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left classifiedStatistic => AST#expression#Left AST#member_expression#Left AST#expression#Left classifiedStatistic AST#expression#Right . amount 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 . reduce 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 total AST#parameter#Right , AST#parameter#Left cur AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left total AST#expression#Right + AST#expression#Left cur AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ratios AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getRatios AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifiedStatistics AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private refreshClassifiedStatistics() { this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate); this.totalAmount = this.classifiedStatistics .map(classifiedStatistic => classifiedStatistic.amount) .reduce((total, cur) => total + cur, 0); this.ratios = getRatios(this.classifiedStatistics); }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/StatisticPage.ets#L30-L36
83088671cc5e0de426743c701ab136446b3ea5a6
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloadable.ets
arkts
MARK: - CFileDownloadable 等价 ArkTS 接口
export interface CFileDownloadable { //extends CDownloadable { /// 获取元数据 /// @param fileName 文件名 /// @param finished 回调 (meta: CMetaInfo | null, error: string | null) getFileMeta( fileName : string, finished : (meta: CMetaInfo | null, error: string | null) => void ) : void; /// 下载文件 /// @param fileName 文件名 /// @param proccessing 下载进度回调 (bytes: number) /// @param finished 完成回调 (url: string | null, meta: CMetaInfo | null, error: string | null) downloadFile( fileName : string, proccessing : (bytes: number) => void, finished : (url: string | null, meta: CMetaInfo | null, error: string | null) => void ) : void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CFileDownloadable AST#object_type#Left { //extends CDownloadable { /// 获取元数据 /// @param fileName 文件名 /// @param finished 回调 (meta: CMetaInfo | null, error: string | null) AST#type_member#Left getFileMeta AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left meta : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /// 下载文件 /// @param fileName 文件名 /// @param proccessing 下载进度回调 (bytes: number) /// @param finished 完成回调 (url: string | null, meta: CMetaInfo | null, error: string | null) AST#type_member#Left downloadFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left bytes : 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#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left meta : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface CFileDownloadable { getFileMeta( fileName : string, finished : (meta: CMetaInfo | null, error: string | null) => void ) : void; downloadFile( fileName : string, proccessing : (bytes: number) => void, finished : (url: string | null, meta: CMetaInfo | null, error: string | null) => void ) : void; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloadable.ets#L4-L24
cfea7407ac08871536ab395cc2df408ad0d62fbe
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets
arkts
BarCharts
场景描述:当前组件为柱状图组件 BarChartModel。 构造新的对象模型后通过模型的方法设置属性。 具体实现见aboutToAppear内注释。
@Component export struct BarCharts { @Prop calorieData: Array<number | null> = [233, 285, 458, 268, 237, 278, 407]; // 卡路里数据 model: BarChartModel | null = null; // 柱状图模型 private leftAxis: YAxis | null = null; // 左侧Y轴数据 private rightAxis: YAxis | null = null; // 右侧Y轴数据 private xAxis: XAxis | null = null; // X轴数据 data: BarData | null = null; // 柱状图数据 limitLine: LimitLine | null = null; // 限制线类型 // 图表数据初始化 aboutToAppear() { // TODO 知识点:必须初始化图表配置构建类 this.model = new BarChartModel(); this.model.setPinchZoom(false); // TODO 知识点:配置图表指定样式,各部件间没有先后之分 // 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件 const description: Description | null = this.model.getDescription(); if (description) { description.setEnabled(false); } // 获取图表图例部件,设置图表图例部件不可用 const legend: Legend | null = this.model.getLegend(); if (legend) { legend.setEnabled(false); } // 设置图表数据最大的绘制数,如果超过该数值,则不进行绘制图表的数值标签 this.model.setMaxVisibleValueCount(VISIBLE_VALUE_COUNT); // 是否绘制图表的背景色,绘制范围为图表柱状图的绘制范围,不包含轴线之外的部分 this.model.setDrawGridBackground(true); // 设置图表的背景色,颜色的规格需要满足CanvasRenderingContext2D.fillstyle/strokestyle规格 this.model.setGridBackgroundColor(GRID_BG_COLOR); // 设置不绘制柱状图的柱体阴影背景 this.model.setDrawBarShadow(false); // 设置柱状图的数值在柱体上方 this.model.setDrawValueAboveBar(true); // 设置柱状图的高亮范围是否为整个柱体,只在堆叠柱状图中有区别 this.model.setHighlightFullBarEnabled(true); // 为左Y轴设置LimitLine,可设置限制线的宽度,线段样式,限制标签的位置,标签字体大小等 this.limitLine = new LimitLine(STEP_TARGET_NUMBER, STEP_TARGET); // 设置限制线的宽度 this.limitLine.setLineWidth(LINE_WIDTH); // 设置限制线虚线类型的长度 this.limitLine.enableDashedLine(DASHED_LINE_LENGTH, DASHED_SPACE_LENGTH, ZERO); // 设置限制线的颜色 this.limitLine.setLineColor(Color.Gray); // 设置限制线的位置 this.limitLine.setLabelPosition(LimitLabelPosition.RIGHT_TOP); // 设置限制线上文本的大小 this.limitLine.setTextSize(TEXT_SIZE); // 设置图表左Y轴信息 this.leftAxis = this.model.getAxisLeft(); if (this.leftAxis) { // 设置图表左Y轴最小值 this.leftAxis.setAxisMinimum(ZERO); // 设置图表左Y轴是否在数据后绘制限制线 this.leftAxis.setDrawLimitLinesBehindData(false); // 设置图表左Y轴数据的格式转换器 this.leftAxis.setValueFormatter(new YValueFormatter()); // 添加LimitLines this.leftAxis.addLimitLine(this.limitLine); } // 设置图表右Y轴信息 this.rightAxis = this.model.getAxisRight(); if (this.rightAxis) { // 设置图表右Y轴是否显示 this.rightAxis.setEnabled(false); // 设置图表右Y轴最小值 this.rightAxis.setAxisMinimum(ZERO); } // 设置X轴信息 this.xAxis = this.model.getXAxis(); if (this.xAxis) { // 设置X轴是否绘制网格线 this.xAxis.setDrawGridLines(false); // 设置绘制标签个数 this.xAxis.setLabelCount(LABEL_COUNT, false); //设置标签位置 this.xAxis.setPosition(XAxisPosition.BOTTOM); // 设置数据的格式转换器 this.xAxis.setValueFormatter(new XValueFormatter()); } // //设置是否支持双击放大 this.model.setDoubleTapToZoomEnabled(false); // 生成单一颜色数据 this.data = this.getNormalData(); // TODO 知识点:将数据与图表配置类绑定 this.model.setData(this.data); } // 生成柱状图数据 private getNormalData(): BarData { const START: number = 0; const values: JArrayList<BarEntry> = new JArrayList<BarEntry>(); for (let i = START; i < this.calorieData.length; i++) { values.add(new BarEntry(i, this.calorieData[i])); } const dataSet: BarDataSet = new BarDataSet(values, CALORIE); dataSet.setHighLightColor(Color.Gray); dataSet.setDrawIcons(false); dataSet.setDrawValues(true); dataSet.setHighlightEnabled(false); // 为柱体添加颜色信息 dataSet.setColorByColor(Colors.rgb(34, 177, 48)); const dataSetList: JArrayList<IBarDataSet> = new JArrayList<IBarDataSet>(); dataSetList.add(dataSet); const barData: BarData = new BarData(dataSetList); //设置柱状图宽度 barData.setBarWidth(BAR_WIDTH); return barData; } build() { BarChart({ model: this.model }) .width($r('app.string.bar_chart_health_layout_full_size')) .height($r('app.string.bar_chart_health_layout_forty')) .margin({ bottom: $r('app.integer.bar_chart_health_margin_twenty') }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BarCharts AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right calorieData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#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 233 AST#expression#Right , AST#expression#Left 285 AST#expression#Right , AST#expression#Left 458 AST#expression#Right , AST#expression#Left 268 AST#expression#Right , AST#expression#Left 237 AST#expression#Right , AST#expression#Left 278 AST#expression#Right , AST#expression#Left 407 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 卡路里数据 AST#property_declaration#Left model : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BarChartModel AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 柱状图模型 AST#property_declaration#Left private leftAxis : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxis AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 左侧Y轴数据 AST#property_declaration#Left private rightAxis : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxis AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 右侧Y轴数据 AST#property_declaration#Left private xAxis : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left XAxis AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // X轴数据 AST#property_declaration#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BarData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 柱状图数据 AST#property_declaration#Left limitLine : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LimitLine AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 限制线类型 // 图表数据初始化 AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:必须初始化图表配置构建类 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 . model AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BarChartModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . setPinchZoom AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // TODO 知识点:配置图表指定样式,各部件间没有先后之分 // 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left description : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Description 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left description 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 description AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 获取图表图例部件,设置图表图例部件不可用 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left legend : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Legend 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getLegend AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left legend 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 legend AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 设置图表数据最大的绘制数,如果超过该数值,则不进行绘制图表的数值标签 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . setMaxVisibleValueCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left VISIBLE_VALUE_COUNT 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 . model AST#member_expression#Right AST#expression#Right . setDrawGridBackground AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置图表的背景色,颜色的规格需要满足CanvasRenderingContext2D.fillstyle/strokestyle规格 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 . model AST#member_expression#Right AST#expression#Right . setGridBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left GRID_BG_COLOR 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 . model AST#member_expression#Right AST#expression#Right . setDrawBarShadow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置柱状图的数值在柱体上方 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . setDrawValueAboveBar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; 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 . model AST#member_expression#Right AST#expression#Right . setHighlightFullBarEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 为左Y轴设置LimitLine,可设置限制线的宽度,线段样式,限制标签的位置,标签字体大小等 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 . limitLine AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LimitLine AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left STEP_TARGET_NUMBER AST#expression#Right , AST#expression#Left STEP_TARGET AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置限制线的宽度 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . limitLine AST#member_expression#Right AST#expression#Right . setLineWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left LINE_WIDTH 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 . limitLine AST#member_expression#Right AST#expression#Right . enableDashedLine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DASHED_LINE_LENGTH AST#expression#Right , AST#expression#Left DASHED_SPACE_LENGTH AST#expression#Right , AST#expression#Left ZERO 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 . limitLine AST#member_expression#Right AST#expression#Right . setLineColor 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 ; 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 . limitLine AST#member_expression#Right AST#expression#Right . setLabelPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LimitLabelPosition AST#expression#Right . RIGHT_TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置限制线上文本的大小 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . limitLine AST#member_expression#Right AST#expression#Right . setTextSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TEXT_SIZE AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置图表左Y轴信息 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 . leftAxis AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getAxisLeft 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 设置图表左Y轴最小值 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 . leftAxis AST#member_expression#Right AST#expression#Right . setAxisMinimum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ZERO AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置图表左Y轴是否在数据后绘制限制线 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 . leftAxis AST#member_expression#Right AST#expression#Right . setDrawLimitLinesBehindData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置图表左Y轴数据的格式转换器 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 . leftAxis AST#member_expression#Right AST#expression#Right . setValueFormatter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left YValueFormatter 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 添加LimitLines 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 . leftAxis AST#member_expression#Right AST#expression#Right . addLimitLine 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 . limitLine 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#statement#Right // 设置图表右Y轴信息 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 . rightAxis AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getAxisRight 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rightAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 设置图表右Y轴是否显示 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 . rightAxis AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置图表右Y轴最小值 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 . rightAxis AST#member_expression#Right AST#expression#Right . setAxisMinimum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ZERO 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 // 设置X轴信息 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 . xAxis AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getXAxis 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xAxis AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 设置X轴是否绘制网格线 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 . xAxis AST#member_expression#Right AST#expression#Right . setDrawGridLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置绘制标签个数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xAxis AST#member_expression#Right AST#expression#Right . setLabelCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left LABEL_COUNT AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 . xAxis AST#member_expression#Right AST#expression#Right . setPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left XAxisPosition AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置数据的格式转换器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xAxis AST#member_expression#Right AST#expression#Right . setValueFormatter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left XValueFormatter 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // //设置是否支持双击放大 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . setDoubleTapToZoomEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 生成单一颜色数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data 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 . getNormalData 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 // TODO 知识点:将数据与图表配置类绑定 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 . model AST#member_expression#Right AST#expression#Right . setData 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 . data 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#method_declaration#Right // 生成柱状图数据 AST#method_declaration#Left private getNormalData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BarData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left START : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left values : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left START 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 . calorieData 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left values AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BarEntry AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calorieData AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dataSet : AST#type_annotation#Left AST#primary_type#Left BarDataSet 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 BarDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left values AST#expression#Right , AST#expression#Left CALORIE AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setHighLightColor 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 ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setDrawIcons AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setDrawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setHighlightEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 为柱体添加颜色信息 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . setColorByColor 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 Colors AST#expression#Right . rgb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 34 AST#expression#Right , AST#expression#Left 177 AST#expression#Right , AST#expression#Left 48 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#variable_declaration#Left const AST#variable_declarator#Left dataSetList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IBarDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IBarDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSetList AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left barData : AST#type_annotation#Left AST#primary_type#Left BarData 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 BarData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSetList 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 barData AST#expression#Right . setBarWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left BAR_WIDTH 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 barData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#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 BarChart ( AST#component_parameters#Left { AST#component_parameter#Left model : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.bar_chart_health_layout_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.bar_chart_health_layout_forty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.bar_chart_health_margin_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct BarCharts { @Prop calorieData: Array<number | null> = [233, 285, 458, 268, 237, 278, 407]; model: BarChartModel | null = null; private leftAxis: YAxis | null = null; private rightAxis: YAxis | null = null; private xAxis: XAxis | null = null; data: BarData | null = null; limitLine: LimitLine | null = null; aboutToAppear() { this.model = new BarChartModel(); this.model.setPinchZoom(false); const description: Description | null = this.model.getDescription(); if (description) { description.setEnabled(false); } const legend: Legend | null = this.model.getLegend(); if (legend) { legend.setEnabled(false); } this.model.setMaxVisibleValueCount(VISIBLE_VALUE_COUNT); this.model.setDrawGridBackground(true); this.model.setGridBackgroundColor(GRID_BG_COLOR); this.model.setDrawBarShadow(false); this.model.setDrawValueAboveBar(true); this.model.setHighlightFullBarEnabled(true); this.limitLine = new LimitLine(STEP_TARGET_NUMBER, STEP_TARGET); this.limitLine.setLineWidth(LINE_WIDTH); this.limitLine.enableDashedLine(DASHED_LINE_LENGTH, DASHED_SPACE_LENGTH, ZERO); this.limitLine.setLineColor(Color.Gray); this.limitLine.setLabelPosition(LimitLabelPosition.RIGHT_TOP); this.limitLine.setTextSize(TEXT_SIZE); this.leftAxis = this.model.getAxisLeft(); if (this.leftAxis) { this.leftAxis.setAxisMinimum(ZERO); this.leftAxis.setDrawLimitLinesBehindData(false); this.leftAxis.setValueFormatter(new YValueFormatter()); this.leftAxis.addLimitLine(this.limitLine); } this.rightAxis = this.model.getAxisRight(); if (this.rightAxis) { this.rightAxis.setEnabled(false); this.rightAxis.setAxisMinimum(ZERO); } this.xAxis = this.model.getXAxis(); if (this.xAxis) { this.xAxis.setDrawGridLines(false); this.xAxis.setLabelCount(LABEL_COUNT, false); this.xAxis.setPosition(XAxisPosition.BOTTOM); this.xAxis.setValueFormatter(new XValueFormatter()); } this.model.setDoubleTapToZoomEnabled(false); this.data = this.getNormalData(); this.model.setData(this.data); } private getNormalData(): BarData { const START: number = 0; const values: JArrayList<BarEntry> = new JArrayList<BarEntry>(); for (let i = START; i < this.calorieData.length; i++) { values.add(new BarEntry(i, this.calorieData[i])); } const dataSet: BarDataSet = new BarDataSet(values, CALORIE); dataSet.setHighLightColor(Color.Gray); dataSet.setDrawIcons(false); dataSet.setDrawValues(true); dataSet.setHighlightEnabled(false); dataSet.setColorByColor(Colors.rgb(34, 177, 48)); const dataSetList: JArrayList<IBarDataSet> = new JArrayList<IBarDataSet>(); dataSetList.add(dataSet); const barData: BarData = new BarData(dataSetList); barData.setBarWidth(BAR_WIDTH); return barData; } build() { BarChart({ model: this.model }) .width($r('app.string.bar_chart_health_layout_full_size')) .height($r('app.string.bar_chart_health_layout_forty')) .margin({ bottom: $r('app.integer.bar_chart_health_margin_twenty') }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets#L53-L171
715858b56e74c8a272e07c9bdbb78645b75ea90b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
shareGreeting
分享祝福语
async shareGreeting(greeting: Greeting, contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> { try { const shareConfig: ShareConfig = { platform: config.platform || SharePlatform.SYSTEM, contentType: ShareContentType.TEXT, title: `给${contact.name}的生日祝福`, content: this.formatGreetingContent(greeting, contact), ...config }; const result = await this.performShare(shareConfig); // 记录分享统计 if (result.success) { await this.recordShareStats(greeting.id, shareConfig.platform, 'greeting'); } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Greeting shared: ${greeting.id}, platform: ${shareConfig.platform}, success: ${result.success}`); return result; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to share greeting: ${error}`); return { success: false, platform: config.platform || SharePlatform.SYSTEM, message: `分享失败: ${error}`, sharedAt: new Date().toISOString() }; } }
AST#method_declaration#Left async shareGreeting AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ShareConfig AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#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 ShareResult AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left shareConfig : AST#type_annotation#Left AST#primary_type#Left ShareConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left platform AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . platform AST#member_expression#Right AST#expression#Right || AST#expression#Left SharePlatform AST#expression#Right AST#binary_expression#Right AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ShareContentType AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 给 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 的生日祝福 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatGreetingContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greeting AST#expression#Right , AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left ... AST#expression#Left config AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = 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 . performShare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shareConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 记录分享统计 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . success AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . recordShareStats AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left shareConfig AST#expression#Right . platform AST#member_expression#Right AST#expression#Right , AST#expression#Left 'greeting' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Greeting shared: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , platform: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left shareConfig AST#expression#Right . platform AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , success: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to share greeting: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left platform AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . platform AST#member_expression#Right AST#expression#Right || AST#expression#Left SharePlatform AST#expression#Right AST#binary_expression#Right AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 分享失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sharedAt AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#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 shareGreeting(greeting: Greeting, contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> { try { const shareConfig: ShareConfig = { platform: config.platform || SharePlatform.SYSTEM, contentType: ShareContentType.TEXT, title: `给${contact.name}的生日祝福`, content: this.formatGreetingContent(greeting, contact), ...config }; const result = await this.performShare(shareConfig); if (result.success) { await this.recordShareStats(greeting.id, shareConfig.platform, 'greeting'); } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Greeting shared: ${greeting.id}, platform: ${shareConfig.platform}, success: ${result.success}`); return result; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to share greeting: ${error}`); return { success: false, platform: config.platform || SharePlatform.SYSTEM, message: `分享失败: ${error}`, sharedAt: new Date().toISOString() }; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L120-L150
e184d9112a425e52d6414855098b386883e5cd6a
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/exception_throw/exception_catch_002_F.ets
arkts
Introduction 异常抛出-catch块
export function exception_catch_002_F(taint_src : string) { try { throw new Error(); } catch (e) { let _t = taint_src; let clean = "_"; taint.Sink(clean); } }
AST#export_declaration#Left export AST#function_declaration#Left function exception_catch_002_F 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#try_statement#Left try 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_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 let AST#variable_declarator#Left _t = AST#expression#Left taint_src AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clean = AST#expression#Left "_" AST#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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left clean AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function exception_catch_002_F(taint_src : string) { try { throw new Error(); } catch (e) { let _t = taint_src; let clean = "_"; taint.Sink(clean); } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_catch_002_F.ets#L6-L14
baa28057f5c417c08a936c295b019d44f4ff1efb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/product/entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
getData
网络获取README数据并利用formProvider.updateForm更新到卡片
async getData(formId: string) { let detail: CASES[] = []; let httpRequest = http.createHttp(); let webData: http.HttpResponse = await httpRequest.request(URL); if (webData?.responseCode === http.ResponseCode.OK) { try { detail = CaseCardUtils.formatData(webData.result.toString()); hilog.info(DOMAIN_NUMBER, TAG, '[EntryFormAbility] onFormEvent' + 'webData.result:' + webData.result); class FormDataClass { detail: CASES[] = detail; } let formData = new FormDataClass(); let formInfo = formBindingData.createFormBindingData(formData); await formProvider.updateForm(formId, formInfo); hilog.info(DOMAIN_NUMBER, TAG, '%{public}s', 'FormAbility updateForm success.'); } catch (error) { hilog.error(DOMAIN_NUMBER, TAG, `FormAbility updateForm failed: ${JSON.stringify(error)}`); } } else { hilog.error(DOMAIN_NUMBER, TAG, `ArkTSCard download task failed`); let param: Record<string, string> = { 'text': '刷新失败' }; let formInfo: formBindingData.FormBindingData = formBindingData.createFormBindingData(param); formProvider.updateForm(formId, formInfo); } httpRequest.destroy(); }
AST#method_declaration#Left async getData AST#parameter_list#Left ( AST#parameter#Left formId : 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 detail : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CASES [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left webData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse 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#await_expression#Left await AST#expression#Left httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left URL AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webData AST#expression#Right ?. responseCode AST#member_expression#Right AST#expression#Right === AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . ResponseCode AST#member_expression#Right AST#expression#Right . OK AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left detail = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CaseCardUtils AST#expression#Right . formatData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webData AST#expression#Right . result AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN_NUMBER AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[EntryFormAbility] onFormEvent' AST#expression#Right + AST#expression#Left 'webData.result:' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left webData AST#expression#Right AST#binary_expression#Right AST#expression#Right . result AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left class AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left FormDataClass AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left detail AST#property_name#Right : AST#expression#Left CASES AST#expression#Right AST#property_assignment#Right AST#ERROR#Left [ ] = detail ; AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left formData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left FormDataClass 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#variable_declaration#Left let AST#variable_declarator#Left formInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formBindingData AST#expression#Right . createFormBindingData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formData 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 formProvider AST#expression#Right AST#await_expression#Right AST#expression#Right . updateForm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formId AST#expression#Right , AST#expression#Left formInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN_NUMBER AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'FormAbility updateForm 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#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 DOMAIN_NUMBER AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` FormAbility updateForm failed: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN_NUMBER AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` ArkTSCard download task failed ` 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 param : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'text' AST#property_name#Right : AST#expression#Left '刷新失败' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left formInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left formBindingData . FormBindingData 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 formBindingData AST#expression#Right . createFormBindingData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left param 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 formProvider AST#expression#Right . updateForm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formId AST#expression#Right , AST#expression#Left formInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest 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#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getData(formId: string) { let detail: CASES[] = []; let httpRequest = http.createHttp(); let webData: http.HttpResponse = await httpRequest.request(URL); if (webData?.responseCode === http.ResponseCode.OK) { try { detail = CaseCardUtils.formatData(webData.result.toString()); hilog.info(DOMAIN_NUMBER, TAG, '[EntryFormAbility] onFormEvent' + 'webData.result:' + webData.result); class FormDataClass { detail: CASES[] = detail; } let formData = new FormDataClass(); let formInfo = formBindingData.createFormBindingData(formData); await formProvider.updateForm(formId, formInfo); hilog.info(DOMAIN_NUMBER, TAG, '%{public}s', 'FormAbility updateForm success.'); } catch (error) { hilog.error(DOMAIN_NUMBER, TAG, `FormAbility updateForm failed: ${JSON.stringify(error)}`); } } else { hilog.error(DOMAIN_NUMBER, TAG, `ArkTSCard download task failed`); let param: Record<string, string> = { 'text': '刷新失败' }; let formInfo: formBindingData.FormBindingData = formBindingData.createFormBindingData(param); formProvider.updateForm(formId, formInfo); } httpRequest.destroy(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/entryformability/EntryFormAbility.ets#L48-L75
c7fac8405aad9942b616dad7d41d98ac430fc451
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/BottomDialogView.ets
arkts
aboutToAppear
弹框右侧按钮。
aboutToAppear(): void { }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear(): void { }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/BottomDialogView.ets#L16-L18
1abe2108e2dd344154b71a95c2a4cfb415a7f351
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildWelcomeBanner
构建欢迎横幅
@Builder buildWelcomeBanner() { Row() { Column({ space: 8 }) { Text('生日提醒') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`今天是${new Date().toLocaleDateString()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Image($r('app.media.ic_birthday')) .width(48) .height(48) .objectFit(ImageFit.Contain) } .width('100%') .padding(20) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWelcomeBanner 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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '生日提醒' 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 . 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 . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 今天是 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleDateString 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#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' 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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_birthday' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 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#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 20 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildWelcomeBanner() { Row() { Column({ space: 8 }) { Text('生日提醒') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`今天是${new Date().toLocaleDateString()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Image($r('app.media.ic_birthday')) .width(48) .height(48) .objectFit(ImageFit.Contain) } .width('100%') .padding(20) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L157-L188
6a9a3edb139fc0f630a7183e0fb714802058dd25
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/hiDumper/Index.ets
arkts
ConditionView
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 { ConditionView } from './src/main/ets/view/ConditionView';
AST#export_declaration#Left export { ConditionView } from './src/main/ets/view/ConditionView' ; AST#export_declaration#Right
export { ConditionView } from './src/main/ets/view/ConditionView';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/hiDumper/Index.ets#L16-L16
26839b6d8b3459383b59aeccafdd1505c7cea393
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/ReminderSetting.ets
arkts
TimePickerDialog
时间选择器弹窗
@Builder TimePickerDialog() { Stack() { // 半透明背景遮罩 Column() .width('100%') .height('100%') .backgroundColor('rgba(0, 0, 0, 0.5)') .onClick(() => { this.showTimePicker = false; // 点击遮罩关闭 }) // 时间选择器内容 Column() { Text('设置提醒时间') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) .margin({ bottom: 20 }) // 小时和分钟选择器 Row() { // 小时选择器 Column() { List() { ForEach(this.hourList, (hour: number) => { ListItem() { Row() { Text(this.formatTime(hour)) .fontSize(this.reminderHour === hour ? 24 : 18) .fontColor(this.reminderHour === hour ? '#5B7FFF' : '#666666') .fontWeight(this.reminderHour === hour ? FontWeight.Bold : FontWeight.Normal) } .width('100%') .height(48) .justifyContent(FlexAlign.End) .padding({ right: 20 }) } .onClick(() => { this.reminderHour = hour; }) }, (hour: number) => hour.toString()) } .width('100%') .height(250) .scrollBar(BarState.Off) } .layoutWeight(1) Text(':') .fontSize(28) .fontColor('#333333') .fontWeight(FontWeight.Bold) .margin({ left: 8, right: 8 }) // 分钟选择器 Column() { List() { ForEach(this.minuteList, (minute: number) => { ListItem() { Row() { Text(this.formatTime(minute)) .fontSize(this.reminderMinute === minute ? 24 : 18) .fontColor(this.reminderMinute === minute ? '#5B7FFF' : '#666666') .fontWeight(this.reminderMinute === minute ? FontWeight.Bold : FontWeight.Normal) } .width('100%') .height(48) .justifyContent(FlexAlign.Start) .padding({ left: 20 }) } .onClick(() => { this.reminderMinute = minute; }) }, (minute: number) => minute.toString()) } .width('100%') .height(250) .scrollBar(BarState.Off) } .layoutWeight(1) } .width('100%') .justifyContent(FlexAlign.Center) // 按钮区域 Row() { // 取消按钮 Button('取消') .width('45%') .height(45) .backgroundColor('#F5F5F5') .fontColor('#666666') .fontSize(16) .onClick(() => { this.showTimePicker = false; }) // 确定按钮 Button('确定') .width('45%') .height(45) .backgroundColor('#5B7FFF') .fontColor('#FFFFFF') .fontSize(16) .onClick(() => { this.showTimePicker = false; promptAction.showToast({ message: `提醒时间已设置为每天${this.formatTime(this.reminderHour)}:${this.formatTime(this.reminderMinute)}`, duration: 2000 }); }) } .width('100%') .padding({ top: 20 }) .justifyContent(FlexAlign.SpaceBetween) } .width('85%') .backgroundColor('#FFFFFF') .borderRadius(16) .padding({ left: 20, right: 20, top: 20, bottom: 20 }) } .width('100%') .height('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TimePickerDialog 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 Stack ( ) AST#container_content_body#Left { // 半透明背景遮罩 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'rgba(0, 0, 0, 0.5)' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showTimePicker AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 点击遮罩关闭 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 Text ( AST#expression#Left '设置提醒时间' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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 bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 小时和分钟选择器 AST#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 List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hourList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left hour : 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hour AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( 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 . reminderHour AST#member_expression#Right AST#expression#Right === AST#expression#Left hour AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 24 AST#expression#Right : AST#expression#Left 18 AST#expression#Right AST#conditional_expression#Right 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 . reminderHour AST#member_expression#Right AST#expression#Right === AST#expression#Left hour AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#5B7FFF' AST#expression#Right : AST#expression#Left '#666666' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#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 . reminderHour AST#member_expression#Right AST#expression#Right === AST#expression#Left hour AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End 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 right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . reminderHour AST#member_expression#Right = AST#expression#Left hour 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#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 hour : 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 hour 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 250 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left ':' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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 left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right 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#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 List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . minuteList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left minute : 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left minute AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( 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 . reminderMinute AST#member_expression#Right AST#expression#Right === AST#expression#Left minute AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 24 AST#expression#Right : AST#expression#Left 18 AST#expression#Right AST#conditional_expression#Right 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 . reminderMinute AST#member_expression#Right AST#expression#Right === AST#expression#Left minute AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#5B7FFF' AST#expression#Right : AST#expression#Left '#666666' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#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 . reminderMinute AST#member_expression#Right AST#expression#Right === AST#expression#Left minute AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . reminderMinute AST#member_expression#Right = AST#expression#Left minute 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#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 minute : 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 minute 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 250 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center 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 Row ( ) AST#container_content_body#Left { // 取消按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '取消' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '45%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 45 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F5F5F5' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 . showTimePicker AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 确定按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '确定' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '45%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 45 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#5B7FFF' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 . showTimePicker AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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#template_literal#Left ` 提醒时间已设置为每天 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatTime 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 . reminderHour AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatTime 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 . reminderMinute 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#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 top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 '85%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 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 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder TimePickerDialog() { Stack() { Column() .width('100%') .height('100%') .backgroundColor('rgba(0, 0, 0, 0.5)') .onClick(() => { this.showTimePicker = false; }) Column() { Text('设置提醒时间') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) .margin({ bottom: 20 }) Row() { Column() { List() { ForEach(this.hourList, (hour: number) => { ListItem() { Row() { Text(this.formatTime(hour)) .fontSize(this.reminderHour === hour ? 24 : 18) .fontColor(this.reminderHour === hour ? '#5B7FFF' : '#666666') .fontWeight(this.reminderHour === hour ? FontWeight.Bold : FontWeight.Normal) } .width('100%') .height(48) .justifyContent(FlexAlign.End) .padding({ right: 20 }) } .onClick(() => { this.reminderHour = hour; }) }, (hour: number) => hour.toString()) } .width('100%') .height(250) .scrollBar(BarState.Off) } .layoutWeight(1) Text(':') .fontSize(28) .fontColor('#333333') .fontWeight(FontWeight.Bold) .margin({ left: 8, right: 8 }) Column() { List() { ForEach(this.minuteList, (minute: number) => { ListItem() { Row() { Text(this.formatTime(minute)) .fontSize(this.reminderMinute === minute ? 24 : 18) .fontColor(this.reminderMinute === minute ? '#5B7FFF' : '#666666') .fontWeight(this.reminderMinute === minute ? FontWeight.Bold : FontWeight.Normal) } .width('100%') .height(48) .justifyContent(FlexAlign.Start) .padding({ left: 20 }) } .onClick(() => { this.reminderMinute = minute; }) }, (minute: number) => minute.toString()) } .width('100%') .height(250) .scrollBar(BarState.Off) } .layoutWeight(1) } .width('100%') .justifyContent(FlexAlign.Center) Row() { Button('取消') .width('45%') .height(45) .backgroundColor('#F5F5F5') .fontColor('#666666') .fontSize(16) .onClick(() => { this.showTimePicker = false; }) Button('确定') .width('45%') .height(45) .backgroundColor('#5B7FFF') .fontColor('#FFFFFF') .fontSize(16) .onClick(() => { this.showTimePicker = false; promptAction.showToast({ message: `提醒时间已设置为每天${this.formatTime(this.reminderHour)}:${this.formatTime(this.reminderMinute)}`, duration: 2000 }); }) } .width('100%') .padding({ top: 20 }) .justifyContent(FlexAlign.SpaceBetween) } .width('85%') .backgroundColor('#FFFFFF') .borderRadius(16) .padding({ left: 20, right: 20, top: 20, bottom: 20 }) } .width('100%') .height('100%') }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/ReminderSetting.ets#L140-L264
0b74f3d53ce44c4c1c617b507fa27f9a58ab01d5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets
arkts
getTime
时分
getTime() { const DATETIME = new Date() return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes()) }
AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . concatTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DATETIME AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getTime() { const DATETIME = new Date() return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes()) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L24-L27
deda70eecd907c67ec2c8e23689a11ca1d53de37
gitee
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets
arkts
delObjData
删除指定键数据
delObjData(key) { LogUtil.info('delObjData key == ' + key); mPreferences.delete(key); }
AST#method_declaration#Left delObjData AST#parameter_list#Left ( AST#parameter#Left key 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 LogUtil 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 'delObjData key == ' AST#expression#Right + AST#expression#Left key 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 mPreferences AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
delObjData(key) { LogUtil.info('delObjData key == ' + key); mPreferences.delete(key); }
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets#L59-L62
f809241a363023c72ef1d6e00817b110e24466e4
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/CacheHelper.ets
arkts
isEmpty
判断lruCache缓存是否为空 @returns
public static isEmpty(): boolean { return CacheHelper.lruCache.isEmpty(); }
AST#method_declaration#Left public static isEmpty 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#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 CacheHelper AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . isEmpty 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
public static isEmpty(): boolean { return CacheHelper.lruCache.isEmpty(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L64-L66
18d6c6fd22e2741b48f0179252359e5d736c1a8b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowStartBottom
横向起始 + 垂直底部
@ComponentV2 export struct RowStartBottom { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param sizeValue: SizeOptions | undefined = undefined; /** * 内边距 */ @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; /** * 外边距 */ @Param marginValue: Margin | Length | LocalizedMargin | undefined = undefined; /** * 是否填充最大宽高 */ @Param fillMaxSize: boolean = false; /** * 背景颜色 */ @Param bgColor: ResourceColor | undefined = undefined; /** * 点击事件 */ @Param onTap: ((event: ClickEvent) => void) | undefined = undefined; /** * 内容构建函数 */ @BuilderParam content: CustomBuilder; /** * 渲染布局 * @returns {void} 无返回值 * @example * RowStartBottom() { Text("Hi"); } */ build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Bottom, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, fillMaxSize: this.fillMaxSize, bgColor: this.bgColor, onTap: this.onTap, content: this.content }); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowStartBottom AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RowOptions AST#primary_type#Right | AST#primary_type#Left RowOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 宽度 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length 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 @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length 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 /** * 尺寸(对应官方 size 属性) */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions 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 @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding 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 @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin 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 @ Param AST#decorator#Right fillMaxSize : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 背景颜色 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor 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 @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent 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#parenthesized_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 @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 渲染布局 * @returns {void} 无返回值 * @example * RowStartBottom() { Text("Hi"); } */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct RowStartBottom { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; @Param marginValue: Margin | Length | LocalizedMargin | undefined = undefined; @Param fillMaxSize: boolean = false; @Param bgColor: ResourceColor | undefined = undefined; @Param onTap: ((event: ClickEvent) => void) | undefined = undefined; @BuilderParam content: CustomBuilder; build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Bottom, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, fillMaxSize: this.fillMaxSize, bgColor: this.bgColor, onTap: this.onTap, content: this.content }); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L865-L940
07e847122915b9d1bc99d3ab7d0d9c3b7b396575
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets
arkts
Enumeration of PhotoSource type @enum { number } PhotoSource @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum PhotoSource { /** * all resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ ALL = 0, /** * camera resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ CAMERA = 1, /** * screenshot resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ SCREENSHOT = 2 }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoSource AST#enum_body#Left { /** * all resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left ALL = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , /** * camera resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left CAMERA = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , /** * screenshot resource * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left SCREENSHOT = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export declare enum PhotoSource { ALL = 0, CAMERA = 1, SCREENSHOT = 2 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets#L169-L194
7167861b8b5a566291cdefcc2e199275def2021d
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegManager.ets
arkts
cancelAll
取消所有任务
public cancelAll(): void { FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...'); // 取消队列中的任务 this.taskQueue.forEach(task => { task.cancel(); this.dispatchCallback(task, 'cancelled'); }); this.taskQueue = []; // 取消当前执行的任务 if (this.currentTask) { this.currentTask.cancel(); } this.activeTasks.clear(); }
AST#method_declaration#Left public cancelAll 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 FLog 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 FFmpegManager AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Cancelling all tasks...' 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 . taskQueue 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 task => 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 task AST#expression#Right . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dispatchCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right , AST#expression#Left 'cancelled' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskQueue 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right AST#expression#Right . cancel 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_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#member_expression#Left AST#expression#Left this AST#expression#Right . activeTasks AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public cancelAll(): void { FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...'); this.taskQueue.forEach(task => { task.cancel(); this.dispatchCallback(task, 'cancelled'); }); this.taskQueue = []; if (this.currentTask) { this.currentTask.cancel(); } this.activeTasks.clear(); }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L137-L153
82a9095deb2f4686030902bb63c9d698b2cded07
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
onCancel
Subscribe the cancel event of current task. @returns { Promise<string> } Return the result of the cancel event. @throws { BusinessError } 13900004 - Interrupted system call @throws { BusinessError } 13900008 - Bad file descriptor @throws { BusinessError } 13900042 - Unknown error @syscap SystemCapability.FileManagement.File.FileIO @since 20
onCancel(): Promise<string>;
AST#method_declaration#Left onCancel 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#method_declaration#Right
onCancel(): Promise<string>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L2967-L2967
e268ebd36618ec0f18b22c1ba9522986a341f3c1
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets
arkts
stringToHexNumber
将颜色字符串转换为数字(十六进制整数)。 颜色字符串可以是 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA" 格式。 如果缺少 alpha 通道,默认设置为完全不透明(0xFF)。 @param colorString 颜色字符串,格式为 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA"。 @param format 可选参数。指定 'ARGB' 表示 alpha 在前,或 'RGBA' 表示 alpha 在后。默认值为 'RGBA'。 @returns 表示颜色的数字值。
static stringToHexNumber(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): number { if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) { throw new Error(`无效的颜色格式: ${colorString}`); } let hex = ''; if (colorString.length === 7) { // "#RRGGBB" 格式,在前面添加 "FF" 作为 alpha。 hex = `FF${colorString.slice(1)}`; } else if (colorString.length === 9) { if (format === 'ARGB') { // "#AARRGGBB" 格式,alpha 在前。 hex = colorString.slice(1); } else if (format === 'RGBA') { // "#RRGGBBAA" 格式,alpha 在后。重新排列为 AARRGGBB。 hex = `${colorString.slice(7, 9)}${colorString.slice(1, 7)}`; } else { throw new Error(`不支持的格式: ${format}`); } } else { throw new Error(`无效的颜色格式长度: ${colorString}`); } // 转换为数字。 const hexNumber = parseInt(hex, 16); // 检查值是否在安全整数范围内。 if (hexNumber > Number.MAX_SAFE_INTEGER) { throw new Error(`转换后的值超出安全整数范围: ${hexNumber}`); } return hexNumber; }
AST#method_declaration#Left static stringToHexNumber AST#parameter_list#Left ( AST#parameter#Left colorString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format AST#ERROR#Left : 'ARGB' | 'RGBA' AST#ERROR#Right = AST#expression#Left 'RGBA' 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#ERROR#Left / ^ # AST#ERROR#Right AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left AST#expression#Left AST#array_literal#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 A AST#expression#Right - AST#expression#Left Fa AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left f0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 6 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right | AST#ERROR#Left AST#expression#Left AST#array_literal#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 A AST#expression#Right - AST#expression#Left Fa AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left f0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 8 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#ERROR#Left $ AST#ERROR#Right / AST#expression#Left AST#expression#Right AST#binary_expression#Right AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left colorString AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 无效的颜色格式: AST#template_substitution#Left $ { AST#expression#Left colorString AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hex = AST#expression#Left '' 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 colorString AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // "#RRGGBB" 格式,在前面添加 "FF" 作为 alpha。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hex = AST#expression#Left AST#template_literal#Left ` FF AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colorString AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colorString AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left format AST#expression#Right === AST#expression#Left 'ARGB' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // "#AARRGGBB" 格式,alpha 在前。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colorString AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 format AST#expression#Right === AST#expression#Left 'RGBA' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // "#RRGGBBAA" 格式,alpha 在后。重新排列为 AARRGGBB。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hex = 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 colorString AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 7 AST#expression#Right , AST#expression#Left 9 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colorString AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 7 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#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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 不支持的格式: AST#template_substitution#Left $ { AST#expression#Left format AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 无效的颜色格式长度: AST#template_substitution#Left $ { AST#expression#Left colorString AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right // 转换为数字。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hexNumber = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left hex AST#expression#Right , AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查值是否在安全整数范围内。 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left hexNumber AST#expression#Right > AST#expression#Left Number AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAX_SAFE_INTEGER AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 转换后的值超出安全整数范围: AST#template_substitution#Left $ { AST#expression#Left hexNumber AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left hexNumber AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static stringToHexNumber(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): number { if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) { throw new Error(`无效的颜色格式: ${colorString}`); } let hex = ''; if (colorString.length === 7) { hex = `FF${colorString.slice(1)}`; } else if (colorString.length === 9) { if (format === 'ARGB') { hex = colorString.slice(1); } else if (format === 'RGBA') { hex = `${colorString.slice(7, 9)}${colorString.slice(1, 7)}`; } else { throw new Error(`不支持的格式: ${format}`); } } else { throw new Error(`无效的颜色格式长度: ${colorString}`); } const hexNumber = parseInt(hex, 16); if (hexNumber > Number.MAX_SAFE_INTEGER) { throw new Error(`转换后的值超出安全整数范围: ${hexNumber}`); } return hexNumber; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets#L48-L81
449ddd6f70b98fd376e054ab4f98ada6645bea7c
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/web/WebViewManager.ets
arkts
createConfig
创建 WebView 配置
createConfig(url: string, options?: Partial<WebViewConfig>): WebViewConfig { return { url, enableJavaScript: options?.enableJavaScript ?? true, enableCache: options?.enableCache ?? true, userAgent: options?.userAgent }; }
AST#method_declaration#Left createConfig AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left WebViewConfig AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WebViewConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left url AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enableJavaScript AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. enableJavaScript AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enableCache AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. enableCache AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left userAgent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. userAgent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
createConfig(url: string, options?: Partial<WebViewConfig>): WebViewConfig { return { url, enableJavaScript: options?.enableJavaScript ?? true, enableCache: options?.enableCache ?? true, userAgent: options?.userAgent }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/web/WebViewManager.ets#L31-L38
d81482492ed2d4816a8f27323fab02214a507d1c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SimpleChatList/entry/src/main/ets/pages/MaintainVisibleAreaContent.ets
arkts
addData
[Start Add_delete data]
public addData(index: number, data: TextClass): void { this.dataArray.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 TextClass AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public addData(index: number, data: TextClass): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/MaintainVisibleAreaContent.ets#L86-L89
0eb3cda3e12123d4b209124df3c77c2ca14a6354
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/Index.ets
arkts
DecompressFileViewComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { DecompressFileViewComponent } from './src/main/ets/view/MainPage';
AST#export_declaration#Left export { DecompressFileViewComponent } from './src/main/ets/view/MainPage' ; AST#export_declaration#Right
export { DecompressFileViewComponent } from './src/main/ets/view/MainPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/Index.ets#L15-L15
d4c6d669a8a1ec604d7d4cd57c20dc00674e31ef
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
addTag
添加标签
addTag(tag: string): Contact { const trimmedTag = tag.trim(); if (trimmedTag && !this.contact.tags.includes(trimmedTag)) { this.contact.tags.push(trimmedTag); this.contact.updatedAt = new Date().toISOString(); } return this.getContact(); }
AST#method_declaration#Left addTag AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left trimmedTag = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tag AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left trimmedTag 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 . contact AST#member_expression#Right AST#expression#Right . tags AST#member_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left trimmedTag AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . tags AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left trimmedTag 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . updatedAt AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 this AST#expression#Right . getContact 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
addTag(tag: string): Contact { const trimmedTag = tag.trim(); if (trimmedTag && !this.contact.tags.includes(trimmedTag)) { this.contact.tags.push(trimmedTag); this.contact.updatedAt = new Date().toISOString(); } return this.getContact(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L239-L246
c8a2bd675da3b93cc288abb9b82e12ec0b925d9f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
toggleDarkMode
切换深色模式
private toggleDarkMode(enabled: boolean): void { this.isDarkModeEnabled = enabled; // 立即更新颜色系统 const newColors = this.createColorSystem(this.selectedThemeColor, enabled); this.COLORS = newColors; }
AST#method_declaration#Left private toggleDarkMode AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . isDarkModeEnabled AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 立即更新颜色系统 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newColors = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createColorSystem 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 . selectedThemeColor AST#member_expression#Right AST#expression#Right , AST#expression#Left enabled AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right = AST#expression#Left newColors AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private toggleDarkMode(enabled: boolean): void { this.isDarkModeEnabled = enabled; const newColors = this.createColorSystem(this.selectedThemeColor, enabled); this.COLORS = newColors; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5999-L6004
783d619411a5454dd445135026b1a1af260720c6
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
processQueue
处理播放队列
private async processQueue(options?: TTSOptions): Promise<void> { if (this.speakQueue.length === 0 || this.isSpeaking || !this.ttsEngine) { return; } const text = this.speakQueue.shift(); if (!text) { return; } try { this.isSpeaking = true; // 手动合并选项(ArkTS不支持展开运算符) const mergedOptions: TTSOptions = { speed: options?.speed ?? DEFAULT_OPTIONS.speed, pitch: options?.pitch ?? DEFAULT_OPTIONS.pitch, volume: options?.volume ?? DEFAULT_OPTIONS.volume, voiceType: options?.voiceType ?? DEFAULT_OPTIONS.voiceType }; // 构建播放参数 const speakParams: textToSpeech.SpeakParams = { requestId: `tts_${Date.now()}`, extraParams: { "speed": mergedOptions.speed?.toString() || "1.0", "pitch": mergedOptions.pitch?.toString() || "1.0", "volume": mergedOptions.volume?.toString() || "1.0", "audioType": "pcm" } }; // 开始播放 this.logService.tts(`调用ttsEngine.speak(), requestId: ${speakParams.requestId}`); this.startWatchdog(); this.ttsEngine.speak(text, speakParams); this.logService.tts(`speak()调用完成,等待回调`); } catch (error) { const err = error as BusinessError; this.logService.error('TTS', `播放失败: ${err.message}`); this.clearWatchdog(); this.isSpeaking = false; // 继续处理队列中的下一个 await this.processQueue(options); } }
AST#method_declaration#Left private async processQueue AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left TTSOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . speakQueue AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isSpeaking 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 . ttsEngine AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left text = 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 . speakQueue AST#member_expression#Right AST#expression#Right . shift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpeaking 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 // 手动合并选项(ArkTS不支持展开运算符) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mergedOptions : AST#type_annotation#Left AST#primary_type#Left TTSOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left speed AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. speed AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DEFAULT_OPTIONS AST#expression#Right AST#binary_expression#Right AST#expression#Right . speed AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pitch AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. pitch AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DEFAULT_OPTIONS AST#expression#Right AST#binary_expression#Right AST#expression#Right . pitch AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left volume AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. volume AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DEFAULT_OPTIONS AST#expression#Right AST#binary_expression#Right AST#expression#Right . volume AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left voiceType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right ?. voiceType AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DEFAULT_OPTIONS AST#expression#Right AST#binary_expression#Right AST#expression#Right . voiceType AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 构建播放参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left speakParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left textToSpeech . SpeakParams 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 requestId AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` tts_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraParams AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "speed" AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergedOptions AST#expression#Right . speed AST#member_expression#Right AST#expression#Right ?. toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left "1.0" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "pitch" AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergedOptions AST#expression#Right . pitch AST#member_expression#Right AST#expression#Right ?. toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left "1.0" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "volume" AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergedOptions AST#expression#Right . volume AST#member_expression#Right AST#expression#Right ?. toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left "1.0" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "audioType" AST#property_name#Right : AST#expression#Left "pcm" 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 this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 调用ttsEngine.speak(), requestId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left speakParams AST#expression#Right . requestId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startWatchdog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ttsEngine AST#member_expression#Right AST#expression#Right . speak AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right , AST#expression#Left speakParams 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 . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` speak()调用完成,等待回调 ` 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#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'TTS' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 播放失败: 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clearWatchdog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpeaking AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 继续处理队列中的下一个 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 . processQueue 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async processQueue(options?: TTSOptions): Promise<void> { if (this.speakQueue.length === 0 || this.isSpeaking || !this.ttsEngine) { return; } const text = this.speakQueue.shift(); if (!text) { return; } try { this.isSpeaking = true; const mergedOptions: TTSOptions = { speed: options?.speed ?? DEFAULT_OPTIONS.speed, pitch: options?.pitch ?? DEFAULT_OPTIONS.pitch, volume: options?.volume ?? DEFAULT_OPTIONS.volume, voiceType: options?.voiceType ?? DEFAULT_OPTIONS.voiceType }; const speakParams: textToSpeech.SpeakParams = { requestId: `tts_${Date.now()}`, extraParams: { "speed": mergedOptions.speed?.toString() || "1.0", "pitch": mergedOptions.pitch?.toString() || "1.0", "volume": mergedOptions.volume?.toString() || "1.0", "audioType": "pcm" } }; this.logService.tts(`调用ttsEngine.speak(), requestId: ${speakParams.requestId}`); this.startWatchdog(); this.ttsEngine.speak(text, speakParams); this.logService.tts(`speak()调用完成,等待回调`); } catch (error) { const err = error as BusinessError; this.logService.error('TTS', `播放失败: ${err.message}`); this.clearWatchdog(); this.isSpeaking = false; await this.processQueue(options); } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L224-L270
8f1347ff9984b6d41168664061afe56e81988871
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
asyncAdd
/ (异步)向db中添加新的wordIds
asyncAdd(wordIds: number[]): void { setTimeout(async () => { await this.add(wordIds); }, 0); }
AST#method_declaration#Left asyncAdd AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 setTimeout ( 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#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 . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wordIds 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 0 AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
asyncAdd(wordIds: number[]): void { setTimeout(async () => { await this.add(wordIds); }, 0); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L489-L493
99885b686845cdf899ee5666c56cfb77d0080890
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param aesKey SM4密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns
static encodeCBC(str: string, sm4Key: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . encodeCBC AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left sm4Key AST#expression#Right , AST#expression#Left iv AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|CBC|PKCS7' AST#expression#Right , AST#expression#Left 128 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encodeCBC(str: string, sm4Key: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L72-L75
0ff761c93fed639e5539af615feb2a36ae75c487
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Standard popup notice duration for intervals of 1 millisecond, 2 seconds. @returns 2000
export function animation_popup_duration() { return 1000; }
AST#export_declaration#Left export AST#function_declaration#Left function animation_popup_duration AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 1000 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function animation_popup_duration() { return 1000; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L77-L79
3222abfa415e7b9b5b98c96a2d22b0aaf6a59e83
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/view/CommBackgroundIcon.ets
arkts
CommBackgroundIcon
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@Component export struct CommBackgroundIcon { @Prop icon: Resource; onClickImage: () => void = () => { }; build() { Row() { Image(this.icon) .width(24) .height(24) } .onClick(() => { this.onClickImage(); }) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .backgroundColor('#333333') .borderRadius(20) .width(40) .height(40) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommBackgroundIcon AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left onClickImage : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#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 this AST#expression#Right . icon AST#member_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#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 . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onClickImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . 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 '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CommBackgroundIcon { @Prop icon: Resource; onClickImage: () => void = () => { }; build() { Row() { Image(this.icon) .width(24) .height(24) } .onClick(() => { this.onClickImage(); }) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .backgroundColor('#333333') .borderRadius(20) .width(40) .height(40) } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/CommBackgroundIcon.ets#L16-L38
be5d966952c96159adb0026e67ed450fbfdb0084
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getNewVersion
从due数据库取新版本信息 @return resolve 新版本信息/reject 错误信息
async getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>> { return new Promise((resolve, reject) => { this.updateManager.getNewVersion().then((result: UpgradeData<update.NewVersionInfo>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result?.data; resolve(result); } else { resolve(result); } }); }); }
AST#method_declaration#Left async getNewVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . NewVersionInfo 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#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 AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateManager AST#member_expression#Right AST#expression#Right . getNewVersion 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . NewVersionInfo 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#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right ?. callResult AST#member_expression#Right AST#expression#Right === AST#expression#Left UpgradeCallResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . OK AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left globalThis AST#expression#Right . cachedNewVersionInfo AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right ?. data AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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
async getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>> { return new Promise((resolve, reject) => { this.updateManager.getNewVersion().then((result: UpgradeData<update.NewVersionInfo>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result?.data; resolve(result); } else { resolve(result); } }); }); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L92-L103
0a1c44ba53db975f363ab82d674bc6a1f22defd6
gitee