nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
showConfirmDialog
显示弹框(一个按钮的) @param options
static showConfirmDialog(options: ConfirmDialogOptions) { DialogUtils.initDialogDefault(options); DialogUtils.initConfirmButton(options); AlertDialog.show(options as AlertDialogParamWithConfirm); }
AST#method_declaration#Left static showConfirmDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_...
static showConfirmDialog(options: ConfirmDialogOptions) { DialogUtils.initDialogDefault(options); DialogUtils.initConfirmButton(options); AlertDialog.show(options as AlertDialogParamWithConfirm); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L50-L54
572cfbb351789128a57724eb0f4f9f4906554369
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福状态枚举
export enum GreetingStatus { DRAFT = 'draft', // 草稿 SENT = 'sent', // 已发送 DELIVERED = 'delivered', // 已送达 READ = 'read', // 已读 FAILED = 'failed' // 发送失败 }
AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingStatus AST#enum_body#Left { AST#enum_member#Left DRAFT = AST#expression#Left 'draft' AST#expression#Right AST#enum_member#Right , // 草稿 AST#enum_member#Left SENT = AST#expression#Left 'sent' AST#expression#Right AST#enum_member#Right , // 已发送 AST...
export enum GreetingStatus { DRAFT = 'draft', SENT = 'sent', DELIVERED = 'delivered', READ = 'read', FAILED = 'failed' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L183-L189
a3c861170fda28c4c57879084c64d1cfd4d6fe1e
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
removeFromQueue
从待听队列移除
async removeFromQueue(episode: Episode) { try { await this.dbService.removeFromQueue(episode.id); await this.loadQueue(); console.info(`[MainPage] Removed from queue: ${episode.title}`); } catch (error) { console.error('[MainPage] Failed to remove from queue:', error); } }
AST#method_declaration#Left async removeFromQueue AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#...
async removeFromQueue(episode: Episode) { try { await this.dbService.removeFromQueue(episode.id); await this.loadQueue(); console.info(`[MainPage] Removed from queue: ${episode.title}`); } catch (error) { console.error('[MainPage] Failed to remove from queue:', error); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L321-L329
c720c2f82498cbe09200931f62c1235071485bef
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
downloadCsvTemplate
私有方法 下载CSV模板
private downloadCsvTemplate() { const template = CsvParser.generateCsvTemplate(); this.csvContent = template; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'CSV template generated'); }
AST#method_declaration#Left private downloadCsvTemplate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left template = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Le...
private downloadCsvTemplate() { const template = CsvParser.generateCsvTemplate(); this.csvContent = template; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'CSV template generated'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L792-L796
16442b21d2ddcfc7f08a9f1adac84ef462310eed
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
StandardScale2
一个标准缩放的刻度占用像素
@ObservedV2 export class StandardScale2 { // 单位 @Trace unit: number = 1; // 单位占用像素 @Trace pixel: number = 12; }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class StandardScale2 AST#class_body#Left { // 单位 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right unit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_anno...
@ObservedV2 export class StandardScale2 { @Trace unit: number = 1; 占用像素 @Trace pixel: number = 12; }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L102-L108
10e5901fcd531e3c876530588df3f21ca67890c8
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.utils.d.ets
arkts
waitFor
Waits for the ConditionVariable to be notified, or until the specified time limit is reached. @param { number } timeout - The maximum time to wait. @returns { Promise<void> } A promise that will be resolved once the ConditionVariable is notified or the specified time limit is reached. @syscap SystemCapability.Utils.La...
waitFor(timeout: number): Promise<void>;
AST#method_declaration#Left waitFor AST#parameter_list#Left ( AST#parameter#Left timeout : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise ...
waitFor(timeout: number): Promise<void>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L683-L683
68c019df9a87cb6fb3425bcf69dc3f28f89dd88a
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/bigfolder/component.ets
arkts
FolderOpenComponent
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { FolderOpenComponent } from './src/main/ets/default/view/FolderOpenComponent';
AST#export_declaration#Left export { FolderOpenComponent } from './src/main/ets/default/view/FolderOpenComponent' ; AST#export_declaration#Right
export { FolderOpenComponent } from './src/main/ets/default/view/FolderOpenComponent';
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/bigfolder/component.ets#L16-L16
348731681966119dbbcf64596a09d690035e3c53
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
saveConversations
保存会话列表
private async saveConversations(): Promise<void> { try { await StorageManager.setString(this.CONVERSATIONS_KEY, JSON.stringify(this.conversations)); } catch (error) { Logger.error('IMManager', `Failed to save conversations: ${String(error)}`); } }
AST#method_declaration#Left private async saveConversations 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 >...
private async saveConversations(): Promise<void> { try { await StorageManager.setString(this.CONVERSATIONS_KEY, JSON.stringify(this.conversations)); } catch (error) { Logger.error('IMManager', `Failed to save conversations: ${String(error)}`); } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L61-L67
5297abff00c19936fb7f52b779fd46fda97eb6a0
github
xixi-cquer/BiJiDaiBan.git
206dc33a837acbe6fc837feff848427e83946534
entry/src/main/ets/common/constants/Constants.ets
arkts
The request content type enum.
export const enum ContentType { JSON = 'application/json', FORM = 'multipart/form-data' }
AST#export_declaration#Left export AST#enum_declaration#Left const enum ContentType AST#enum_body#Left { AST#enum_member#Left JSON = AST#expression#Left 'application/json' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left FORM = AST#expression#Left 'multipart/form-data' AST#expression#Right AST#enum_mem...
export const enum ContentType { JSON = 'application/json', FORM = 'multipart/form-data' }
https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/common/constants/Constants.ets#L204-L207
2166d235f1d2688eda179a07fbcb27714bdc2cec
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/Logger.ets
arkts
warn
记录警告级别的日志。 @param args 要记录的日志信息
warn(...args: string[]): void { hilog.warn(this.domain, this.prefix, this.format, args); }
AST#method_declaration#Left warn AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima...
warn(...args: string[]): void { hilog.warn(this.domain, this.prefix, this.format, args); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L42-L44
93dce36c6b2c3bf05381621e9e6ea278e73785d0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
提醒设置接口
export interface ReminderSettings { enabled: boolean; advanceDays: number[]; frequency: ReminderFrequency; customTime: string; weekendReminder: boolean; lunarBirthdayReminder: boolean; birthdayReminder: BirthdayReminderConfig; anniversaryReminder: AnniversaryReminderConfig; repeatReminder: RepeatRemin...
AST#export_declaration#Left export AST#interface_declaration#Left interface ReminderSettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left advanceDays : AST#type_a...
export interface ReminderSettings { enabled: boolean; advanceDays: number[]; frequency: ReminderFrequency; customTime: string; weekendReminder: boolean; lunarBirthdayReminder: boolean; birthdayReminder: BirthdayReminderConfig; anniversaryReminder: AnniversaryReminderConfig; repeatReminder: RepeatRemin...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L343-L353
0eebd533527940c5eae0dcfccacd71dfeb605aa1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/watermark/src/main/ets/common/CommonConstants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class CommonConstants { // 默认水印内容1 static readonly TEXT_CONTENT1: string = '水印水印'; // 默认水印字体大小1 static readonly FONT_SIZE1: string = '16vp'; // 默认水印字体颜色1 static readonly FONT_COLOR1: string = '#10000000'; // 默认水印内容2 static readonly TEXT_CONTENT2: string = '追逐繁星的太阳'; // 默认水印字体大小1 static readon...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 默认水印内容1 AST#property_declaration#Left static readonly TEXT_CONTENT1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '水印水印' AST#expre...
export class CommonConstants { static readonly TEXT_CONTENT1: string = '水印水印'; static readonly FONT_SIZE1: string = '16vp'; static readonly FONT_COLOR1: string = '#10000000'; static readonly TEXT_CONTENT2: string = '追逐繁星的太阳'; static readonly FONT_SIZE2: string = '32vp'; static readonly FON...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/common/CommonConstants.ets#L16-L39
8e75dc59f1ae1c73221b339e04791af47ec17a63
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getColor
获取指定资源对应的颜色值(十进制) @param resId 资源ID值/资源信息 @returns
static async getColor(resId: number | Resource): Promise<number> { if (typeof resId === 'number') { return ResUtil.getResourceManager().getColor(resId); } else { return ResUtil.getResourceManager().getColor(resId); } }
AST#method_declaration#Left static async getColor AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Rig...
static async getColor(resId: number | Resource): Promise<number> { if (typeof resId === 'number') { return ResUtil.getResourceManager().getColor(resId); } else { return ResUtil.getResourceManager().getColor(resId); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L250-L256
8eedf5ac69c457195b4227ec0b73fc06ae860842
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
搜索条件接口
export interface SearchCondition { keyword?: string; category?: string; startDate?: Date; endDate?: Date; filters?: Record<string, Object>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SearchCondition AST#object_type#Left { AST#type_member#Left keyword ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left category ? : AST#type_an...
export interface SearchCondition { keyword?: string; category?: string; startDate?: Date; endDate?: Date; filters?: Record<string, Object>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L145-L151
bdcc5712d1e633483d04f27fb3799e53e22ea8f9
github
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/model.ets
arkts
getPriorityColor
根据优先级,获得渲染颜色
getPriorityColor(priority:number): Color { switch (priority) { case 1: return Color.Pink; case 2: return Color.Blue; case 3: return Color.Brown; default: return Color.White; }
AST#method_declaration#Left getPriorityColor AST#parameter_list#Left ( AST#parameter#Left priority : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_ty...
getPriorityColor(priority:number): Color { switch (priority) { case 1: return Color.Pink; case 2: return Color.Blue; case 3: return Color.Brown; default: return Color.White; }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/model.ets#L74-L84
f3b2bd66fd7ef04fc10b6c9862ce97e106b0b301
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
video resource type
export const enum VIDEO_TYPE { INNER = 'inner', NET = 'net' }
AST#export_declaration#Left export AST#enum_declaration#Left const enum VIDEO_TYPE AST#enum_body#Left { AST#enum_member#Left INNER = AST#expression#Left 'inner' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NET = AST#expression#Left 'net' AST#expression#Right AST#enum_member#Right } AST#enum_body#Ri...
export const enum VIDEO_TYPE { INNER = 'inner', NET = 'net' }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L129-L132
4b19bd0c665a92e79b2110cf20f80605a3c46394
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/VibratorUtil.ets
arkts
开启震动
export function StartVibrator() { if (deviceInfo.deviceType === 'phone') { // 使用try catch对可能出现的异常进行捕获 try { // HapticFeedback 12+ // 'haptic.effect.soft',较松散的振动效果,频率偏低。 // 'haptic.effect.hard' 较沉重的振动效果,频率居中。 // 'haptic.effect.sharp' 较尖锐的振动效果,频率偏高。 // 体验下来 hard 震动过强,soft 震动过弱,shar...
AST#export_declaration#Left export AST#function_declaration#Left function StartVibrator AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
export function StartVibrator() { if (deviceInfo.deviceType === 'phone') { try { vibrator.isSupportEffect('haptic.effect.sharp', (err: BusinessError, state: boolean) => { if (err) { console.error(`Failed to query effect. Code: ${err.code}, mes...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/VibratorUtil.ets#L5-L48
02ae0b6e11b0f242b448467a5dad13e9e7a7e4cc
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
setThemeType
设置主题类型
async setThemeType(type: ThemeType): Promise<void> { try { if (this.currentTheme) { const oldType = this.currentTheme.type; this.currentTheme.type = type; // 根据类型选择对应的颜色主题 const colorTheme = this.getColorThemeByType(type); if (colorTheme) { this.curre...
AST#method_declaration#Left async setThemeType AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ThemeType 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...
async setThemeType(type: ThemeType): Promise<void> { try { if (this.currentTheme) { const oldType = this.currentTheme.type; this.currentTheme.type = type; const colorTheme = this.getColorThemeByType(type); if (colorTheme) { this.currentTheme.colorThe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L211-L238
7e7de050163d82917c98e0c79a828c84c5891ffd
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/special_expression/spread_operator_002_F.ets
arkts
Introduction 扩展运算符
export function spread_operator_002_F(taint_src : string) { let _t = taint_src; let array1 = ['a', 'b', "_"]; let array = ['c', ...array1]; taint.Sink(array[3]); }
AST#export_declaration#Left export AST#function_declaration#Left function spread_operator_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function spread_operator_002_F(taint_src : string) { let _t = taint_src; let array1 = ['a', 'b', "_"]; let array = ['c', ...array1]; taint.Sink(array[3]); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/spread_operator_002_F.ets#L6-L11
bce029408df67d4edbec825710d9dffd67768707
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/ExamReportBuilder.ets
arkts
自定义参数类型
export class reportParams { exam: VHExamRank; webinar: VHWebinarData; constructor(id: VHExamRank, webinar: VHWebinarData) { this.exam = id; this.webinar = webinar; } }
AST#export_declaration#Left export AST#class_declaration#Left class reportParams AST#class_body#Left { AST#property_declaration#Left exam : AST#type_annotation#Left AST#primary_type#Left VHExamRank AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left webinar : ...
export class reportParams { exam: VHExamRank; webinar: VHWebinarData; constructor(id: VHExamRank, webinar: VHWebinarData) { this.exam = id; this.webinar = webinar; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/ExamReportBuilder.ets#L25-L33
136329e5d9ce8997295c91617855ef3f4afcb978
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
arkts
保存pixelMap,返回路径 @param pm @returns
export async function savePixelMap(context: Context, pm: PixelMap): Promise<string> { if (pm === null) { logger.error(TAG, '传入的pm为空'); return ''; } const imagePackerApi: image.ImagePacker = image.createImagePacker(); let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 30 }; try { ...
AST#export_declaration#Left export AST#function_declaration#Left async function savePixelMap AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pm : AST#type_annotation#Le...
export async function savePixelMap(context: Context, pm: PixelMap): Promise<string> { if (pm === null) { logger.error(TAG, '传入的pm为空'); return ''; } const imagePackerApi: image.ImagePacker = image.createImagePacker(); let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 30 }; try { ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets#L26-L40
a88c03ff6834a4a76cc557c5593e3ec9b15fd2e3
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnEnd
纵向末尾 + 水平末尾
@ComponentV2 export struct ColumnEnd { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnEnd 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#primary_type#Lef...
@ComponentV2 export struct ColumnEnd { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | Len...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L305-L380
42e921b58960f5501a0d9abbe88b3533c5ad66d2
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/efLoading.ets
arkts
图片文字布局枚举
export enum ImgLayout { /** * 图片在文字上方 */ TOP, /** * 图片在文字下方 */ BOTTOM, /** * 图片在文字左侧 */ LEFT, /** * 图片在文字右侧 */ RIGHT }
AST#export_declaration#Left export AST#enum_declaration#Left enum ImgLayout AST#enum_body#Left { /** * 图片在文字上方 */ AST#enum_member#Left TOP AST#enum_member#Right , /** * 图片在文字下方 */ AST#enum_member#Left BOTTOM AST#enum_member#Right , /** * 图片在文字左侧 */ AST#enum_member#Left LEFT AST#enum_member#Right , /**...
export enum ImgLayout { TOP, BOTTOM, LEFT, RIGHT }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/efLoading.ets#L217-L234
22304ff0c18d99ae0f6ab9fb4d8d5df5ea18effb
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/ArrayStringUtils.ets
arkts
containsWords
判断是否含有词语
static containsWords(arr: string[]): boolean { return arr.filter(item => item.trim().length > 1).length > 0; }
AST#method_declaration#Left static containsWords AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
static containsWords(arr: string[]): boolean { return arr.filter(item => item.trim().length > 1).length > 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L26-L28
71a89187db4f40bae215cfbabb0ef1a0602fa381
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
分享结果接口
export interface ShareResult { success: boolean; platform: SharePlatform; message: string; sharedAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShareResult AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left platform : AST#type_annotatio...
export interface ShareResult { success: boolean; platform: SharePlatform; message: string; sharedAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L57-L62
87252fb2ba513aa93eb61f38d5e6418153d82599
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
getDisplay
获取手机物理逻辑密度 @returns {Promise<number>}
async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; }
AST#method_declaration#Left async getDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets#L147-L151
fcc7a5b893a95036bcb5a9c1d3c72683f4747aed
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showWarn
Outputs warning-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showWarn(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.WARN)) { hilog.warn(DOMAIN, TAG, tag + SYMBOL + format, args); } }
AST#method_declaration#Left static showWarn AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
static showWarn(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.WARN)) { hilog.warn(DOMAIN, TAG, tag + SYMBOL + format, args); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L50-L54
35cc09146f6b628ce714e5fea73306b548f0326e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
handleBackClick
处理系统返回按钮点击 @returns {void} 无返回值
handleBackClick(): void { this.handleBackAfterPayment(false); }
AST#method_declaration#Left handleBackClick 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#expressi...
handleBackClick(): void { this.handleBackAfterPayment(false); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L117-L119
2526314cf6eeb72bc10e42c3403623eb20d57cfc
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
统计数据接口
export interface Statistics { totalContacts: number; todayBirthdays: number; weekBirthdays: number; monthBirthdays: number; upcomingBirthdays: number; totalAnniversaries: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Statistics AST#object_type#Left { AST#type_member#Left totalContacts : 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 todayBirthdays : AST#type...
export interface Statistics { totalContacts: number; todayBirthdays: number; weekBirthdays: number; monthBirthdays: number; upcomingBirthdays: number; totalAnniversaries: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L154-L161
404360627630114a7f1ab3f5b05f39d8862b8692
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PermissionUtil.ets
arkts
checkRequestPermissions
校验是否授权后并申请授权。 @param permissions 需要授权的权限 @returns true表示授权成功继续业务操作,false表示用户拒绝授权
static async checkRequestPermissions(permissions: Permissions): Promise<boolean> { let checkStatus = await PermissionUtil.checkPermissions(permissions); if (checkStatus) { return checkStatus; } else { return PermissionUtil.requestPermissions(permissions); } }
AST#method_declaration#Left static async checkRequestPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_ty...
static async checkRequestPermissions(permissions: Permissions): Promise<boolean> { let checkStatus = await PermissionUtil.checkPermissions(permissions); if (checkStatus) { return checkStatus; } else { return PermissionUtil.requestPermissions(permissions); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L51-L58
06dad4fa66ecc039fae3192ed2b8c6b8b647fa46
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
arkts
clearAppCacheEasy
清除应用缓存 文件下载目录: 下载路径 /data/storage/el2/base/haps/entry/files 下载路径 /data/storage/el2/base/haps/entry/temp 应用的缓存文件保存在以下目录: 缓存路径 /data/storage/el2/base/cache 缓存路径 /data/storage/el2/base/haps/entry/cache 缓存路径 /data/storage/el1/base/cache 缓存路径 /data/storage/el1/base/haps/entry/cache
async clearAppCacheEasy() { try { const cacheDirs: Array<string> = []; const fileDir = FileUtils.getFilesDirPath(); cacheDirs.push(fileDir); const tempDir = FileUtils.getTempDirPath(); cacheDirs.push(tempDir); const fileDir2 = FileUtils.getFilesDirPath(undefined, undefined, false...
AST#method_declaration#Left async clearAppCacheEasy 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#variable_declaration#Left const AST#variable_declarator#Left cacheDirs : AST#type_annotation...
async clearAppCacheEasy() { try { const cacheDirs: Array<string> = []; const fileDir = FileUtils.getFilesDirPath(); cacheDirs.push(fileDir); const tempDir = FileUtils.getTempDirPath(); cacheDirs.push(tempDir); const fileDir2 = FileUtils.getFilesDirPath(undefined, undefined, false...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L123-L152
b8b0425134fb6f2a3b4234af9e6b58b43e96fea0
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
download
统一的下载请求 @param efClientParams 下载入参实体 @param progressCallBack 下载进度回调方法 @returns
async download(efClientParams: efClientParams<null>, progressCallBack: (process: number) => void): Promise<Object> { try { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } //获取上下文 le...
AST#method_declaration#Left async download AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left efClientParams AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right > AS...
async download(efClientParams: efClientParams<null>, progressCallBack: (process: number) => void): Promise<Object> { try { if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let context = getContext(this) as common.UIAbilityContext; ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L400-L468
7799fd777e9d8290981eb1525bf4ae31dc155db5
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_synchronous.ets
arkts
decryptMessage
解密消息
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c...
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_synchronous.ets#L46-L51
70927b32157967cca73c9492ddcab2bf69c6cda1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/SpinType.ets
arkts
TODO Spin类型 author: 桃花镇童长老 since: 2024/05/01
export enum SpinType { spinA, spinB, spinC, spinD, spinE, spinF, spinG, spinH, spinI, spinJ, spinK, spinL, spinM, spinN, spinO, spinP, spinQ, spinR, spinS, spinT, spinU, spinV, spinW, spinX, spinY, spinZ, progress, //环形进度条样式 loadingProgress, //加载动效 loading, //三维...
AST#export_declaration#Left export AST#enum_declaration#Left enum SpinType AST#enum_body#Left { AST#enum_member#Left spinA AST#enum_member#Right , AST#enum_member#Left spinB AST#enum_member#Right , AST#enum_member#Left spinC AST#enum_member#Right , AST#enum_member#Left spinD AST#enum_member#Right , AST#enum_member#Left...
export enum SpinType { spinA, spinB, spinC, spinD, spinE, spinF, spinG, spinH, spinI, spinJ, spinK, spinL, spinM, spinN, spinO, spinP, spinQ, spinR, spinS, spinT, spinU, spinV, spinW, spinX, spinY, spinZ, progress, loadingProgress, loading, }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/SpinType.ets#L22-L52
96cce50b73bc3748255b73b1ffc790e72695f50d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListExchangeCtrl.ets
arkts
onLongPress
ListItem长按函数 @param item
onLongPress(item: T): void { const index: number = this.deductionData.indexOf(item); this.dragRefOffset = 0; // TODO:知识点:长按当前列表项透明度和放大动画 animateTo({ curve: Curve.Friction, duration: CommonConstants.ANIMATE_DURATION }, () => { this.state = OperationStatus.PRESSING; this.modifier[index].hasSha...
AST#method_declaration#Left onLongPress 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#ty...
onLongPress(item: T): void { const index: number = this.deductionData.indexOf(item); this.dragRefOffset = 0; animateTo({ curve: Curve.Friction, duration: CommonConstants.ANIMATE_DURATION }, () => { this.state = OperationStatus.PRESSING; this.modifier[index].hasShadow = true; this.modi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListExchangeCtrl.ets#L64-L73
f5d049d26af83d46df614373c4911be652de7ecd
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/higher_order_function/higher_order_function_005_T.ets
arkts
Introduction 高阶函数-箭头函数作参数
export function higher_order_function_005_T(taint_src : string) { let arrowf5 = (a: string, b: string) => a + b ; let t = higherOrderFunction(arrowf5, taint_src, "a"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function higher_order_function_005_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_s...
export function higher_order_function_005_T(taint_src : string) { let arrowf5 = (a: string, b: string) => a + b ; let t = higherOrderFunction(arrowf5, taint_src, "a"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/higher_order_function/higher_order_function_005_T.ets#L6-L10
c1ce432926320cf0d58672d46c45d7e07e83ae87
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/AccountData.ets
arkts
deleteAccount
删除账户
static async deleteAccount(id: string): Promise<boolean> { try { if (!AccountDataManager.preferencesStore) { return false; } const accounts = await AccountDataManager.getAllAccounts(); const newAccounts = accounts.filter(account => account.id !== id); await AccountDataM...
AST#method_declaration#Left static async deleteAccount AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async deleteAccount(id: string): Promise<boolean> { try { if (!AccountDataManager.preferencesStore) { return false; } const accounts = await AccountDataManager.getAllAccounts(); const newAccounts = accounts.filter(account => account.id !== id); await AccountDataM...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L84-L101
1fb3bed9124cb93f8005b08107f56f49f1477695
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemoveAll.ets
arkts
应用约束61:使用export default代替module.exports
export default MessageReactionRemoveAll;
AST#export_declaration#Left export default AST#expression#Left MessageReactionRemoveAll AST#expression#Right ; AST#export_declaration#Right
export default MessageReactionRemoveAll;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemoveAll.ets#L18-L18
476aba528223678928da9294473ebdacea31dee1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
渲染布局 @returns {void} 无返回值 @example ColumnCenterStart() { Text("Hi"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.Center, alignItems: HorizontalAlign.Start, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.Center, alignItems: HorizontalAlign.Start, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L684-L699
9d51ee6620bc4e0f19c2e028cb2e9364fbaf3053
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/GiftComponent.ets
arkts
closePopup
关闭弹窗
private closePopup() { this.selectedGiftId = '-1' PromptActionClass.closeDialog(); }
AST#method_declaration#Left private closePopup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGiftId AST#member_expre...
private closePopup() { this.selectedGiftId = '-1' PromptActionClass.closeDialog(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/GiftComponent.ets#L111-L114
8100310b3a98d0a82cd255434bfb5aa887bf1084
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
代办事项类型枚举
export enum TodoType { PERSONAL = 'personal', // 个人 WORK = 'work', // 工作 BIRTHDAY = 'birthday', // 生日相关 HOLIDAY = 'holiday', // 节日相关 ANNIVERSARY = 'anniversary', // 纪念日相关 OTHER = 'other' // 其他 }
AST#export_declaration#Left export AST#enum_declaration#Left enum TodoType AST#enum_body#Left { AST#enum_member#Left PERSONAL = AST#expression#Left 'personal' AST#expression#Right AST#enum_member#Right , // 个人 AST#enum_member#Left WORK = AST#expression#Left 'work' AST#expression#Right AST#enum_member#Right , // 工作 AST#...
export enum TodoType { PERSONAL = 'personal', WORK = 'work', BIRTHDAY = 'birthday', HOLIDAY = 'holiday', ANNIVERSARY = 'anniversary', OTHER = 'other' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L22-L29
44a3a36ae8953f747a43f2eeb2ee60a473bfa9b8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/Contact.ets
arkts
通讯录列表以组为单位字段信息
export interface CategoryContact { category: string; itemsContact: Array<Contact>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CategoryContact AST#object_type#Left { AST#type_member#Left category : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left itemsContact : AST#type_a...
export interface CategoryContact { category: string; itemsContact: Array<Contact>; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/Contact.ets#L45-L48
4b669802ebc2ec3b0eecb377696af25073fc5bea
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
compressImage
压缩图片
async compressImage(imagePath: string, quality: number = 80): Promise<string> { return await this.processImage(imagePath, { quality, format: 'jpeg' }); }
AST#method_declaration#Left async compressImage AST#parameter_list#Left ( AST#parameter#Left imagePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left quality : AST#type_annotation#Left AST#primary_type#Left number AST#pri...
async compressImage(imagePath: string, quality: number = 80): Promise<string> { return await this.processImage(imagePath, { quality, format: 'jpeg' }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L591-L596
71d7270ebd06f9a53a175c87ac97cbbd19031771
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
cloneBatch
批量克隆消息 @param messages 消息数组 @returns 克隆后的消息数组 使用示例: ```typescript const people = [person1, person2, person3] const clonedPeople = MessageUtils.cloneBatch(people) ```
static cloneBatch<T extends Message>(messages: T[]): T[] { return messages.map(m => m.clone() as T) }
AST#method_declaration#Left static cloneBatch AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : ...
static cloneBatch<T extends Message>(messages: T[]): T[] { return messages.map(m => m.clone() as T) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L73-L75
cd08466cc8b26f3c29785c428c0bad4ed4eec8a7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
hasDirPath
判断是否是完整路径 @param path 文件路径 沙箱路径 /data/storage/ 应用安装路径 /data/app/ 系统路径 /system/ 挂载路径 /mnt/ Download /storage/Users/currentUser/Download/ file://协议 file:///data/storage/el2/base/haps/entry/files/test.txt
static hasDirPath(path: string): boolean { if (StrUtil.isBlank(path)) { return false; } const blFull = StrUtil.startsWith(path, "/data/") || StrUtil.startsWith(path, "/system/") || StrUtil.startsWith(path, "/mnt/") || StrUtil.startsWith(path, "file://") || StrUtil.startsWith(path, "/storag...
AST#method_declaration#Left static hasDirPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
static hasDirPath(path: string): boolean { if (StrUtil.isBlank(path)) { return false; } const blFull = StrUtil.startsWith(path, "/data/") || StrUtil.startsWith(path, "/system/") || StrUtil.startsWith(path, "/mnt/") || StrUtil.startsWith(path, "file://") || StrUtil.startsWith(path, "/storag...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L172-L180
6e626ba5d1e28b932f70da33852c536a1bd7e704
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets
arkts
startServer
启动服务器
startServer() { workerPort.postMessage({ type: 'startServer', serverIp: this.serverIp, serverPort: this.serverPort, serverKey: this.serverKey, serverCert: this.serverCert, caCert: this.caCert }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsSer...
AST#method_declaration#Left startServer 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 workerPort AST#expression#Right . postMessage AST#me...
startServer() { workerPort.postMessage({ type: 'startServer', serverIp: this.serverIp, serverPort: this.serverPort, serverKey: this.serverKey, serverCert: this.serverCert, caCert: this.caCert }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsSer...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets#L258-L283
1116404e9e001509f86cdb4bdc1a70773a0f1bc5
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
onReceivedUpdateServiceMessage
收到推送消息 @param otaStatus 状态数据
async onReceivedUpdateServiceMessage(eventInfo: update.EventInfo): Promise<void> { this.log('receives from onReceivedUpdateServiceMessage:' + JSON.stringify(eventInfo)); let message: Message = { context: globalThis.extensionContext, eventInfo: eventInfo, }; await this.messageQueue.execute(me...
AST#method_declaration#Left async onReceivedUpdateServiceMessage AST#parameter_list#Left ( AST#parameter#Left eventInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . EventInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramete...
async onReceivedUpdateServiceMessage(eventInfo: update.EventInfo): Promise<void> { this.log('receives from onReceivedUpdateServiceMessage:' + JSON.stringify(eventInfo)); let message: Message = { context: globalThis.extensionContext, eventInfo: eventInfo, }; await this.messageQueue.execute(me...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L344-L351
ef9108924e00d8aa020c0166c0e860febddfb0f5
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
createPreviewOutputFn
创建previewOutput输出对象
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput | undefined = undefined; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); ...
AST#method_declaration#Left createPreviewOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ...
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput | undefined = undefined; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); ...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L419-L430
836636a073e97f4ab7a7382ccdd18ae501918766
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
lenHex2number
16进制数据转换为数值 @param lenHex 16进制数据 @returns 对应的数值
private lenHex2number(lenHex: string): number { if (lenHex.length == 2) { return Number.parseInt("0x" + lenHex); } return Number.parseInt("0x" + lenHex.slice(2, lenHex.length)); }
AST#method_declaration#Left private lenHex2number AST#parameter_list#Left ( AST#parameter#Left lenHex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
private lenHex2number(lenHex: string): number { if (lenHex.length == 2) { return Number.parseInt("0x" + lenHex); } return Number.parseInt("0x" + lenHex.slice(2, lenHex.length)); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L195-L200
29a97d45e054a260ec1f4b5d1ed47e197c4b6920
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/all/PictureSort.ets
arkts
textStyle
text style. @param fontSize Font size. @param fontWeight Font weight.
@Extend(Text) function textStyle(fontSize: Resource, fontWeight: number) { .fontSize(fontSize) .fontWeight(fontWeight) .fontColor($r('app.color.font_black')) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function textStyle AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AS...
@Extend(Text) function textStyle(fontSize: Resource, fontWeight: number) { .fontSize(fontSize) .fontWeight(fontWeight) .fontColor($r('app.color.font_black')) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/all/PictureSort.ets#L28-L33
dbb2c55daabf47c612d69079a98fb15c6da1359f
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegManager.ets
arkts
startWorkerLoop
工作线程主循环
private async startWorkerLoop(): Promise<void> { FLog.info(FFmpegManager.TAG, 'Worker loop started'); while (this.isRunning) { // 1. 等待任务(阻塞) const task = await this.waitForTask(); if (!task || !this.isRunning) { continue; } // 2. 检查任务是否已取消 if (task...
AST#method_declaration#Left private async startWorkerLoop 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 > A...
private async startWorkerLoop(): Promise<void> { FLog.info(FFmpegManager.TAG, 'Worker loop started'); while (this.isRunning) { const task = await this.waitForTask(); if (!task || !this.isRunning) { continue; } if (task.isCancelled()) { FLo...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L247-L274
c8587bbec4161d982cf7fffe28bb1815796fca37
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/WorldClock/ClockArea.ets
arkts
drawPan
绘制表盘
private drawPan(): void { this.renderContext.beginPath(); let secondImg = new ImageBitmap(AlarmClockConstants.CLOCK_PAN_IMAGE_URL); let imgWidth = this.clockRadius * 2; this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth); this.renderContext.restore(); ...
AST#method_declaration#Left private drawPan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left...
private drawPan(): void { this.renderContext.beginPath(); let secondImg = new ImageBitmap(AlarmClockConstants.CLOCK_PAN_IMAGE_URL); let imgWidth = this.clockRadius * 2; this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth); this.renderContext.restore(); ...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/WorldClock/ClockArea.ets#L57-L63
a6ad2d5d16d64d6241cc99911b068c178fe3766c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey 给定秘钥规格公钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param dataCoding 入参字符串编码方式(hex/base64) @param isPem 是否为pem格式的key @returns 验签结果OutDTO对象,其中Msg为验签结果
static verify(signStr: string, verifyStr: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): string { //将公钥转换 let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAl...
AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static verify(signStr: string, verifyStr: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): string { let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L445-L466
780fa6b4ccbe784aac71e58b71a5df42483dcbc3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
mergeAISettings
合并AI设置
private mergeAISettings(current: AISettings, updates: Partial<AISettings>): AISettings { const result: AISettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, provider: updates.provider !== undefined ? updates.provider : current.provider, personalization: updates...
AST#method_declaration#Left private mergeAISettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left AISettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#gene...
private mergeAISettings(current: AISettings, updates: Partial<AISettings>): AISettings { const result: AISettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, provider: updates.provider !== undefined ? updates.provider : current.provider, personalization: updates...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L532-L549
92cd376b0d4d0580a34c283f8a0d8531724204f0
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/DateUtils.ets
arkts
日期工具类 提供日期格式化、计算等功能
export class DateUtils { /** * 格式化日期 */ static format(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHou...
AST#export_declaration#Left export AST#class_declaration#Left class DateUtils AST#class_body#Left { /** * 格式化日期 */ AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#...
export class DateUtils { static format(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L5-L99
459bdc3c9a6584550de557bb7d5e84bef60450bb
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
arkts
insertDataList
插入多条数据
public insertDataList(index: number, dataList: T[]): void { if (index < 0 || index > this.originDataArray.length) { throw new Error("Index out of bounds"); } dataList.forEach(data => { this.addSpecifyIndexData(index, data) }) }
AST#method_declaration#Left public insertDataList AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#...
public insertDataList(index: number, dataList: T[]): void { if (index < 0 || index > this.originDataArray.length) { throw new Error("Index out of bounds"); } dataList.forEach(data => { this.addSpecifyIndexData(index, data) }) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L109-L116
bec063124924be46726294d26b5c530c504b96c4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/OneWayTlsWorker.ets
arkts
sendMessageToServer
发送消息到服务器
function sendMessageToServer(message: string) { if (!tlsSocket) { workerPort.postMessage({ type: 'sendMessageFailure', message: 'TLS connection is not established.' }); return; } tlsSocket.send(message + '\r\n') .then(() => { workerPort.postMessage({ type: 'sendMessageSuccess', message: message...
AST#function_declaration#Left function sendMessageToServer AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_sta...
function sendMessageToServer(message: string) { if (!tlsSocket) { workerPort.postMessage({ type: 'sendMessageFailure', message: 'TLS connection is not established.' }); return; } tlsSocket.send(message + '\r\n') .then(() => { workerPort.postMessage({ type: 'sendMessageSuccess', message: message...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/OneWayTlsWorker.ets#L136-L149
c4c39b9791f55f8fb8cfbffb99f17d8b5e13db44
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/report/RadarView.ets
arkts
drawDimensionLabels
========== 绘制维度标签 ==========
private drawDimensionLabels(centerX: number, centerY: number, radius: number): void { if (this.parts.length === 0) return; const angleStep = (2 * Math.PI) / this.parts.length; const labelRadius = radius + 20; // 标签距离中心的半径 this.ctx.fillStyle = '#111111'; this.ctx.font = '22px sans-serif'; this....
AST#method_declaration#Left private drawDimensionLabels AST#parameter_list#Left ( AST#parameter#Left centerX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left centerY : AST#type_annotation#Left AST#primary_type#Left number A...
private drawDimensionLabels(centerX: number, centerY: number, radius: number): void { if (this.parts.length === 0) return; const angleStep = (2 * Math.PI) / this.parts.length; const labelRadius = radius + 20; this.ctx.fillStyle = '#111111'; this.ctx.font = '22px sans-serif'; this.ctx.textAlig...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L309-L328
1224d6fe00d83110d7e4d7d9bc4cb5c9e9594594
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘100%’
export const DEFAULT_2: number = 2;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Rig...
export const DEFAULT_2: number = 2;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L65-L65
c1969d6ba74392fb4b63ab7505fde1b79d07d7bf
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Routes.ets
arkts
路由路径常量
export const Routes: RoutesType = { // 启动页 SPLASH: '/pages/Splash', // 登录相关 LOGIN: '/pages/Login', REGISTER: '/pages/Register', // 主页 MAIN_TAB: '/pages/MainTab', HOME: '/pages/Home', PROFILE: '/pages/Profile', // 其他页面 SETTINGS: '/pages/Settings', ABOUT: '/pages/About' };
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left Routes : AST#type_annotation#Left AST#primary_type#Left RoutesType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 启动页 AST#property_assignment#Left AST#property_name#Le...
export const Routes: RoutesType = { SPLASH: '/pages/Splash', LOGIN: '/pages/Login', REGISTER: '/pages/Register', MAIN_TAB: '/pages/MainTab', HOME: '/pages/Home', PROFILE: '/pages/Profile', SETTINGS: '/pages/Settings', ABOUT: '/pages/About' };
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Routes.ets#L19-L35
9cb3b18988a90bc9025fe9aa6ed1078fd8fbff7d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
getActiveReminders
获取所有活动提醒
getActiveReminders(): ReminderConfig[] { return Array.from(this.activeReminders.values()); }
AST#method_declaration#Left getActiveReminders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ReminderConfig [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_state...
getActiveReminders(): ReminderConfig[] { return Array.from(this.activeReminders.values()); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L459-L461
d4bc5a670fb7221ef9e4fd08810463e4baae8d6c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isWindowShowing
判断当前窗口是否已显示。 @param windowClass 不传该值,默认主窗口。 @returns
static isWindowShowing(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return windowClass.isWindowShowing(); }
AST#method_declaration#Left static isWindowShowing AST#parameter_list#Left ( AST#parameter#Left windowClass : 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#expression#Left AST#call_expression#Left AS...
static isWindowShowing(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return windowClass.isWindowShowing(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L365-L367
ff1088d133df742ac71a819be547493ca4cf9a78
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): T { return this.originDataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right ...
public getData(index: number): T { return this.originDataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L37-L39
a641d91b1f4eae35149b1adc1f68a5c745feda5c
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_loadingProgress/ace_ets_module_loadingProgress_api12/entry/src/main/ets/MainAbility/utils/MessageManager.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface Callback {
AST#export_declaration#Left export AST#interface_declaration#Left interface Callback AST#object_type#Left { AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface Callback {
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_loadingProgress/ace_ets_module_loadingProgress_api12/entry/src/main/ets/MainAbility/utils/MessageManager.ets#L15-L15
218e483471e4640dc5c3bc959f58ccb3ef30a0d6
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@olxbr_gitlab-node-sdk/0.2.3/package/index.ets
arkts
根据约束60:使用ES模块导出语法替换module.exports 根据约束70:函数不能附加属性,改为独立导出
export default HelloWorldNPM;
AST#export_declaration#Left export default AST#expression#Left HelloWorldNPM AST#expression#Right ; AST#export_declaration#Right
export default HelloWorldNPM;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@olxbr_gitlab-node-sdk/0.2.3/package/index.ets#L13-L13
48f351557196776c18851fc710d80f764adf3dc0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarService.ets
arkts
calculateLunarLocal
本地农历计算(简化版)
private calculateLunarLocal(date: Date): LunarDate { // 使用1900年为基准年进行计算 const baseYear = 1900; const baseDate = new Date(1900, 0, 31); // 1900年1月31日是农历1900年正月初一 const diffDays = Math.floor((date.getTime() - baseDate.getTime()) / (24 * 60 * 60 * 1000)); // 简化的农历计算(这是一个近似算法) let year = baseYear;...
AST#method_declaration#Left private calculateLunarLocal AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LunarDate AST#p...
private calculateLunarLocal(date: Date): LunarDate { const baseYear = 1900; const baseDate = new Date(1900, 0, 31); const diffDays = Math.floor((date.getTime() - baseDate.getTime()) / (24 * 60 * 60 * 1000)); let year = baseYear; let month = 1; let day = 1; const yearApprox...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarService.ets#L177-L216
bed87b5952d845ea20e65aa0e69a3e01891e93a3
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
confirmFlaw
确认故障 @param id 故障ID @param confirmed 是否确认 (可选,默认为true) @param remark 备注信息 @returns 确认结果
static async confirmFlaw(id: number, confirmed: boolean = true, remark?: string): Promise<ApiResponse<object>> { try { console.info(`[FlawService] ✅ 确认故障,ID: ${id}, 确认: ${confirmed}`); const data: Partial<AgvFlaw> = { id: id, confirmed: confirmed, remark: remark }; co...
AST#method_declaration#Left static async confirmFlaw AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left confirmed : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr...
static async confirmFlaw(id: number, confirmed: boolean = true, remark?: string): Promise<ApiResponse<object>> { try { console.info(`[FlawService] ✅ 确认故障,ID: ${id}, 确认: ${confirmed}`); const data: Partial<AgvFlaw> = { id: id, confirmed: confirmed, remark: remark }; co...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L255-L275
3fac5a49e1100b037663cd72dfc7e96513b3790e
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelCreate.ets
arkts
Emitted whenever a channel is created. @event Client#channelCreate @param {Channel} channel The channel that was created 应用约束60:使用ES模块导入/导出语法替代require/module.exports
export default ChannelCreateHandler;
AST#export_declaration#Left export default AST#expression#Left ChannelCreateHandler AST#expression#Right ; AST#export_declaration#Right
export default ChannelCreateHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelCreate.ets#L20-L20
7ea61eb2d5634ac977c526ba1dffb5767577539f
github
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/PieChartModel.ets
arkts
View that represents a pie chart. Draws cake like slices.
export default class PieChartModel extends PieRadarChartBase<PieData> { /** * rect object that represents the bounds of the piechart, needed for * drawing the circle */ private mCircleBox: MyRect = new MyRect(); /** * flag indicating if entry labels should be drawn or not */ private mDrawEntryLab...
AST#export_declaration#Left export default AST#class_declaration#Left class PieChartModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PieRadarChartBase AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieData AST#primary_type#Right AST#type_annotation#Right > AST...
export default class PieChartModel extends PieRadarChartBase<PieData> { private mCircleBox: MyRect = new MyRect(); private mDrawEntryLabels: boolean = true; private mDrawAngles: number[] = new Array<number>(1); private mAbsoluteAngles: number[] = new Array<number>(1); private mDrawHole: boolean...
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/PieChartModel.ets#L35-L858
a875ed7b2a63ad4bd31edba18ad1272b42101610
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets
arkts
stringToBigInt
将颜色字符串转换为 bigint。 颜色字符串可以是 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA" 格式。 如果缺少 alpha 通道,默认设置为完全不透明(0xFF)。 @param colorString 颜色字符串,格式为 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA"。 @param format 可选参数。指定 'ARGB' 表示 alpha 在前,或 'RGBA' 表示 alpha 在后。默认值为 'RGBA'。 @returns 表示颜色的 bigint 值。
static stringToBigInt(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): bigint { if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) { throw new Error(`无效的颜色格式: ${colorString}`); } let hex = ''; if (colorString.length === 7) { // "#RRGGBB" 格式,在前面添加 "FF" 作为 alpha。 hex =...
AST#method_declaration#Left static stringToBigInt AST#parameter_list#Left ( AST#parameter#Left colorString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format AST#ERROR#Left : 'ARGB' | 'RGBA' AST#ERROR#Right = AST#expre...
static stringToBigInt(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): bigint { if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) { throw new Error(`无效的颜色格式: ${colorString}`); } let hex = ''; if (colorString.length === 7) { hex = `FF${colorString.slice(1)}`; } ...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets#L11-L37
a81806cf2ad446f2fbfbdd66054c43c15f6a2a74
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/ConfigService.ets
arkts
getDeviceList
获取摄像头设备列表 @param page 页码,默认1 @param size 每页大小,默认999 @param status 设备状态筛选 @param id 设备ID筛选 @param name 设备名称筛选 @returns 摄像头设备列表
static async getDeviceList( page: number = 1, size: number = 999, status?: string, id?: string, name?: string ): Promise<CameraDeviceResponse> { try { console.info('[ConfigService] 📹 获取摄像头设备列表'); let queryString = `page=${page}&size=${size}`; if (status) qu...
AST#method_declaration#Left static async getDeviceList AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotati...
static async getDeviceList( page: number = 1, size: number = 999, status?: string, id?: string, name?: string ): Promise<CameraDeviceResponse> { try { console.info('[ConfigService] 📹 获取摄像头设备列表'); let queryString = `page=${page}&size=${size}`; if (status) qu...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L100-L138
f385c99344016408f31a35571b00f5a30a44024f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/DataItem.ets
arkts
循环数组接口,后续更新:自动分类,自动根据名字的第一个首字母分类(纯字母) -- 自动根据中文名字的首个字母拼音来分类
export interface ContactItem { name: string; head: string| Resource; isStarred?:boolean }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactItem AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left head : AST#type_annotation#Left A...
export interface ContactItem { name: string; head: string| Resource; isStarred?:boolean }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/DataItem.ets#L6-L10
709b4644f674dfea89f7c2cf1894a2c81dbd86ff
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/media/MediaListArgs.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/19 22:32 @Version V1.0 @Description List args
export interface MediaListArgs { id: string, name: string, type?: FinCollectionType }
AST#export_declaration#Left export AST#interface_declaration#Left interface MediaListArgs AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left name : AST#type_annotation#Left A...
export interface MediaListArgs { id: string, name: string, type?: FinCollectionType }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/media/MediaListArgs.ets#L10-L18
46af8f53191369414890785027896a87ee0fad71
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
getAnimCustomNavContentTransition
自定义转场动画回调,在Navigation().customNavContentTransition()设置 @returns
public getAnimCustomNavContentTransition() { return NavAnimationStore.customNavContentTransition }
AST#method_declaration#Left public getAnimCustomNavContentTransition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left NavAnimationStore AST#expression#Right . customNavCo...
public getAnimCustomNavContentTransition() { return NavAnimationStore.customNavContentTransition }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L110-L112
f279d60cf552e3f9d9863859b4d44c41b77cc6c8
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FormatUtil.ets
arkts
TODO 格式化工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class FormatUtil { /** * 判断传入的电话号码格式是否正确。 * @param phone * country string 表示电话号码所属国家或地区代码。 * options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。 * @returns */ static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean { const phoneN...
AST#export_declaration#Left export AST#class_declaration#Left class FormatUtil AST#class_body#Left { /** * 判断传入的电话号码格式是否正确。 * @param phone * country string 表示电话号码所属国家或地区代码。 * options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。 * @returns */ AST#method_declaration#Left static isPhone AST#para...
export class FormatUtil { static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean { const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option); return phoneNumberFormat.isValidNumber(phone); } static getPhoneFormat(p...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FormatUtil.ets#L28-L200
f68ca475d1d6ef6c4ace219e94d360f22bd0f6f0
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/SettingsStorage.ets
arkts
获取设置存储实例
export function getSettingsInstance(): DiskStorageInstance { if (!instance) { throw new Error("Settings storage is not initialized"); } return instance; }
AST#export_declaration#Left export AST#function_declaration#Left function getSettingsInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DiskStorageInstance AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_st...
export function getSettingsInstance(): DiskStorageInstance { if (!instance) { throw new Error("Settings storage is not initialized"); } return instance; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L15-L20
5760a34b1f14e96e2ca71c3924095f9aa81706b3
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/videomanager/AvPlayManager.ets
arkts
Logger
调用播放接口开始播放
Logger.info(this.tag, 'setAVPlayerCallback this.speedSelect = ${this.speedSelect}');
AST#method_declaration#Left Logger AST#ERROR#Left . in fo AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . tag , 'setAVPlayerCallback this.speedSelect = ${this.speedSelect}' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
Logger.info(this.tag, 'setAVPlayerCallback this.speedSelect = ${this.speedSelect}');
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/videomanager/AvPlayManager.ets#L103-L103
094f917a05aebae358c88f5ace2fb49e66be2370
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets
arkts
getSelectOffsetY
获取第一个图片的 y 轴偏移量
getSelectOffsetY() { let onLayoutComplete: () => void = (): void => { let modePosition = componentUtils.getRectangleById(`${this.selectImageId}0`) if (modePosition.size) { this.selectImageInfo = new RaisedSelectImageInfo(modePosition); this.selectImageListener?.off('draw') } } ...
AST#method_declaration#Left getSelectOffsetY AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left onLayoutComplete : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list...
getSelectOffsetY() { let onLayoutComplete: () => void = (): void => { let modePosition = componentUtils.getRectangleById(`${this.selectImageId}0`) if (modePosition.size) { this.selectImageInfo = new RaisedSelectImageInfo(modePosition); this.selectImageListener?.off('draw') } } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets#L101-L111
32834011c92e4d20ed694417325f6f3b75e2abdd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/MessageItem.ets
arkts
Multithreading transmission message.
export class MessageItem { constructor(buf: ArrayBuffer, last: number, cur: number) { this.buf = buf; this.last = last; this.cur = cur; } /** * Send buffers. */ buf: ArrayBuffer; /** * Last slider value. */ last: number; /** * Current slider value. */ cur: number; }
AST#export_declaration#Left export AST#class_declaration#Left class MessageItem AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#...
export class MessageItem { constructor(buf: ArrayBuffer, last: number, cur: number) { this.buf = buf; this.last = last; this.cur = cur; } buf: ArrayBuffer; last: number; cur: number; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/MessageItem.ets#L19-L40
19f6e3a763cfd36e6b31f5b9cb68b5f853096e22
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/viewmodels/MainEntryVM.ets
arkts
initData
初始化
public async initData() { await AccountingDB.initialize(getContext()); await WindowUtil.initWindowUtil(); WidgetUtil.subscribeFormId(getContext()); this.startEmitListener(); }
AST#method_declaration#Left public async initData 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#await_expression#Left await AST#expres...
public async initData() { await AccountingDB.initialize(getContext()); await WindowUtil.initWindowUtil(); WidgetUtil.subscribeFormId(getContext()); this.startEmitListener(); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/viewmodels/MainEntryVM.ets#L36-L41
b80b2fb8d911fc7d0b0fc366b1dd3fb8e5e1b9f4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
restore
从指定的数据库文件恢复数据库 @param file 指定的数据库文件名称 @returns
static async restore(file: string): Promise<void> { let kvStore = await KvUtil.getKvStore(); return kvStore.restore(file); }
AST#method_declaration#Left static async restore AST#parameter_list#Left ( AST#parameter#Left file : 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#Lef...
static async restore(file: string): Promise<void> { let kvStore = await KvUtil.getKvStore(); return kvStore.restore(file); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L178-L181
632b5887b2672d801a6c9939a29629cb25ecd741
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
getNotificationRequest
构建NotificationRequest对象 @param notificationId 通知ID @param options 描述通知的请求参数 @param content 通知内容 @param template 模板 @returns
private static getNotificationRequest(notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest { const request: notificationManager.NotificationRequest = { content: conten...
AST#method_declaration#Left private static getNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_t...
private static getNotificationRequest(notificationId: number, options: NotificationOptions, content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest { const request: notificationManager.NotificationRequest = { content: conten...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L479-L543
e46fe1d38ba5bc55cefcf94634545d2dbdcef898
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getVersionCode
获取应用版本号。
static getVersionCode(): number { return AppUtil.getBundleInfoSync().versionCode; }
AST#method_declaration#Left static getVersionCode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex...
static getVersionCode(): number { return AppUtil.getBundleInfoSync().versionCode; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L514-L516
b210b4ccce5a3c62c47ba79b5d1295faabeb186a
gitee
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/EmojiModel.ets
arkts
用于初始化EmojiData的数组
export function getEmojiDatas(): Array<EmojiData> { let emojisDataArray: Array<EmojiData> = [] EmojisComposition.forEach(item => { emojisDataArray.push(new EmojiData(item.file , item.tag)) }) return emojisDataArray; }
AST#export_declaration#Left export AST#function_declaration#Left function getEmojiDatas 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 EmojiData AST#primary_type#Ri...
export function getEmojiDatas(): Array<EmojiData> { let emojisDataArray: Array<EmojiData> = [] EmojisComposition.forEach(item => { emojisDataArray.push(new EmojiData(item.file , item.tag)) }) return emojisDataArray; }
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/EmojiModel.ets#L5-L11
32e78b32863ce3de9eef1678aa39b88e415e2fa9
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/view/ViewStateComponent.ets
arkts
holdContent
占位组件
@Builder holdContent() { if (this.showSkeleton && this.viewState == ViewStateConstant.VIEW_STATE_LOADING) { Column() } else { Column() { if (this.viewState != ViewStateConstant.VIEW_STATE_LOADING) { Image(this.convertImage()) .width($r('app.float.size_100')) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right holdContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#L...
@Builder holdContent() { if (this.showSkeleton && this.viewState == ViewStateConstant.VIEW_STATE_LOADING) { Column() } else { Column() { if (this.viewState != ViewStateConstant.VIEW_STATE_LOADING) { Image(this.convertImage()) .width($r('app.float.size_100')) ...
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/view/ViewStateComponent.ets#L26-L52
8fcf013d4d785862fd71fa3d8c0a975bbdad6cf5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
getOriginQuota
以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。 @param origin 指定源的字符串索引 @returns
static async getOriginQuota(origin: string): Promise<number> { return await webview.WebStorage.getOriginQuota(origin); }
AST#method_declaration#Left static async getOriginQuota AST#parameter_list#Left ( AST#parameter#Left origin : 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...
static async getOriginQuota(origin: string): Promise<number> { return await webview.WebStorage.getOriginQuota(origin); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L240-L242
29e0c9593eaa61f19c5530bf33c4ae281c30e7f5
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
通知类型枚举
export enum NotificationType { TASK_DUE = 'task_due', POMODORO_COMPLETE = 'pomodoro_complete', DAILY_SUMMARY = 'daily_summary' }
AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationType AST#enum_body#Left { AST#enum_member#Left TASK_DUE = AST#expression#Left 'task_due' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left POMODORO_COMPLETE = AST#expression#Left 'pomodoro_complete' AST#expression#Right AST#en...
export enum NotificationType { TASK_DUE = 'task_due', POMODORO_COMPLETE = 'pomodoro_complete', DAILY_SUMMARY = 'daily_summary' }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L7-L11
a1596b95d81a32a2640e7b1c89c9895578a0a427
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
对话流程接口
export interface ConversationFlow { id: string; name: string; description: string; steps: ConversationStep[]; currentStep: number; isActive: boolean; context: Record<string, any>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ConversationFlow AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Lef...
export interface ConversationFlow { id: string; name: string; description: string; steps: ConversationStep[]; currentStep: number; isActive: boolean; context: Record<string, any>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L34-L42
4bef6a9360010fea59a07765d5d0986a3e00ad08
github
liudi25385/mybit.git
865f64ff6b2e10f5b79100064dff05e67607a5bc
entry/src/main/ets/net/CustomNetPlugin.ets
arkts
processResult
在这里可以修改Response信息,如果需要,可重写此方法,否则不用,可删除此方法
processResult(request: NetRequest, result: http.HttpResponse): Promise<http.HttpResponse> { return new Promise((resolve: Function) => { resolve(result) }); }
AST#method_declaration#Left processResult AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left NetRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#...
processResult(request: NetRequest, result: http.HttpResponse): Promise<http.HttpResponse> { return new Promise((resolve: Function) => { resolve(result) }); }
https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/net/CustomNetPlugin.ets#L21-L25
d8958921f8aa43488df5c9bd27e4a24d869ba435
github
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/评价tags
export const COMMENT_TAGS = baseUrl + '/xhr/comment/tags.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMENT_TAGS = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/comment/tags.json' AST#expression#Right AST#binary_expression#Right AST#expressio...
export const COMMENT_TAGS = baseUrl + '/xhr/comment/tags.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L58-L58
9fc34f49c31a73ab03228ef9d153c878660f429e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets
arkts
createParser
TODO: 知识点:解析弹幕
private createParser(): BaseDanmakuParser { const parser: BaseDanmakuParser = new DanmakuParser(); const jsonSource = new JSONSource(sourceData); parser.load(jsonSource); return parser; }
AST#method_declaration#Left private createParser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BaseDanmakuParser AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declara...
private createParser(): BaseDanmakuParser { const parser: BaseDanmakuParser = new DanmakuParser(); const jsonSource = new JSONSource(sourceData); parser.load(jsonSource); return parser; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets#L162-L167
6ecaf3307f55473486779f5a54dff98f9e7f004a
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets
arkts
disableDashedHighlightLine
Disables the highlight-line to be drawn in dashed mode.
public disableDashedHighlightLine(): void { this.mHighlightDashPathEffect = null; }
AST#method_declaration#Left public disableDashedHighlightLine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expr...
public disableDashedHighlightLine(): void { this.mHighlightDashPathEffect = null; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets#L100-L102
e93d5fb7c1a02f23d049383a4d93eeb2656af4f7
gitee
2763981847/Accounting-app.git
cf8302a42588ecce1561b82e8533798157157257
entry/src/main/ets/view/StatisticalCardComponent.ets
arkts
onAccountsChange
本月收入 监听accounts属性的变化,触发onAccountsChange方法
onAccountsChange() { // 更新状态变量,以反映最新的统计数据 this.dayPay = dayStatistics(this.accounts, 0); this.dayEarn = dayStatistics(this.accounts, 1); this.monthPay = monthStatistics(this.accounts, 0); this.monthEarn = monthStatistics(this.accounts, 1); }
AST#method_declaration#Left onAccountsChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 更新状态变量,以反映最新的统计数据 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dayPay AST#m...
onAccountsChange() { this.dayPay = dayStatistics(this.accounts, 0); this.dayEarn = dayStatistics(this.accounts, 1); this.monthPay = monthStatistics(this.accounts, 0); this.monthEarn = monthStatistics(this.accounts, 1); }
https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/view/StatisticalCardComponent.ets#L19-L25
287fd5ef902c96023dbca4eec963d934f046c7cb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
商品价格
constructor(imgSrc: Resource, price: string) { this.imgSrc = imgSrc; this.price = price; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left imgSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
constructor(imgSrc: Resource, price: string) { this.imgSrc = imgSrc; this.price = price; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L26-L29
56d0901abc90b4c14e0ddbc1a097c5c7783fafab
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
预加载下一页回调函数类型 @param currentIndex - 当前卡片索引 @param remainingCount - 剩余卡片数量
export type OnLoadNextPageCallback = (currentIndex: number, remainingCount: number) => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnLoadNextPageCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Righ...
export type OnLoadNextPageCallback = (currentIndex: number, remainingCount: number) => void;
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L75-L75
9b2fd1615932f3193bdaaeffeb3982d4c0a17d96
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
AddressDetailContent
地址详情页面内容视图 @returns {void} 无返回值
@Builder private AddressDetailContent(): void { MediumPaddingVerticalScroll({ fillMaxSize: true }) { Column() { this.buildFormCard(); SpaceVerticalMedium(); this.buildDefaultAddressCard(); } .width(P100) .constraintSize({ minHeight: P100 }); } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AddressDetailContent 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...
@Builder private AddressDetailContent(): void { MediumPaddingVerticalScroll({ fillMaxSize: true }) { Column() { this.buildFormCard(); SpaceVerticalMedium(); this.buildDefaultAddressCard(); } .width(P100) .constraintSize({ minHeight: P100 }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L78-L89
fa2dbe7e6e2e47b8d6a9423337adc8c76e812add
github
amazingcoderpro/HarmonyOS_2048.git
8c27bba4772ee60548e97e37f47b24c5d3688d60
entry/src/main/ets/pages/Index.ets
arkts
0-number, 1-ChaoDai, 2-JinShi, 3-ShiBing
constructor(num: number, themeMode: number = 0) { this.num = num; this.themeMode = themeMode; this.numString = num > 0 ? num.toString() : ''; switch (num) { case 0: { this.numColor = 0x786d63; this.bgColour = 0xcabeb2; this.numSize = 40; break; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left themeMode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
constructor(num: number, themeMode: number = 0) { this.num = num; this.themeMode = themeMode; this.numString = num > 0 ? num.toString() : ''; switch (num) { case 0: { this.numColor = 0x786d63; this.bgColour = 0xcabeb2; this.numSize = 40; break; }
https://github.com/amazingcoderpro/HarmonyOS_2048.git/blob/8c27bba4772ee60548e97e37f47b24c5d3688d60/entry/src/main/ets/pages/Index.ets#L624-L635
98229abfa1cf228f44aceda7d70108252e4dbcea
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/LessEmbeddedComponent.ets
arkts
There is no need to assign aboutToReuse values to variables modified with @ Prop, as these variables are passed from the parent component to the child component. If these variables are reassigned in sub components, it will cause the content of the reused component to trigger a state refresh, thereby reducing the reuse ...
build() { // Nesting custom components within reusable components Row() { } }
AST#build_method#Left build ( ) AST#build_body#Left { // Nesting custom components within reusable components AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifie...
build() { Row() { } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/LessEmbeddedComponent.ets#L44-L48
941316dfbf9b85967740436b3456be8c00eccdae
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
统计项接口
export interface StatItem { name: string; count: number; percentage: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StatItem AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left count : AST#type_annotation#Left AST...
export interface StatItem { name: string; count: number; percentage: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L315-L319
a99ee4452c62739df4583c4eaef380e8fb0ceae4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/AddListItem.ets
arkts
AddListItem
[End build_the_overall_list_layout_and_list_items] [Start build_list_layouts_and_list_items]
@Entry @Component export struct AddListItem { private l1 = 0; private l2 = 0; // [StartExclude build_list_layouts_and_list_items] @State arr: number[] = [0, 1, 2, 3] @State toDoData: ToDo[] = [] // [EndExclude build_list_layouts_and_list_items] @Watch('onEditModeChange') @State isEditMode: boolean = false...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct AddListItem AST#component_body#Left { AST#property_declaration#Left private l1 = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_...
@Entry @Component export struct AddListItem { private l1 = 0; private l2 = 0; @State arr: number[] = [0, 1, 2, 3] @State toDoData: ToDo[] = [] @Watch('onEditModeChange') @State isEditMode: boolean = false @State selectedItems: ToDo[] = [] private availableThings: string[] = ['Reading', 'Exercise', '...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/AddListItem.ets#L67-L154
b4a8171f3a61b87f66254302d363ea3e454de7d2
gitee