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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/SimpleLunarCalendar.ets
arkts
简化版农历计算系统 专注解决用户报告的核心问题 农历日期接口
export interface SimpleLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; monthName: string; dayName: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleLunarDate AST#object_type#Left { AST#type_member#Left year : 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 month : AST#type_annotation#L...
export interface SimpleLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; monthName: string; dayName: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/SimpleLunarCalendar.ets#L9-L16
b7398a8a4a28c102c8936529dc1aa234ec540595
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets
arkts
checkUsernameAvailability
验证用户名是否可用
async checkUsernameAvailability(username: string) { if (!username || username.length < 3) { return; } try { this.isCheckingUsername = true; const response = await checkUsername(username); if (response.code === 200) { if (response.data === true) { this.us...
AST#method_declaration#Left async checkUsernameAvailability AST#parameter_list#Left ( AST#parameter#Left username : 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_s...
async checkUsernameAvailability(username: string) { if (!username || username.length < 3) { return; } try { this.isCheckingUsername = true; const response = await checkUsername(username); if (response.code === 200) { if (response.data === true) { this.us...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets#L47-L70
08b89f209826158fb808510f96549b99f9a60cd3
github
wuyukobe24/HMApp_ArkTS.git
6d09d9b07a4fdc4713e5a13b61b85bc1e7893956
entry/src/main/ets/common/networking/QQNetworkRequest.ets
arkts
post
export function postRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:Error)=>void) { let httpRequest = http.createHttp() let reponseResult = httpRequest.request(url, { method: http.RequestMethod.POST, readTimeout:60000, connectTimeout:60000, header: header, extraData: pa...
AST#export_declaration#Left export AST#function_declaration#Left function postRequest 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 param : AST#type_annotation#Left AST#pr...
export function postRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:Error)=>void) { let httpRequest = http.createHttp() let reponseResult = httpRequest.request(url, { method: http.RequestMethod.POST, readTimeout:60000, connectTimeout:60000, header: header, extraData: pa...
https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/common/networking/QQNetworkRequest.ets#L20-L50
88e56c28912bd6ba1c97e36dc387f08c677c6930
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/AboutSample/entry/src/main/ets/view/TechSupportComponent.ets
arkts
TechSupportComponent
Privacy agreement and copyright statement page.
@Component export struct TechSupportComponent { build() { Column() { Row() { Text($r('app.string.user_protocol')) .fontSize($r('app.float.bottom_font_size')) .fontColor($r('app.color.text_link')) .onClick(() => this.openAgreementPage()) Text($r('app.string.and')...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TechSupportComponent 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_...
@Component export struct TechSupportComponent { build() { Column() { Row() { Text($r('app.string.user_protocol')) .fontSize($r('app.float.bottom_font_size')) .fontColor($r('app.color.text_link')) .onClick(() => this.openAgreementPage()) Text($r('app.string.and')...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/view/TechSupportComponent.ets#L7-L50
0e030b2a72c1c8d7f857adcd54a7fae6a503bc23
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_003_T.ets
arkts
Introduction 参数传递-参数位置
export function argument_passing_003_T(taint_src : string) { f(taint_src,"_"); }
AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function argument_passing_003_T(taint_src : string) { f(taint_src,"_"); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_003_T.ets#L6-L8
b90ea184ea55db90123ef857000bb82bd40a914a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/Index.ets
arkts
TitleExpansionView
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, soft...
export { TitleExpansionView } from './src/main/ets/page/TitleExpansionView';
AST#export_declaration#Left export { TitleExpansionView } from './src/main/ets/page/TitleExpansionView' ; AST#export_declaration#Right
export { TitleExpansionView } from './src/main/ets/page/TitleExpansionView';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/Index.ets#L15-L15
f500425269d89e4a3c9736ed25687fa81f3d33fa
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/goods/VHGoodsComponent.ets
arkts
openLink
打开链接
private openLink(url: string) { const params = new GoodsWebViewParams("支付", url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(GoodsWebViewPageBuilder), params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptA...
AST#method_declaration#Left private openLink 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
private openLink(url: string) { const params = new GoodsWebViewParams("支付", url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(GoodsWebViewPageBuilder), params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptA...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L915-L932
6967d3ffc4fc5409370802f3c5ec4f84b33ac169
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets
arkts
onWrite
写属性。收到平台下发的写属性操作时此接口被自动调用。 如果用户希望在写属性时增加额外处理,可以重写此接口 @param properties 平台期望属性的值 @return 操作结果
onWrite(properties: object): IotResult { let changeProps: string[] = []; let result = IotResult.SUCCESS; Object.keys(properties).every((propertyName: string) => { const field = this.writeableFields.get(propertyName); if (field === null || field === undefined) { LogUtil.error(`field not f...
AST#method_declaration#Left onWrite AST#parameter_list#Left ( AST#parameter#Left properties : 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 IotResult AST#primary_type#...
onWrite(properties: object): IotResult { let changeProps: string[] = []; let result = IotResult.SUCCESS; Object.keys(properties).every((propertyName: string) => { const field = this.writeableFields.get(propertyName); if (field === null || field === undefined) { LogUtil.error(`field not f...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets#L164-L191
53e66dd552855318e32dacc3527f9414a318bf90
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets
arkts
isInRect
Determine whether it is within the rectangle. @param x @param y @returns
isInRect(x: number, y: number): boolean { return (x >= this.left && x <= this.right && y >= this.top && y <= this.bottom); }
AST#method_declaration#Left isInRect 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_...
isInRect(x: number, y: number): boolean { return (x >= this.left && x <= this.right && y >= this.top && y <= this.bottom); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L108-L110
bb0a7d8ef54400c1a703d38cf5e4d672e5507d2b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
removeSavedGift
删除保存的礼物
async removeSavedGift(giftId: string): Promise<boolean> { const index = this.savedGifts.findIndex(g => g.id === giftId); if (index === -1) { return false; } const removed = this.savedGifts.splice(index, 1)[0]; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_AP...
AST#method_declaration#Left async removeSavedGift AST#parameter_list#Left ( AST#parameter#Left giftId : 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#...
async removeSavedGift(giftId: string): Promise<boolean> { const index = this.savedGifts.findIndex(g => g.id === giftId); if (index === -1) { return false; } const removed = this.savedGifts.splice(index, 1)[0]; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_AP...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L206-L217
dae350a9fae5669a142ca4ccab9802f3d21c14bb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationManagementUtil.ets
arkts
cancelNotificationType
取消属于该类型的通知
cancelNotificationType(typeId: number) { console.info(`cancelNotificationType, ${JSON.stringify(this.typeNotifications)}`) this.typeNotifications[typeId].forEach(item => { notification.cancel(item.id); }) }
AST#method_declaration#Left cancelNotificationType AST#parameter_list#Left ( AST#parameter#Left typeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AS...
cancelNotificationType(typeId: number) { console.info(`cancelNotificationType, ${JSON.stringify(this.typeNotifications)}`) this.typeNotifications[typeId].forEach(item => { notification.cancel(item.id); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationManagementUtil.ets#L53-L58
047105c8a61deb2d17e701537b79fd46569618fe
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/scanner/ScannerManager.ets
arkts
scan
扫描二维码/条码
async scan(): Promise<ScanResult | null> { try { Logger.info('ScannerManager', 'Starting scan'); // 实际实现需要使用 @ohos.multimedia.image 和相机API // Mock 结果 return { text: 'https://example.com', format: 'QR_CODE', type: 'qr' }; } catch (error) { Logger.error(...
AST#method_declaration#Left async scan 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#union_type#Left AST#primary_type#Left ScanResult AST#primary_type#Right | AST#primary_type#Lef...
async scan(): Promise<ScanResult | null> { try { Logger.info('ScannerManager', 'Starting scan'); return { text: 'https://example.com', format: 'QR_CODE', type: 'qr' }; } catch (error) { Logger.error('ScannerManager', `Failed to scan: ${String(error)}...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/scanner/ScannerManager.ets#L30-L44
51a4aa6c2c2c68d233dbd0d5f10ed6077b871e52
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderRepository.ets
arkts
updateOrder
更新订单信息 @param params 更新参数 @returns 更新结果
async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.updateOrder(params); }
AST#method_declaration#Left async updateOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Unknown 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#Lef...
async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.updateOrder(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L47-L49
475212cdea5ec9a9a515d6aa2a6e002766951b3b
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class CommonConstants { /** * Component size. */ static readonly SWIPER_DEFAULT_WIDTH: string = '66%'; static readonly FULL_PERCENT: string = '100%'; static readonly HALF_PERCENT: string = '50%'; static readonly IMAGE_CONTAINER_HEIGHT: string = '42%'; static readonly FULL_SIZE: string = '100%';...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Component size. */ AST#property_declaration#Left static readonly SWIPER_DEFAULT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expre...
export class CommonConstants { static readonly SWIPER_DEFAULT_WIDTH: string = '66%'; static readonly FULL_PERCENT: string = '100%'; static readonly HALF_PERCENT: string = '50%'; static readonly IMAGE_CONTAINER_HEIGHT: string = '42%'; static readonly FULL_SIZE: string = '100%'; static readonly ICON_SIZE: ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L534
25599fe9424de0da35e37e4ee2a25959e7845cc0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets
arkts
searchAddress
搜索视图
@Builder searchAddress() { Column() { Row() { Text($r("app.string.bottomdrawerslidecase_set_out")) .fontSize($r("app.integer.bottomdrawerslidecase_number_15")) Text($r("app.string.bottomdrawerslidecase_destination_new")) .fontSize($r("app.integer.bottomdrawerslidecase_num...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right searchAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder searchAddress() { Column() { Row() { Text($r("app.string.bottomdrawerslidecase_set_out")) .fontSize($r("app.integer.bottomdrawerslidecase_number_15")) Text($r("app.string.bottomdrawerslidecase_destination_new")) .fontSize($r("app.integer.bottomdrawerslidecase_num...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets#L120-L164
13351776430ec9693494dec7c0081b4c02c02157
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
archive_onWorkingTab
Try to archive current main tab into a mht file. Calls the picker for user to save. @param dir Should be this.getUIContext().getHostContext()?.tempDir
archive_onWorkingTab(dir?: string) { // let dir = this.getUIContext().getHostContext()?.tempDir; if (dir) { this.workingMainTab().controller?.storeWebArchive(dir + '/meow_save.mht', false, ((e, filename) => { if (e) { console.error(`[Save Page] Failed: ${e.name}, ${e.message}, ${e.code}`...
AST#method_declaration#Left archive_onWorkingTab AST#parameter_list#Left ( AST#parameter#Left dir ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // let dir = this.getUIContext().ge...
archive_onWorkingTab(dir?: string) { if (dir) { this.workingMainTab().controller?.storeWebArchive(dir + '/meow_save.mht', false, ((e, filename) => { if (e) { console.error(`[Save Page] Failed: ${e.name}, ${e.message}, ${e.code}`); } if (filename) { console.log(...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L129-L142
ce14c244b17849c52d649424428e3ffdc8f92f12
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/component/FlipCard.ets
arkts
buildBackSide
构建卡片背面(答案解析)
@Builder private buildBackSide(): void { Column({ space: 16 }) { // 答案标题 Text('答案解析') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#1890ff') .textAlign(TextAlign.Center) // 答案内容(使用解析内容) // 解析内容 if (this.problem.explanation) { Colu...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildBackSide AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui...
@Builder private buildBackSide(): void { Column({ space: 16 }) { Text('答案解析') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#1890ff') .textAlign(TextAlign.Center) if (this.problem.explanation) { Column({ space: 8 }) { ...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/component/FlipCard.ets#L59-L103
3ff65ff9123d9e8d267957927d24da8018bcd5ec
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM3.ets
arkts
hmacSegment
消息认证码计算,分段,异步 @param data 传入的消息 @param symKey 共享对称密钥(SymKey)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度
static async hmacSegment(data: string, symKey: cryptoFramework.SymKey = SM3.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { return CryptoUtil.hmacSegment(data, 'SM3', symKey, resultCoding, len); }
AST#method_declaration#Left static async hmacSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
static async hmacSegment(data: string, symKey: cryptoFramework.SymKey = SM3.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { return CryptoUtil.hmacSegment(data, 'SM3', symKey, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L104-L107
bcee0cd5026491f0b21cf56d27523d2721d70bfa
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Settings.ets
arkts
SettingItemWithArrow
带箭头的设置项
@Builder SettingItemWithArrow(icon: string, title: string, subtitle: string) { Row() { Text(icon) .fontSize(24) .margin({ right: 12 }) Column() { Text(title) .fontSize(16) .fontColor('#333333') .margin({ bottom: 4 }) Text(su...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SettingItemWithArrow AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotatio...
@Builder SettingItemWithArrow(icon: string, title: string, subtitle: string) { Row() { Text(icon) .fontSize(24) .margin({ right: 12 }) Column() { Text(title) .fontSize(16) .fontColor('#333333') .margin({ bottom: 4 }) Text(su...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Settings.ets#L243-L275
e052cb0291e07b7aab7c5a94aa3d7719cd01a2c6
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets
arkts
瀑布流子组件WrappedBuilder对象
export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder);
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left flowItemWrapper : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_anno...
export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder);
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets#L24-L24
eb86d1efb19b8f3159f168e348f281bcff2c70db
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/web/WebViewManager.ets
arkts
openThirdPartyApp
打开第三方应用
async openThirdPartyApp(scheme: string): Promise<boolean> { try { Logger.info('WebViewManager', `Opening third party app: ${scheme}`); // 实际实现需要使用 @ohos.app.ability.common 的 startAbility return true; } catch (error) { Logger.error('WebViewManager', `Failed to open third party app: ${Stri...
AST#method_declaration#Left async openThirdPartyApp AST#parameter_list#Left ( AST#parameter#Left scheme : 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_typ...
async openThirdPartyApp(scheme: string): Promise<boolean> { try { Logger.info('WebViewManager', `Opening third party app: ${scheme}`); return true; } catch (error) { Logger.error('WebViewManager', `Failed to open third party app: ${String(error)}`); return false; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/web/WebViewManager.ets#L56-L65
bc28e55d244c359b32dc99e9cf9d8ee595209da4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
buildTime
构建时间
static buildTime(): string { return deviceInfo.buildTime }
AST#method_declaration#Left static buildTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express...
static buildTime(): string { return deviceInfo.buildTime }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L209-L211
420304cd58769e0f199655531540285329ef5287
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
openExtensionServiceManagementStatusListener
listen extensionService status
openExtensionServiceManagementStatusListener() { try { config.on('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`subscribe enabled accessibility extension list change state success`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUt...
AST#method_declaration#Left openExtensionServiceManagementStatusListener 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 ...
openExtensionServiceManagementStatusListener() { try { config.on('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`subscribe enabled accessibility extension list change state success`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUt...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L80-L89
a53b3aa2d492526f5a0f5be263e5bcfa9831fa8b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceEvenlyEnd
纵向均分 + 水平末尾
@ComponentV2 export struct ColumnSpaceEvenlyEnd { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) *...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceEvenlyEnd AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#prima...
@ComponentV2 export struct ColumnSpaceEvenlyEnd { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Pa...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1345-L1420
00f4afc767417156a6424c173d7cd477597ee5c7
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/PlayerService.ets
arkts
updateSessionPlaybackState
更新 AVSession 播放状态
private async updateSessionPlaybackState(): Promise<void> { if (!this.session) { return; } try { let sessionState: avSession.PlaybackState = avSession.PlaybackState.PLAYBACK_STATE_STOP; switch (this.state) { case PlayerState.PLAYING: sessionState = avSession.PlaybackStat...
AST#method_declaration#Left private async updateSessionPlaybackState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : 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...
private async updateSessionPlaybackState(): Promise<void> { if (!this.session) { return; } try { let sessionState: avSession.PlaybackState = avSession.PlaybackState.PLAYBACK_STATE_STOP; switch (this.state) { case PlayerState.PLAYING: sessionState = avSession.PlaybackStat...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PlayerService.ets#L140-L149
4ba98c057bddd26a1104d8ca5100807e4949ef25
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/PhoneUtil.ets
arkts
isTel400800
验证是否为座机号码(中国)+ 400 + 800 @param content 手机号码
static isTel400800(content: string): OutDTO<string> { if (content == null || content == '') { // 提供null的字符串为不匹配 return OutDTO.Error("验证号码不能为空"); } if (new RegExp(Const.TEL_400_800).test(content)) { return OutDTO.OK("号码为400800格式的座机") } else { return OutDTO.Error("号码非400800格式的座机,请检...
AST#method_declaration#Left static isTel400800 AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
static isTel400800(content: string): OutDTO<string> { if (content == null || content == '') { return OutDTO.Error("验证号码不能为空"); } if (new RegExp(Const.TEL_400_800).test(content)) { return OutDTO.OK("号码为400800格式的座机") } else { return OutDTO.Error("号码非400800格式的座机,请检查") } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/PhoneUtil.ets#L117-L127
016948dc80a4b459f3a3733a2bba6fcaa0548a63
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/sync/CloudSyncService.ets
arkts
uploadDataType
上传指定类型的数据
private async uploadDataType(dataType: DataType, options: SyncOptions): Promise<number> { let count = 0; switch (dataType) { case DataType.CONTACTS: const contacts = await this.contactService.searchContacts({ pageSize: 10000 }); for (const contact of contacts) { await this.uploa...
AST#method_declaration#Left private async uploadDataType AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left Sync...
private async uploadDataType(dataType: DataType, options: SyncOptions): Promise<number> { let count = 0; switch (dataType) { case DataType.CONTACTS: const contacts = await this.contactService.searchContacts({ pageSize: 10000 }); for (const contact of contacts) { await this.uploa...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudSyncService.ets#L300-L325
a2bb42982819186090a42355c9dfaadfecc9377f
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
getDefaultConfig
获取默认配置
getDefaultConfig(): LLMConfig | null { const defaultConfig = this.configs.find(config => config.isDefault); return defaultConfig || null; }
AST#method_declaration#Left getDefaultConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LLMConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#L...
getDefaultConfig(): LLMConfig | null { const defaultConfig = this.configs.find(config => config.isDefault); return defaultConfig || null; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L185-L188
aa417f5b65df4c3460b71f6847fccfba568dc071
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
touchInThumb
判断触碰事件有效
touchInThumb(event?: GestureEvent): boolean { if (this.touchInLeftThumb(event) || this.touchInRightThumb(event)) { return true; } else { return false; } }
AST#method_declaration#Left touchInThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
touchInThumb(event?: GestureEvent): boolean { if (this.touchInLeftThumb(event) || this.touchInRightThumb(event)) { return true; } else { return false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L432-L438
c7f4264aaa16121185ab8ec63f3e395175f92de7
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
isDrawCenterTextEnabled
returns true if drawing the center text is enabled @return
public isDrawCenterTextEnabled(): boolean { return this.mDrawCenterText; }
AST#method_declaration#Left public isDrawCenterTextEnabled 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...
public isDrawCenterTextEnabled(): boolean { return this.mDrawCenterText; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L512-L514
541e86f038dd5f45210cb407027eff497e1991fc
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/entry/src/main/ets/pages/Index.ets
arkts
createTestResources
创建订阅者回调
function createTestResources(err: BusinessError, commonEventSubscriber: CommonEventManager.CommonEventSubscriber) { if(!err) { subscriber = commonEventSubscriber; try { CommonEventManager.subscribe(subscriber, JumpToResApiExample); } catch (error) { let code = (error as BusinessError).code; ...
AST#function_declaration#Left function createTestResources 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 commonEventSubscriber : AST#type_annotation#Left AST#primar...
function createTestResources(err: BusinessError, commonEventSubscriber: CommonEventManager.CommonEventSubscriber) { if(!err) { subscriber = commonEventSubscriber; try { CommonEventManager.subscribe(subscriber, JumpToResApiExample); } catch (error) { let code = (error as BusinessError).code; ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/entry/src/main/ets/pages/Index.ets#L33-L46
5ed902d2ca0542c4b79584cd2da40385e3d80f0e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets
arkts
addItem
添加列表项 @param item: 列表项
addItem(item: T): void { this.deductionData.push(item); this.modifier.push(new ListItemModifier()); }
AST#method_declaration#Left addItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T 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_a...
addItem(item: T): void { this.deductionData.push(item); this.modifier.push(new ListItemModifier()); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets#L207-L210
965952300ea2b4cd0ff9720f4ac4152f2e6a67ae
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
concatTime
时分秒格式修饰 @param hours @param minutes @param seconds
concatTime(hours: number, minutes: number, seconds: number): string { return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`; }
AST#method_declaration#Left concatTime AST#parameter_list#Left ( AST#parameter#Left hours : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig...
concatTime(hours: number, minutes: number, seconds: number): string { return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`; }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L72-L74
bcd93db45c5acd37819f6be5c51168b5a14107aa
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderCard.ets
arkts
构建订单卡片 @returns {void} 无返回值
build(): void { Card({ onTap: (): void => this.toOrderDetail(this.order.id) }) { this.buildHeader(); this.buildGoodsPreview(); this.buildDivider(); this.buildActionBar(); } }
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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left onTap : AST#...
build(): void { Card({ onTap: (): void => this.toOrderDetail(this.order.id) }) { this.buildHeader(); this.buildGoodsPreview(); this.buildDivider(); this.buildActionBar(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderCard.ets#L73-L82
af76ba240f9ec95dcd5312be4c0df63c6ca3552e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/launch/src/main/ets/navigation/LaunchGraph.ets
arkts
register
注册启动模块导航路由
register(): void { RouteBuild.register(LaunchRoutes.Splash, wrapBuilder(SplashNav)); RouteBuild.register(LaunchRoutes.Guide, wrapBuilder(GuideNav)); }
AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left...
register(): void { RouteBuild.register(LaunchRoutes.Splash, wrapBuilder(SplashNav)); RouteBuild.register(LaunchRoutes.Guide, wrapBuilder(GuideNav)); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/navigation/LaunchGraph.ets#L14-L17
c77d77d67154c82cfed953a1ca800028f35a4097
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
backgroundColor
Sets the backgroundColor of the toolBar. @param { ResourceColor } backgroundColor - toolBar's backgroundColor. @returns { ToolBarModifier } returns the instance of the ToolBarModifier. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
AST#method_declaration#Left backgroundColor AST#parameter_list#Left ( AST#parameter#Left backgroundColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBar...
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L251-L251
b4d81a71e53ca190dd32b7a421a6cdef79139707
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
arkts
CardDesc
卡片说明样式 @param {Resource | string} text - 说明文本 @returns {void} 无返回值
@Builder private CardDesc(text: Resource | string): void { Text(text) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_subtitle")); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CardDesc AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right ...
@Builder private CardDesc(text: Resource | string): void { Text(text) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_subtitle")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L289-L294
a2fbb01586ff487a54a9019daa8031239df393c5
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets
arkts
getResourceList
获取账单来源列表
public getResourceList() { if (!this._resource?.income?.length && !this._resource?.expense?.length) { this._createResourceMap(); return this._resource; } return this._resource; }
AST#method_declaration#Left public getResourceList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AS...
public getResourceList() { if (!this._resource?.income?.length && !this._resource?.expense?.length) { this._createResourceMap(); return this._resource; } return this._resource; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L71-L77
0119ef415b3c575e7bd06ba139e07495c179172a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AuthUtil.ets
arkts
TODO 手机的生物认证(指纹、人脸、密码)工具类 需要权限 ohos.permission.ACCESS_BIOMETRIC author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class AuthUtil { private static userAuthInstance: userAuth.UserAuthInstance; //认证对象 /** * 查询指定类型和等级的认证能力是否支持。 * @param authType * @param authTrustLevel * @returns */ static getAvailableStatus(authType: userAuth.UserAuthType, authTrustLevel: userAuth.AuthTrustLevel): StatusResult { try ...
AST#export_declaration#Left export AST#class_declaration#Left class AuthUtil AST#class_body#Left { AST#property_declaration#Left private static userAuthInstance : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthInstance AST#qualified_type#Right AST#primary_type#Right AST#type_a...
export class AuthUtil { private static userAuthInstance: userAuth.UserAuthInstance; static getAvailableStatus(authType: userAuth.UserAuthType, authTrustLevel: userAuth.AuthTrustLevel): StatusResult { try { userAuth.getAvailableStatus(authType, authTrustLevel); return { status: true }; } ca...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AuthUtil.ets#L31-L191
38ddca81734ad6eb14a6bf4849b35f9080b0a293
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RandomUtil.ets
arkts
TODO 随机工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class RandomUtil { /** * 生成随机Boolean值 * @return true or false */ static getRandomBoolean(): boolean { return Math.random() >= 0.5; } /** * 生成随机整数(可指定范围) * @return 随机数 */ static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { min = Math.ceil(m...
AST#export_declaration#Left export AST#class_declaration#Left class RandomUtil AST#class_body#Left { /** * 生成随机Boolean值 * @return true or false */ AST#method_declaration#Left static getRandomBoolean AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AS...
export class RandomUtil { static getRandomBoolean(): boolean { return Math.random() >= 0.5; } static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; } ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RandomUtil.ets#L24-L85
3f43108f0145a6a1003ff1b0b29589f01a4f4f45
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/FlexLayout/entry/src/main/ets/viewmodel/SearchViewModel.ets
arkts
getSearchArrData
Get search arr data.
getSearchArrData() { let listItems: Array<string> = [ 'Text', 'Button', 'TextField', 'Image', 'Switch', 'Checkbox', 'RadioButton', 'ProgressBar', 'ScrollView' ]; return listItems; }
AST#method_declaration#Left getSearchArrData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < ...
getSearchArrData() { let listItems: Array<string> = [ 'Text', 'Button', 'TextField', 'Image', 'Switch', 'Checkbox', 'RadioButton', 'ProgressBar', 'ScrollView' ]; return listItems; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/FlexLayout/entry/src/main/ets/viewmodel/SearchViewModel.ets#L23-L30
3890393f0b849ff967245d5cd567e68b1a496175
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
closeFlawDetail
关闭故障详情
closeFlawDetail() { this.flawDetailDialogController.close(); this.selectedFlaw = null; }
AST#method_declaration#Left closeFlawDetail 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 t...
closeFlawDetail() { this.flawDetailDialogController.close(); this.selectedFlaw = null; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L270-L273
7bb47555e92cac44bf5a4a53be9260285416e862
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
findEntityByGoodsId
根据商品ID查询实体 @param {number} goodsId 商品ID @returns {CartEntity | undefined} 匹配实体
private findEntityByGoodsId(goodsId: number): CartEntity | undefined { const result: CartEntity[] = this.orm.query(CartEntity).where("goodsId", goodsId).find(); return result[0]; }
AST#method_declaration#Left private findEntityByGoodsId AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_...
private findEntityByGoodsId(goodsId: number): CartEntity | undefined { const result: CartEntity[] = this.orm.query(CartEntity).where("goodsId", goodsId).find(); return result[0]; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L156-L159
8f1b507997e5127262b73cbb66ad287a098af9a7
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/UpdaterComponent.ets
arkts
OneMomentNoModifier
[EndExclude opt_updater]
@Reusable @Component export struct OneMomentNoModifier { @State text: string = ''; color: string | number | Resource | Color = ''; textUpdater: MyTextUpdater | null = null; aboutToAppear(): void { this.textUpdater = new MyTextUpdater(this.color); } aboutToReuse(params: Record<string, Object>): void { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct OneMomentNoModifier AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right text : AST#type_annotation#Left AST#primary_...
@Reusable @Component export struct OneMomentNoModifier { @State text: string = ''; color: string | number | Resource | Color = ''; textUpdater: MyTextUpdater | null = null; aboutToAppear(): void { this.textUpdater = new MyTextUpdater(this.color); } aboutToReuse(params: Record<string, Object>): void { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/UpdaterComponent.ets#L71-L125
bd74297cf160c822f570043d8d5d8bc50cb1b66c
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Infers the id of window. @param w The windowClass (window.Window).
export function window_id_of_windowClass(w: window.Window) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[window_index_of_windowClass(w)]; return window_id; }
AST#export_declaration#Left export AST#function_declaration#Left function window_id_of_windowClass AST#parameter_list#Left ( AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramet...
export function window_id_of_windowClass(w: window.Window) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[window_index_of_windowClass(w)]; return window_id; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L512-L516
96acb0e32e0c723411a2f9818be95a3fc8f122f1
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemove.ets
arkts
应用约束60:使用export default代替module.exports
export default MessageReactionRemove;
AST#export_declaration#Left export default AST#expression#Left MessageReactionRemove AST#expression#Right ; AST#export_declaration#Right
export default MessageReactionRemove;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemove.ets#L19-L19
6c69b455985127be955812847c9881283e045234
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
isExistWithSql
检查查询结果是否存在记录 @param sql - 存在性查询语句(如:"SELECT 1 FROM users WHERE id = ?") @param params - 查询参数(可选) @returns Promise<boolean> 返回是否存在记录
async isExistWithSql(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) // 只需检查是否有第一条记录 const exists = resultSet.goToNextRow(); ...
AST#method_declaration#Left async isExistWithSql AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ...
async isExistWithSql(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { const resultSet = await this.rdbStore!.querySql(sql, params); DebugLog.d(sql +' 参数: ' + params) const exists = resultSet.goToNextRow(); resultSet....
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L315-L332
8e992b2cf11bb14b0b8fb4dc19e026f95d8e4cf2
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/rephone.ets
arkts
aboutToAppear
页面加载时获取用户数据
aboutToAppear() { this.getUserData(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUserData AST#member...
aboutToAppear() { this.getUserData(); }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/rephone.ets#L40-L42
aa4d8e1194821db8cf919ac3b035a648ef613cec
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
AI提供商扩展配置
export interface AIProviderExtendedConfig { provider: AIProvider; displayName: string; supportedModels: string[]; defaultModel: string; requiresApiKey: boolean; apiKeyFormat: string; supportsStreaming: boolean; maxTokensLimit: number; pricingInfo?: PricingInfo; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIProviderExtendedConfig AST#object_type#Left { AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left AIProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left displayName ...
export interface AIProviderExtendedConfig { provider: AIProvider; displayName: string; supportedModels: string[]; defaultModel: string; requiresApiKey: boolean; apiKeyFormat: string; supportsStreaming: boolean; maxTokensLimit: number; pricingInfo?: PricingInfo; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L671-L681
4db473f684a60e3d4ee079273ecc586e1581bf0e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagetheft/src/main/ets/view/ImageTheft.ets
arkts
ImageTheftComponent
功能描述: 使用第三方库imageknife,通过在请求头中添加Referer来实现防盗链图片的功能。 推荐场景: 网络图片资源需要防盗链的场景 核心组件: 1. imageknife 实现步骤: 1. 新建imageKnifeOption变量,作为ImageKnifeComponent的入参配置。 2. 新建RequestOption对象实例,并在里面配置请求头,缓存规则,以及请求成功和回调等配置。 3. 在imageknife实例调用call函数,传入步骤2里面的实例。
@Component export struct ImageTheftComponent { @State imgUrl: string = DEFAULT_IMG_URL; // 图片image的url @State refer: string = DEFAULT_REFER; // 图片image的refer @State imageKnifeOption: ImageKnifeOption = { // 图片组件ImageKnifeComponent的配置项 loadSrc: '', isCacheable: false, }; @StorageLink('avoidAreaBott...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageTheftComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imgUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
@Component export struct ImageTheftComponent { @State imgUrl: string = DEFAULT_IMG_URL; @State refer: string = DEFAULT_REFER; @State imageKnifeOption: ImageKnifeOption = { loadSrc: '', isCacheable: false, }; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; emptyPix...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/view/ImageTheft.ets#L49-L195
01bfa442cbbd18aa7ac161337142ccd2fe8ede7a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageresizable/src/main/ets/pages/ProductWaterFlowPage.ets
arkts
ProductWaterFlowPageComponent
功能描述:HarmonyOS上不支持.9资源文件进行安全拉伸。 作为替代方案,本案例中商城页面的促销标签边框使用同一张图片资源,通过设置图片的resizable属性,展示不同长度的促销标签效果。 推荐场景:商城页面 核心组件: 1.ProductItemComp, 实现步骤: 1.使用WaterFlow+LazyForEach+组件复用实现高性能瀑布流
@Component export struct ProductWaterFlowPageComponent { @State productsDataSource: ProductsDataSource = new ProductsDataSource(); build() { Column(){ WaterFlow() { LazyForEach(this.productsDataSource, (item: Product) => { FlowItem() { // TODO: 性能知识点:使用@Reusable修饰可复用的组件,并通过设...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ProductWaterFlowPageComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right productsDataSource : AST#type_annotation#Left AST#primary_type#Left ProductsDataSour...
@Component export struct ProductWaterFlowPageComponent { @State productsDataSource: ProductsDataSource = new ProductsDataSource(); build() { Column(){ WaterFlow() { LazyForEach(this.productsDataSource, (item: Product) => { FlowItem() { ProductItemComp({ ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageresizable/src/main/ets/pages/ProductWaterFlowPage.ets#L32-L62
0683462cb620e55f0dd6d55921af71c372a30b1a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM3.ets
arkts
digestSegmentSync
SM3分段摘要,同步 @param data 待摘要的数据 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'SM3', resultCoding, len); }
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#quali...
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'SM3', resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L69-L71
7cea6fc11f3ca2485ccc2684fe3a9d6cecfe30b3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Sync.ets
arkts
encryptMessage
加密消息
function encryptMessage(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null); let encryptData = cipher.doFinalSync(plainText); return encryptData; }
AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left publicKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef...
function encryptMessage(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null); let encryptData = cipher.doFinalSync(plainText); return encryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Sync.ets#L20-L25
2b827aead67df9da559e5517b0dd9c55587e54f3
gitee
wuyukobe24/HMApp_ArkTS.git
6d09d9b07a4fdc4713e5a13b61b85bc1e7893956
entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets
arkts
loadHomeRequestSegmentListData
获取首页Segment数据
loadHomeRequestSegmentListData(success:(str:string)=>void, fail:(error:NetError)=>void) { let param:Record<string, string> = { } let url:string = '/go/zone/v3/channel?zone=plat' getRequest(url, param, (jsonStr:string) => { success(jsonStr) }, (error:NetError) => { console.error(`viewmod...
AST#method_declaration#Left loadHomeRequestSegmentListData AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#function_type#Left 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#...
loadHomeRequestSegmentListData(success:(str:string)=>void, fail:(error:NetError)=>void) { let param:Record<string, string> = { } let url:string = '/go/zone/v3/channel?zone=plat' getRequest(url, param, (jsonStr:string) => { success(jsonStr) }, (error:NetError) => { console.error(`viewmod...
https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets#L11-L22
25025e39dc3417ac55af40382f6d637db49ec5e3
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/HomeViewModel.ets
arkts
aboutToAppear
页面出现时初始化页面数据 @returns {void} 无返回值
aboutToAppear(): void { this.loadHomeData(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.loadHomeData(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/HomeViewModel.ets#L42-L44
0436c382b77eaba054a84e1bbce42b4edcd0c7f6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/AbilityAccessCtrl/requestPermission/index.ets
arkts
requestModel
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, soft...
export { requestModel } from './src/main/ets/components/mainpage/RequestModel'
AST#export_declaration#Left export { requestModel } from './src/main/ets/components/mainpage/RequestModel' AST#export_declaration#Right
export { requestModel } from './src/main/ets/components/mainpage/RequestModel'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/AbilityAccessCtrl/requestPermission/index.ets#L16-L16
72d5c6cd4e3703678f35b3091087fe9c416b0aa9
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_aspectRatio/entry/src/main/ets/MainAbility/pages/aspectRatio/AspectRatioHeightPage.ets
arkts
commonStyle
Set common style.
@Styles commonStyle(){ .aspectRatio(this._aspectRatio) .height(this._height) .key(this.componentKey) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right commonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _...
@Styles commonStyle(){ .aspectRatio(this._aspectRatio) .height(this._height) .key(this.componentKey) }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_aspectRatio/entry/src/main/ets/MainAbility/pages/aspectRatio/AspectRatioHeightPage.ets#L44-L49
d375cb22f53fa6f7725a3d3f4b864a49ee8e550e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyMenu.ets
arkts
KeyMenu
key键盘
@Component export struct KeyMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @Provide keyState: number = KeyState.LOWER_CASE; private keyList: keySourceListType[] = keySourceListData; private spaceWidth: Resource = this.inputStyle.spa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left AST#...
@Component export struct KeyMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @Provide keyState: number = KeyState.LOWER_CASE; private keyList: keySourceListType[] = keySourceListData; private spaceWidth: Resource = this.inputStyle.spa...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyMenu.ets#L34-L120
ea885be3f1e1bd47852e556a15b20372d24ce476
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
getCarts
读取选中的购物车项 @returns {Promise<Cart[] | null>} 购物车列表
async getCarts(): Promise<Cart[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_CARTS, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: CartJson[] = JSON.parse(value) as CartJson[]; return this.parseC...
AST#method_declaration#Left async getCarts 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#union_type#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AS...
async getCarts(): Promise<Cart[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_CARTS, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: CartJson[] = JSON.parse(value) as CartJson[]; return this.parseC...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L106-L118
cc646c4c4787a7edb184954eb8c96cee49e56200
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
All window orientation enums. @returns The GRAND list orz.
export function default_window_orientations(): window.Orientation[] { return [ window.Orientation.UNSPECIFIED, window.Orientation.PORTRAIT, window.Orientation.LANDSCAPE, window.Orientation.PORTRAIT_INVERTED, window.Orientation.LANDSCAPE_INVERTED, window.Orientation.AUTO_ROTATION, window.Or...
AST#export_declaration#Left export AST#function_declaration#Left function default_window_orientations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Orientation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Rig...
export function default_window_orientations(): window.Orientation[] { return [ window.Orientation.UNSPECIFIED, window.Orientation.PORTRAIT, window.Orientation.LANDSCAPE, window.Orientation.PORTRAIT_INVERTED, window.Orientation.LANDSCAPE_INVERTED, window.Orientation.AUTO_ROTATION, window.Or...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L175-L196
c267f123fe93953d769e86a491fb7257337cb244
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_one.ets
arkts
resourceToString
[StartExclude prefetch_post_request_on_page_end_clear_cache]
function resourceToString(resource: Resource) { return getContext().resourceManager.getStringSync(resource); }
AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return...
function resourceToString(resource: Resource) { return getContext().resourceManager.getStringSync(resource); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/PrefetchingAPOSTRequest_one.ets#L18-L20
f6206e530368d7103a1b5ca7f08123254ce28908
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildHeader
构建页面头部
@Builder buildHeader() { AppHeader({ title: `发送祝福给${this.contact?.name || ''}`, showBack: true, showAction: true, actionText: '预览', onAction: () => { this.showPreview = true; } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 AppHeader ( AST#component_parameters#Left { AST#component_para...
@Builder buildHeader() { AppHeader({ title: `发送祝福给${this.contact?.name || ''}`, showBack: true, showAction: true, actionText: '预览', onAction: () => { this.showPreview = true; } }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L210-L221
78700f810b49f171f8c8003e1dfc9f4d943ba4b2
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SettingsPage.ets
arkts
showLicenseInfo
显示开源许可信息
showLicenseInfo(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('确定', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( 'MIT License', 'MIT License\n\nCopyright (c) 2025 chen yunliang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this s...
AST#method_declaration#Left showLicenseInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left buttons :...
showLicenseInfo(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('确定', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( 'MIT License', 'MIT License\n\nCopyright (c) 2025 chen yunliang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this s...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SettingsPage.ets#L352-L361
e25d40de841e96d88a70a91c20190d5e56f251a9
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
getFlawLevelColor
获取故障等级颜色
getFlawLevelColor(level: string): string { switch (level) { case '严重': return AppConstants.COLORS.DANGER; case '一般': return AppConstants.COLORS.WARNING; case '轻微': return AppConstants.COLORS.INFO; default: return AppConstants.COLORS.TEXT_REGULAR; }
AST#method_declaration#Left getFlawLevelColor AST#parameter_list#Left ( AST#parameter#Left level : 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_typ...
getFlawLevelColor(level: string): string { switch (level) { case '严重': return AppConstants.COLORS.DANGER; case '一般': return AppConstants.COLORS.WARNING; case '轻微': return AppConstants.COLORS.INFO; default: return AppConstants.COLORS.TEXT_REGULAR; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L603-L613
c5920cc6fe6efec518747f27fcf992c8803efb45
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SimpleCalculator/entry/src/main/ets/viewmodel/PressKeysItem.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class PressKeysItem { flag: number; width: string; height: string; value: string; source?: Resource; constructor(flag: number, width: string, height: string, value: string, source?: Resource) { this.flag = flag; this.width = width; this.height = height; this.value = value; this.s...
AST#export_declaration#Left export AST#class_declaration#Left class PressKeysItem AST#class_body#Left { AST#property_declaration#Left flag : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left width : AST#t...
export class PressKeysItem { flag: number; width: string; height: string; value: string; source?: Resource; constructor(flag: number, width: string, height: string, value: string, source?: Resource) { this.flag = flag; this.width = width; this.height = height; this.value = value; this.s...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SimpleCalculator/entry/src/main/ets/viewmodel/PressKeysItem.ets#L16-L30
4a04d41064217e45bccea12755b1f522dcb4d369
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param aesKey AES密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static encodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L166-L169
ca534f87e0844c522835dea74f6c392cf2f210af
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
requestLocationPermissions
申请定位权限 @returns
static async requestLocationPermissions(): Promise<boolean> { let grant = await PermissionUtil.requestPermissions(['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION']); if (!grant) { grant = await PermissionUtil.requestPermissionOnSetting(['ohos.permission.LOCATION', 'ohos.permission.APP...
AST#method_declaration#Left static async requestLocationPermissions 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_annotat...
static async requestLocationPermissions(): Promise<boolean> { let grant = await PermissionUtil.requestPermissions(['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION']); if (!grant) { grant = await PermissionUtil.requestPermissionOnSetting(['ohos.permission.LOCATION', 'ohos.permission.APP...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L45-L51
17f15f01d2fef5f6db1067c2c3e90d85e14dd282
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets
arkts
sendAesKeyToServer
发送AES密钥到服务端
async sendAesKeyToServer() { sendProcessMessage(`AES密钥进行加密...`, MessagePosition.Right); // 对AES密钥使用公钥进行加密 let encryptedAesKey: string = await rsaEncryption(this.aesKey, this.publicKey); sendProcessMessage(`加密成功,加密结果:${encryptedAesKey},开始发送到服务端...`, MessagePosition.Right); // 将加密后的AES密钥发送到服务端 awa...
AST#method_declaration#Left async sendAesKeyToServer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left sendProcessMessage ( AST#expression#Left AST#template_literal#Left ` AES密钥进行加密... ` AST#template_literal#Right AST#expression#Right , AST#expr...
async sendAesKeyToServer() { sendProcessMessage(`AES密钥进行加密...`, MessagePosition.Right); let encryptedAesKey: string = await rsaEncryption(this.aesKey, this.publicKey); sendProcessMessage(`加密成功,加密结果:${encryptedAesKey},开始发送到服务端...`, MessagePosition.Right); await this.server.receiveKeyFromClient(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets#L103-L110
e07e73785f7d7e11ac27ead360cfaf0325146778
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
bindDecoratorInvalidate
内部帮助函数:供 AxisRender 调用,绑定刷新回调 @internal 标记为内部使用
function bindDecoratorInvalidate(decorator: BaseAxisDecorator, callback: () => void) { decoratorInvalidateMap.set(decorator, callback); }
AST#function_declaration#Left function bindDecoratorInvalidate AST#parameter_list#Left ( AST#parameter#Left decorator : AST#type_annotation#Left AST#primary_type#Left BaseAxisDecorator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#funct...
function bindDecoratorInvalidate(decorator: BaseAxisDecorator, callback: () => void) { decoratorInvalidateMap.set(decorator, callback); }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L132-L134
f7306f79602b80e18afe5d966232953ce230e109
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/slider/sliderStyle.ets
arkts
SliderStyleBuilder
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, soft...
@Builder export function SliderStyleBuilder(name: string, param: Object) { SliderStyleExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SliderStyleBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pa...
@Builder export function SliderStyleBuilder(name: string, param: Object) { SliderStyleExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/slider/sliderStyle.ets#L16-L19
227fe9b21fe444634fd9f71e86738b141a757034
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/web/WebSearchService.ets
arkts
generateMockSearchResults
生成模拟搜索结果
private generateMockSearchResults(params: GiftSearchParams): SearchResult[] { const keyword = params.keyword.toLowerCase(); const results: SearchResult[] = []; // 生日相关礼物 if (keyword.includes('生日') || keyword.includes('birthday')) { results.push( { title: '定制生日蛋糕 - 创意个性化设计', ...
AST#method_declaration#Left private generateMockSearchResults AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GiftSearchParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#...
private generateMockSearchResults(params: GiftSearchParams): SearchResult[] { const keyword = params.keyword.toLowerCase(); const results: SearchResult[] = []; if (keyword.includes('生日') || keyword.includes('birthday')) { results.push( { title: '定制生日蛋糕 - 创意个性化设计', des...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L160-L240
1a7afafc9a27be61f0dd0818f6b4cc01f388ee87
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/VirtualEconomyService.ets
arkts
spendCurrency
消费货币
async spendCurrency( currencyType: CurrencyType, amount: number, reason: string, metadata: Record<string, any> = {} ): Promise<Transaction> { try { if (!this.userWallet || amount <= 0) { throw new Error('Invalid wallet or amount'); } const currentBalance = this.getCurr...
AST#method_declaration#Left async spendCurrency AST#parameter_list#Left ( AST#parameter#Left currencyType : AST#type_annotation#Left AST#primary_type#Left CurrencyType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left amount : AST#type_annotation#Left AST#primary_type#Left number...
async spendCurrency( currencyType: CurrencyType, amount: number, reason: string, metadata: Record<string, any> = {} ): Promise<Transaction> { try { if (!this.userWallet || amount <= 0) { throw new Error('Invalid wallet or amount'); } const currentBalance = this.getCurr...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L317-L366
7ed9b7e7da9b492ad211a03d3f1ddb4fa7c30872
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
arkts
MARK: - 声音数据库访问类
export class CSoundDbAccessor { // 单例实例 private static instance: CSoundDbAccessor; // 数据库访问器 private db: DBAccessor | null = null; // 私有构造函数 private constructor() { // 创建目录(假设dMyDataFolderPath已定义) createFolderIfNeeds(dAppCloudSoundFolderPath); // 初始化数据库访问器 const sqlitePath = new CDbPath(C...
AST#export_declaration#Left export AST#class_declaration#Left class CSoundDbAccessor AST#class_body#Left { // 单例实例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left CSoundDbAccessor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // ...
export class CSoundDbAccessor { private static instance: CSoundDbAccessor; private db: DBAccessor | null = null; private constructor() { createFolderIfNeeds(dAppCloudSoundFolderPath); const sqlitePath = new CDbPath(CDBName.sounds).sqlite this.db = new DBAccessor(sqlitePath, null,...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L26-L147
eae4a160d32512861dc880516f3e15fd25b28321
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/PermissionUtil.ets
arkts
requestPermissionOnSetting
二次向用户申请授权(单个权限 或 读写权限组,建议使用该方法)。 @param permissions 需要授权的权限集合 @returns true表示授权成功继续业务操作,false表示用户拒绝授权
static async requestPermissionOnSetting(permissions: Permissions | Array<Permissions>): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; //requestPermissionOnSetting会判断权限的授权状态来决定是否唤起弹窗 ...
AST#method_declaration#Left static async requestPermissionOnSetting AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_anno...
static async requestPermissionOnSetting(permissions: Permissions | Array<Permissions>): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; let grantStatus = await atManager.requestPermi...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/PermissionUtil.ets#L101-L109
61c07b2e26e8d508775e7aa035f94a37abb259fa
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets
arkts
jumpToAppHomePage
Jump to app home page.
jumpToAppHomePage(): void { router.pushUrl({ url: CommonConstants.APP_HOME_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.ADVERTISING_PAGE_TAG, 'AdvertisingPage pushUrl error ' + JSON.stringify(error)); }); }
AST#method_declaration#Left jumpToAppHomePage 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#expres...
jumpToAppHomePage(): void { router.pushUrl({ url: CommonConstants.APP_HOME_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.ADVERTISING_PAGE_TAG, 'AdvertisingPage pushUrl error ' + JSON.stringify(error)); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets#L47-L53
79b51c02e3031be3461744c4b324ffffc4ae8449
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
initialize
初始化配置
initialize(config: LLMConfig): void { this.config = config; this.status = { configured: true, provider: config.provider, errorCount: 0 }; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `LLM service initialized with provider: ${config.provider}`); }
AST#method_declaration#Left initialize AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left LLMConfig 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#Rig...
initialize(config: LLMConfig): void { this.config = config; this.status = { configured: true, provider: config.provider, errorCount: 0 }; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `LLM service initialized with provider: ${config.provider}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L250-L258
fdf7382a796838d53f5115fcfce5ffc2e62f44e8
github
harmonyos-dev/arkui-codelabs.git
3eb8e934fb7e2caa6bf402d5736de45d7ef86f06
007-shared_styles/entry/src/main/ets/pages/Index.ets
arkts
makeItFuckingBIG
@Styles 不能有参数 See: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/arkts-style-0000001473856690-V2
@Styles function makeItFuckingBIG() { .scale({ x: 2, y: 2, z: 2, }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function makeItFuckingBIG AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left A...
@Styles function makeItFuckingBIG() { .scale({ x: 2, y: 2, z: 2, }) }
https://github.com/harmonyos-dev/arkui-codelabs.git/blob/3eb8e934fb7e2caa6bf402d5736de45d7ef86f06/007-shared_styles/entry/src/main/ets/pages/Index.ets#L47-L53
13d12c3208a1a00287d861dc11b93781d1c47f6c
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
setCircleHoleColor
Sets the color of the inner circle of the line-circles. @param color
public setCircleHoleColor(color: number): void { this.mCircleHoleColor = color; }
AST#method_declaration#Left public setCircleHoleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima...
public setCircleHoleColor(color: number): void { this.mCircleHoleColor = color; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L332-L334
b358ac7c80b702a0d6edb84b3fc7361f066dae90
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/LongClickListener.ets
arkts
长按监听器
export interface LongClickListener { /** * 长按开始回调 * @param {GestureEvent} event - 手势事件 * @param {boolean} isDisable - 是否禁用悬浮球标志 */ onAction: (event: GestureEvent, isDisable: boolean) => void; /** * 长按结束回调 * @param {GestureEvent} event - 手势事件 * @param {boolean} isDisable - 是否禁用悬浮球标志 */ on...
AST#export_declaration#Left export AST#interface_declaration#Left interface LongClickListener AST#object_type#Left { /** * 长按开始回调 * @param {GestureEvent} event - 手势事件 * @param {boolean} isDisable - 是否禁用悬浮球标志 */ AST#type_member#Left onAction : AST#type_annotation#Left AST#function_type#Left AST#parameter_lis...
export interface LongClickListener { onAction: (event: GestureEvent, isDisable: boolean) => void; onActionEnd: (event: GestureEvent, isDisable: boolean) => void; onActionCancel: (isDisable: boolean) => void; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/LongClickListener.ets#L20-L38
afb2bfb0e367420efb0d572e77b0e2ce30f5ea95
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets
arkts
定义Tab标签项的数据类型。 每个标签项包含一个未选中状态的图标 (icon)、一个选中状态的图标 (selectedIcon) 和一个标题 (title)。
export interface MyTabItem { icon: Resource selectedIcon: Resource title: ResourceStr }
AST#export_declaration#Left export AST#interface_declaration#Left interface MyTabItem AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left selectedIcon : AST#type_annotation#...
export interface MyTabItem { icon: Resource selectedIcon: Resource title: ResourceStr }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets#L69-L73
5b5deaa7a641c778174340cb7fdfb5be5205bf20
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets
arkts
loadRegion
从文件中读取省市区json数据
async loadRegion(): Promise<void> { try { // 通过getRawFileContent()获取resources/rawfile目录下对应的文件内容,得到一个字节数组 getContext(this).resourceManager.getRawFileContent(this.fileName, (error: BusinessError, value: Uint8Array) => { let rawFile = value; let textDecoder = util.TextDecoder.create('utf-8'...
AST#method_declaration#Left async loadRegion 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_argum...
async loadRegion(): Promise<void> { try { getContext(this).resourceManager.getRawFileContent(this.fileName, (error: BusinessError, value: Uint8Array) => { let rawFile = value; let textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); let retStr = textDec...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets#L153-L168
c14205bcf04169637ffb733ebe24808288221944
gitee
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
library/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.8.0';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.8.0' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.8.0';
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/library/BuildProfile.ets#L4-L4
ea3d831a3623116a75554f442dfc591c7ac6378a
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
getDeviceById
获取单个设备状态
getDeviceById(deviceId: string): DeviceStatus | undefined { return this.deviceStatus.find(device => device.id === deviceId); }
AST#method_declaration#Left getDeviceById AST#parameter_list#Left ( AST#parameter#Left deviceId : 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 Dev...
getDeviceById(deviceId: string): DeviceStatus | undefined { return this.deviceStatus.find(device => device.id === deviceId); }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L152-L154
68b3f2ebd4a54a12e5cdd3aec030a7b2a7175464
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines chipItem options. @interface ChipGroupItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipGroupItemOptions { /** * Prefix icon. * * @type { ?IconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ prefixIcon?: IconOptions; /** * Prefix symbol. * * @type { ?ChipSymbolGl...
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupItemOptions AST#object_type#Left { /** * Prefix icon. * * @type { ?IconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left ...
export interface ChipGroupItemOptions { prefixIcon?: IconOptions; prefixSymbol?: ChipSymbolGlyphOptions; label: LabelOptions; suffixIcon?: IconOptions; suffixImageIcon?: SuffixImageIconOptions; suffixSymbol?: ChipSymbolGlyphOptions; suffixSymbolOptio...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L148-L271
20ef6cd2439e22593e772367805432cfe11a2ce1
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/pages/LoginPage.ets
arkts
handleLogin
处理登录
async handleLogin(): Promise<void> { // 基本验证 if (!this.username || !this.password) { prompt.showToast({ message: '请输入用户名和密码' }); return; } try { this.isLoading = true; // 调用登录服务 await this.userService.login(this.username, this.password); prompt.showToas...
AST#method_declaration#Left async handleLogin 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_argu...
async handleLogin(): Promise<void> { if (!this.username || !this.password) { prompt.showToast({ message: '请输入用户名和密码' }); return; } try { this.isLoading = true; await this.userService.login(this.username, this.password); prompt.showToast({ mess...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/LoginPage.ets#L26-L52
adf05db4ad5209328faf17c751f9c49aec676c58
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
generateGreeting
生成个性化祝福语(非流式)
async generateGreeting(params: GreetingGenerateParams): Promise<GreetingGenerationResult> { const startTime = Date.now(); try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[GreetingGenerationService] Starting greeting generation for ${params.contact.name}`); // 转换参数格式给SimpleAIServic...
AST#method_declaration#Left async generateGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GreetingGenerateParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
async generateGreeting(params: GreetingGenerateParams): Promise<GreetingGenerationResult> { const startTime = Date.now(); try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[GreetingGenerationService] Starting greeting generation for ${params.contact.name}`); const aiParams: G...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L75-L129
6fc2b784a40c8260ee0e993a5ef2cdc6245f66ce
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/CharUtil.ets
arkts
@Author csx @DateTime 2023/12/29 21:04 @TODO CharUtil 字符工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core
export class CharUtil { /** * 是否空白符 空白符包括空格、制表符、全角空格和不间断空格 * @param c * @returns */ static isBlankChar(c: number): boolean { return CharUtil.isWhitespace(c) || CharUtil.isSpaceChar(c) || c == 0xFEFF || c == 0x202A || c == 0x0000; } /** * 检查字符是否位于ASCII范围内(0~127) * @param c...
AST#export_declaration#Left export AST#class_declaration#Left class CharUtil AST#class_body#Left { /** * 是否空白符 空白符包括空格、制表符、全角空格和不间断空格 * @param c * @returns */ AST#method_declaration#Left static isBlankChar AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left number...
export class CharUtil { static isBlankChar(c: number): boolean { return CharUtil.isWhitespace(c) || CharUtil.isSpaceChar(c) || c == 0xFEFF || c == 0x202A || c == 0x0000; } static isAscii(ch: string): boolean { if (ch.length !== 1) throw new Error("Input must be a single charac...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/CharUtil.ets#L23-L98
8a47e9a3d71a6482c02c36faae32f19241d9369b
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/fenlei.ets
arkts
TabBuilder
自定义导航页签的样式
@Builder TabBuilder(title: string, targetIndex: number) { Column({space:10}) { Row() { // 标签图片 Image(this.currentIndex === targetIndex ? $r('app.media.img_38') : $r('app.media.img_37')) .width(10) .height(40) //.margin({left:0, right: 10 }) Text(title) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_annotation#L...
@Builder TabBuilder(title: string, targetIndex: number) { Column({space:10}) { Row() { Image(this.currentIndex === targetIndex ? $r('app.media.img_38') : $r('app.media.img_37')) .width(10) .height(40) Text(title) .fontSize(this.currentIndex ===ta...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/fenlei.ets#L1443-L1464
7a02b4c02262bed97ec2cb57721dacba0826918f
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhAlert.ets
arkts
showDialog
中间弹框,黑色按钮文字 @param options
public static showDialog(options: JhAlertOptions) { DialogUtil.showDialog({ title: options.title, message: options.message ?? '', buttons: [ { value: options.leftText ?? _cancelText, fontColor: Color.Black, action: () => { options.onCancel?.() ...
AST#method_declaration#Left public static showDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhAlertOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statem...
public static showDialog(options: JhAlertOptions) { DialogUtil.showDialog({ title: options.title, message: options.message ?? '', buttons: [ { value: options.leftText ?? _cancelText, fontColor: Color.Black, action: () => { options.onCancel?.() ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L129-L150
2024a8c85265f5f2bce7a03bf902873899ded55b
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/origin/Origin.ets
arkts
getContext
获取context对象 @returns
abstract getContext(): Context
AST#method_declaration#Left abstract getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#method_declaration#Right
abstract getContext(): Context
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/origin/Origin.ets#L13-L13
4ea9cc82756e7c24a75a36e5ad40c8818ae6afe0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringPyHelper.ets
arkts
isAlphabet
/ 检测是否为字母
static isAlphabet(str: string): boolean { return Array.from(str).every(c => /[a-zA-Z]/.test(c)); }
AST#method_declaration#Left static isAlphabet AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type...
static isAlphabet(str: string): boolean { return Array.from(str).every(c => /[a-zA-Z]/.test(c)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringPyHelper.ets#L23-L25
6efab6b3a62b7f6c9222601e9087bddfb1689d87
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
getTopAvoidAreaHeightPx
获取顶部安全区域高度 @returns
public getTopAvoidAreaHeightPx(): number { return WindowUtils.topAvoidAreaHeight_px }
AST#method_declaration#Left public getTopAvoidAreaHeightPx 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#...
public getTopAvoidAreaHeightPx(): number { return WindowUtils.topAvoidAreaHeight_px }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L203-L205
1de42487a61bde8004150cdda84226bfce0da199
gitee
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSettingListData
获取设置页数据资源
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_data'), $r("app.media.data"), null), new ItemData($r('app.string.setting_lis...
AST#method_declaration#Left getSettingListData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_data'), $r("app.media.data"), null), new ItemData($r('app.string.setting_lis...
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/viewmodel/MainViewModel.ets#L55-L65
2b9e875797d6e0ceb9b82e540bb6dcaed3ee2527
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets
arkts
updateTaskStatus
更新任务状态
async updateTaskStatus(taskId: number, status: number) { try { await ApiService.updateTaskStatus(taskId, status); // 刷新数据 this.refreshData(); } catch (error) { console.error('更新任务状态失败', error); // 本地更新UI(乐观更新) const taskIndex = this.todayTasks.findIndex(task => task.id === ta...
AST#method_declaration#Left async updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
async updateTaskStatus(taskId: number, status: number) { try { await ApiService.updateTaskStatus(taskId, status); this.refreshData(); } catch (error) { console.error('更新任务状态失败', error); const taskIndex = this.todayTasks.findIndex(task => task.id === taskId); if (taskI...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets#L345-L358
f835e3b4d4efde7f77dfb0c4ad7a716259962b0c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/report/RadarView.ets
arkts
onDataChange
========== 生命周期和监控 ==========
@Monitor('parts', 'guideLineCount', 'showPercentText') onDataChange() { if (this.isCanvasReady) { this.drawCanvas(); } }
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'parts' AST#expression#Right , AST#expression#Left 'guideLineCount' AST#expression#Right , AST#expression#Left 'showPercentText' AST#expression#Right ) AST#decorator#Right onDataChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST...
@Monitor('parts', 'guideLineCount', 'showPercentText') onDataChange() { if (this.isCanvasReady) { this.drawCanvas(); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L29-L34
f04e77e80b7fc37ffd77edb10e98d9c2348a6e0c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/GlobalContext.ets
arkts
单例对象 GlobalContext.ts
export class GlobalContext { private constructor() {} private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instan...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() {} private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instan...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/GlobalContext.ets#L17-L80
70cf2fc3bd5af60c17da7b3e3db961c591e19f23
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
serial
设备序列号
static serial(): string { return deviceInfo.serial }
AST#method_declaration#Left static serial AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression...
static serial(): string { return deviceInfo.serial }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L85-L87
4876a3c6ed495939b9a8a6c29f01a450686a5df1
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.MultiNavigation.d.ets
arkts
MultiNavigation
Declaration struct MultiNavigation. @struct { MultiNavigation } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 14
@Component export declare struct MultiNavigation { /** * MultiNavigation path stack of the MultiNavigation. * * @type { MultiNavPathStack } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ @State multiStack: MultiNavPathStack; /** * build f...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct MultiNavigation AST#component_body#Left { /** * MultiNavigation path stack of the MultiNavigation. * * @type { MultiNavPathStack } * @syscap SystemCapability.ArkUI.Ar...
@Component export declare struct MultiNavigation { @State multiStack: MultiNavPathStack; @BuilderParam navDestination: NavDestinationBuildFunction; onNavigationModeChange?: OnNavigationModeChangeCallback; onHomeShowOnTop?: OnHomeShowOnTopCallback; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.MultiNavigation.d.ets#L73-L120
3884433f7aba2cced354f61350979b6ed942b19a
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/Utils.ets
arkts
generateId
Generate a unique ID @returns Unique ID string
static generateId(): string { return Date.now().toString(36) + Math.random().toString(36).substr(2); }
AST#method_declaration#Left static generateId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressi...
static generateId(): string { return Date.now().toString(36) + Math.random().toString(36).substr(2); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Utils.ets#L72-L74
338e322063e05c5f4f0b70908a56d2a66fab652d
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/dialog/CommonTimeDialog.ets
arkts
CommonTimeDialog
Icon+Text自定义弹窗
@CustomDialog export struct CommonTimeDialog { controller?: CustomDialogController @State currentDate:string='' @State config: DateTimePickerConfig = { format: DateTimeFormat.Hm, start: '00:00', end: '23:59', selected: (this.currentDate=='')?DateUtil.getTodayStr('HH:mm'):this.currentDate } @St...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonTimeDialog AST#component_body#Left { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#pr...
@CustomDialog export struct CommonTimeDialog { controller?: CustomDialogController @State currentDate:string='' @State config: DateTimePickerConfig = { format: DateTimeFormat.Hm, start: '00:00', end: '23:59', selected: (this.currentDate=='')?DateUtil.getTodayStr('HH:mm'):this.currentDate } @St...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/CommonTimeDialog.ets#L13-L116
dc1aa2bfe5b3a75277f628f2306472997119680e
github