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
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/contants/CommonConstants.ets
arkts
log identifier
export const MILLISECOND_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MILLISECOND_FORMAT = AST#expression#Left 'YYYY-MM-DDTHH:mm:ss.SSSZ' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const MILLISECOND_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/contants/CommonConstants.ets#L85-L85
ed0cbf2dd70993c4374ef4c8699003e44347fde8
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/WeekCalendarInfo.ets
arkts
Week calendar info
export default class WeekCalendarInfo { arr: Array<WeekDateModel> = []; strArr: Array<string> = []; }
AST#export_declaration#Left export default AST#class_declaration#Left class WeekCalendarInfo AST#class_body#Left { AST#property_declaration#Left arr : 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 WeekDateModel AST#pri...
export default class WeekCalendarInfo { arr: Array<WeekDateModel> = []; strArr: Array<string> = []; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/WeekCalendarInfo.ets#L21-L24
20db71900fda01b25f996053c309d33d6599ec98
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
loadBirthdayData
加载生日数据
private async loadBirthdayData(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[Index] loadBirthdayData - starting'); console.log('[Index] Loading birthday data...'); // 获取今日生日 this.todayBirthdays = await this.contactService.getTodayBirthdayContacts(); ...
AST#method_declaration#Left private async loadBirthdayData 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 loadBirthdayData(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[Index] loadBirthdayData - starting'); console.log('[Index] Loading birthday data...'); this.todayBirthdays = await this.contactService.getTodayBirthdayContacts(); hilog...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L207-L227
ab11615b56703fefda4a44c472e77afbf631b9bb
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/components/VideoView.ets
arkts
onTimelineOffsetsUpdate
React to timeline offset updates: recompute total timeline length.
onTimelineOffsetsUpdate() { this.totalTimelineMs = computeTimelineEndOffset(this.videosInfo ?? [], this.timelineOffsets ?? []); this.endBound = computeTimelineEndAbs(this.initialTime, this.videosInfo ?? [], this.timelineOffsets ?? []); }
AST#method_declaration#Left onTimelineOffsetsUpdate 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 . totalTimelineMs AST#member...
onTimelineOffsetsUpdate() { this.totalTimelineMs = computeTimelineEndOffset(this.videosInfo ?? [], this.timelineOffsets ?? []); this.endBound = computeTimelineEndAbs(this.initialTime, this.videosInfo ?? [], this.timelineOffsets ?? []); }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/components/VideoView.ets#L88-L91
9ef49713da1174955b066d2c574187d259d4af76
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/empty/EmptyData.ets
arkts
EmptyData
@file 数据缺省页(无数据) @author Joker.X
@ComponentV2 export struct EmptyData { /** * 构建数据缺省页视图 * @returns {void} 无返回值 */ build(): void { Empty({ description: "暂无数据", imageRes: $r("app.media.ic_empty_data") }); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyData AST#component_body#Left { /** * 构建数据缺省页视图 * @returns {void} 无返回值 */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation...
@ComponentV2 export struct EmptyData { build(): void { Empty({ description: "暂无数据", imageRes: $r("app.media.ic_empty_data") }); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyData.ets#L7-L19
07329144e8c42263a3f870cbee18ccdb0dfb0c7a
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/features/pictureView/src/main/ets/constants/PictureViewConstants.ets
arkts
常量
export interface ActionInterface { icon: Resource icon_name: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface ActionInterface AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left icon_name : AST#type_annotati...
export interface ActionInterface { icon: Resource icon_name: string }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/src/main/ets/constants/PictureViewConstants.ets#L4-L7
0b918ef85d03d80d46e4c15317dd164c74456366
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
TODO:知识点:步骤一: 注册封装后的方法到native侧 建议在EntryAbility之外调用,单次调用即可 example: registryDocumentViewPickerFn(); export default class EntryAbility extends UIAbility { abilityID: string = generateAbilityID(); ... }
export function registryDocumentViewPickerFn(): void { if (etswrapper !== undefined && etswrapper.registryDocumentViewPickerFn !== undefined) { etswrapper.registryDocumentViewPickerFn(documentViewPickerSelect, documentViewPickerSave); } }
AST#export_declaration#Left export AST#function_declaration#Left function registryDocumentViewPickerFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statemen...
export function registryDocumentViewPickerFn(): void { if (etswrapper !== undefined && etswrapper.registryDocumentViewPickerFn !== undefined) { etswrapper.registryDocumentViewPickerFn(documentViewPickerSelect, documentViewPickerSave); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L98-L102
e8b67da6c82e28c10e83270e07c14f976cd21c24
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/view/AVPlayer.ets
arkts
sliderOnchange
前台进度条变化接口 [Start slider1]
sliderOnchange(seconds: number, mode: SliderChangeMode): void { let seekTime: number = seconds * this.avPlayerController.duration / this.avPlayerController.durationTime; this.currentStringTime = secondToTime(Math.floor(seekTime / CommonConstants.SECOND_TO_MS)); this.avPlayerController.setCurrentStringTime(t...
AST#method_declaration#Left sliderOnchange AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#pri...
sliderOnchange(seconds: number, mode: SliderChangeMode): void { let seekTime: number = seconds * this.avPlayerController.duration / this.avPlayerController.durationTime; this.currentStringTime = secondToTime(Math.floor(seekTime / CommonConstants.SECOND_TO_MS)); this.avPlayerController.setCurrentStringTime(t...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/view/AVPlayer.ets#L540-L551
7172198e136adf3d968aa5e132549eb61668d4ff
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets
arkts
startCapturer
开始录音
async startCapturer(filePath: string) { // 根据 filePath 打开文件,可读可写模式,如果文件不存在自动创建 const file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE) // 1. 获取音频采集器 const audioCapturer = await this.getAudioCapturer() // 偏移值 let bufferSize: number = 0 // 2. 调用on('readData'...
AST#method_declaration#Left async startCapturer AST#parameter_list#Left ( AST#parameter#Left filePath : 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 { // 根据 filePath 打开文件,可读可写模式,如果文件不存在自动创建 ...
async startCapturer(filePath: string) { const file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE) const audioCapturer = await this.getAudioCapturer() let bufferSize: number = 0 audioCapturer.on('readData', (buffer) => { fileIo.writeSync(...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets#L102-L120
8e3b50eb00a51f8233f4ebfe7e94086652622425
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets
arkts
getBar
获取tabBar @param name - tab项标题 @returns: tabBar
public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined { return this.tabsInfo.get(name)?.barBuilder; }
AST#method_declaration#Left public getBar AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#gen...
public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined { return this.tabsInfo.get(name)?.barBuilder; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets#L59-L61
f7c9da95692766f04940c7ebe0ff1e3f1d2a1a38
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/common/AliYunTaskPollingUtil.ets
arkts
cancelAllTasks
取消所有活跃任务(简单实现)
static cancelAllTasks() { // 简单实现:清空所有任务记录 TaskPollingUtil.activeTasks.clear(); }
AST#method_declaration#Left static cancelAllTasks AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 简单实现:清空所有任务记录 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Lef...
static cancelAllTasks() { TaskPollingUtil.activeTasks.clear(); }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/AliYunTaskPollingUtil.ets#L108-L111
f51dd4653b4f2f94d2c2af7605f27aaa5bb35224
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/SmsLoginPage.ets
arkts
构建短信登录页面 @returns {void} 无返回值
build(): void { AppNavDestination({ pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, viewModel: this.vm }) { this.SmsLoginContent(); } }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left...
build(): void { AppNavDestination({ pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, viewModel: this.vm }) { this.SmsLoginContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/SmsLoginPage.ets#L38-L46
858333cb27d9bca153fd3671831221b43ffc366f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/empty/EmptyNetwork.ets
arkts
EmptyNetwork
@file 网络缺省页 @author Joker.X
@ComponentV2 export struct EmptyNetwork { /** * 描述文案 */ @Param description: ResourceStr = $r("app.string.empty_network"); /** * 操作按钮文案(仅当 onAction 存在时展示) */ @Param actionText: ResourceStr = $r("app.string.click_retry"); /** * 操作按钮点击回调(不传则不展示按钮) */ @Param onAction: (() => void) | unde...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyNetwork AST#component_body#Left { /** * 描述文案 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#pr...
@ComponentV2 export struct EmptyNetwork { @Param description: ResourceStr = $r("app.string.empty_network"); @Param actionText: ResourceStr = $r("app.string.click_retry"); @Param onAction: (() => void) | undefined = undefined; build(): void { Empty({ description: this.description, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyNetwork.ets#L7-L37
8e339dd2cb2d9e62d76666aed75a8f9bb1363a46
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
addCustomInterceptors
添加用户自定义拦截器 @param customInterceptors 自定义拦截器数组 @returns
addCustomInterceptors(customInterceptors: rcp.Interceptor[]): EfRcp { if (this.cfg.interceptors) { this.cfg.interceptors.push(...customInterceptors); } else { this.cfg.interceptors = customInterceptors; } return this; }
AST#method_declaration#Left addCustomInterceptors AST#parameter_list#Left ( AST#parameter#Left customInterceptors : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Interceptor AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AS...
addCustomInterceptors(customInterceptors: rcp.Interceptor[]): EfRcp { if (this.cfg.interceptors) { this.cfg.interceptors.push(...customInterceptors); } else { this.cfg.interceptors = customInterceptors; } return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L160-L167
e48b13a7222523a4c559ff2fb3a1288f7548d19d
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/view/ListItemComponent.ets
arkts
ListItemComponent
List item information component.
@Component export struct ListItemComponent { private itemInfo: ListItemData; build() { Row() { Image(this.itemInfo.image) .objectFit(ImageFit.Contain) .width($r('app.float.image_star_width')) .height($r('app.float.image_star_height')) .margin({ left: $r('app.floa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemComponent AST#component_body#Left { AST#property_declaration#Left private itemInfo : AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right ; AST#property_...
@Component export struct ListItemComponent { private itemInfo: ListItemData; build() { Row() { Image(this.itemInfo.image) .objectFit(ImageFit.Contain) .width($r('app.float.image_star_width')) .height($r('app.float.image_star_height')) .margin({ left: $r('app.floa...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/view/ListItemComponent.ets#L7-L56
5787bdf3be1da1a1cb801b69b89b982758bd868e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PhotoHelper.ets
arkts
select
通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。 @param options MIMEType 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。 maxSelectNumber 选择媒体文件数量的最大值(最大可设置的值为500,若不设置则默认为50或9)。 isPhotoTakingSupported 是否支持拍照,true表示支持,false表示不支持,默认为true。 isSearchSupported 是否支持搜索,true表示支持,false表示不支持,默认为true。 isEditSupported 是否支持编辑照片,true表示支持,false表示不支持,默认为true。 isO...
static async select(options?: photoAccessHelper.PhotoSelectOptions): Promise<photoAccessHelper.PhotoSelectResult> { if (options === undefined) { options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; //可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。 ...
AST#method_declaration#Left static async select AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param...
static async select(options?: photoAccessHelper.PhotoSelectOptions): Promise<photoAccessHelper.PhotoSelectResult> { if (options === undefined) { options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; options.maxSelectNumber = PICK...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L50-L62
496fed07f7ba612c9b27937b420d8f90c8721382
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/TargetInfoApi.type.ets
arkts
用户整体目标完成进度统计
export interface TargetInfoCountVo { /** * 总目标数量 */ totalQuantity: number /** * 完成目标的数量 */ completeQuantity: number /** * 更新时间 */ updateTime: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoCountVo AST#object_type#Left { /** * 总目标数量 */ AST#type_member#Left totalQuantity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * 完成目标的数量 ...
export interface TargetInfoCountVo { totalQuantity: number completeQuantity: number updateTime: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L4-L17
434a76260475eba57c18ef65d0fe7e310be5b2cd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
removeAllSlots
删除此应用程序所有通知渠道 @returns
static async removeAllSlots() { return notificationManager.removeAllSlots(); }
AST#method_declaration#Left static async removeAllSlots AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager ...
static async removeAllSlots() { return notificationManager.removeAllSlots(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L396-L398
747c41dadab54ebd6c02eedc7fa12f6cf22ff7c5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getNextBirthday
获取下次生日日期 @param birthDate 出生日期 @param isLunar 是否农历生日 @returns 下次生日日期
static getNextBirthday(birthDate: string | Date, isLunar: boolean = false): string { const birth = typeof birthDate === 'string' ? new Date(birthDate) : birthDate; const today = new Date(); if (isNaN(birth.getTime())) { return ''; } // 如果是农历生日,需要特殊处理 if (isLunar) { // TODO:...
AST#method_declaration#Left static getNextBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Ri...
static getNextBirthday(birthDate: string | Date, isLunar: boolean = false): string { const birth = typeof birthDate === 'string' ? new Date(birthDate) : birthDate; const today = new Date(); if (isNaN(birth.getTime())) { return ''; } if (isLunar) { } co...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L178-L201
890814815f3deed4e9ded8701f5c38690cf9fc51
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets
arkts
Base dataset for line and radar DataSets.
export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> { // TODO: Move to using `Fill` class /** * the color that is used for filling the line surface */ // private mFillColor: number = Color.rgb(140, 234, 255); private...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class LineRadarDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Righ...
export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> { private mFillColor: number = 0x8ceaff; private mLinearGradientColors: Array<ColorStop>; protected mFillDrawable: Object; private mFillAlpha: number = 85...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets#L26-L150
b88e52a2ee05ddbfa5b218435148fd02aa80f9ab
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/RegUtil.ets
arkts
isEmailMatch
给定邮箱是否匹配正则 @param content 邮箱字符串
static isEmailMatch(content: string): OutDTO<string> { if (content == null || content == '') { // 提供null的字符串为不匹配 return OutDTO.Error("验证邮箱不能为空"); } if (new RegExp(Const.EMAIL).test(content)) { return OutDTO.OK("邮箱格式正确") } else { return OutDTO.Error("邮箱格式不正确,请检查") } }
AST#method_declaration#Left static isEmailMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
static isEmailMatch(content: string): OutDTO<string> { if (content == null || content == '') { return OutDTO.Error("验证邮箱不能为空"); } if (new RegExp(Const.EMAIL).test(content)) { return OutDTO.OK("邮箱格式正确") } else { return OutDTO.Error("邮箱格式不正确,请检查") } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RegUtil.ets#L50-L60
40400bfa1adec2a11665a7f9df8312851ab63ac0
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/EmitterUtil.ets
arkts
Emitter工具类:封装消息订阅、发送、取消订阅
export class EmitterUtil { /** * 订阅Emitter消息 * @param msgType 消息类型 * @param callback 消息接收回调 * @returns 订阅ID(用于取消订阅) */ public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void { if (!msgType || !callback) { console.error('EmitterUtil: 订阅参数不能为空'); } //...
AST#export_declaration#Left export AST#class_declaration#Left class EmitterUtil AST#class_body#Left { /** * 订阅Emitter消息 * @param msgType 消息类型 * @param callback 消息接收回调 * @returns 订阅ID(用于取消订阅) */ AST#method_declaration#Left public static subscribe AST#parameter_list#Left ( AST#parameter#Left msgType : AST#...
export class EmitterUtil { public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void { if (!msgType || !callback) { console.error('EmitterUtil: 订阅参数不能为空'); } emitter.on(msgType, (eventData: emitter.EventData) => { try { const msgData = eventData.d...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/EmitterUtil.ets#L17-L79
bb13b99fa7cc205878d27ba925955edaac24dbb6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdUtil.ets
arkts
fastUUID
获取随机36位UUID,带-
static fastUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(36); let rand = 0; for (let i = 0; i < 36; i++) { if (i === 8 || i === 13 || i === 18 || i === 23) { uuid[i] = '-'; } else if (i === 1...
AST#method_declaration#Left static fastUUID AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left chars =...
static fastUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(36); let rand = 0; for (let i = 0; i < 36; i++) { if (i === 8 || i === 13 || i === 18 || i === 23) { uuid[i] = '-'; } else if (i === 1...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdUtil.ets#L40-L61
a322326931105a00b627f667515479ec3b20e2d1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets
arkts
refresh
刷新页面
refresh() { this.webController.refresh(); }
AST#method_declaration#Left refresh AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#...
refresh() { this.webController.refresh(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets#L50-L52
fa01b7e564153a30b07b3a2debbbd7a0f4741e96
gitee
eternaljust/Msea_HarmonyOS.git
bd83668f32138238482ee6e78f1d8e8717047a7c
entry/src/main/ets/common/utils/AxiosApi.ets
arkts
登录 @param loginfield 登录类型 @param questionid 安全提问类型 @param username 用户名或者邮箱 @param password 密码 @param answer 答案 @returns
export function getLoginData( loginfield: string, questionid: string, username: string, password: string, answer: string ): Promise<AxiosResponse<string, null>> { return axios({ url: UrlConstants.login, method: 'get', params: { loginfield: loginfield, questionid: questionid, us...
AST#export_declaration#Left export AST#function_declaration#Left function getLoginData AST#parameter_list#Left ( AST#parameter#Left loginfield : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left questionid : AST#type_annotatio...
export function getLoginData( loginfield: string, questionid: string, username: string, password: string, answer: string ): Promise<AxiosResponse<string, null>> { return axios({ url: UrlConstants.login, method: 'get', params: { loginfield: loginfield, questionid: questionid, us...
https://github.com/eternaljust/Msea_HarmonyOS.git/blob/bd83668f32138238482ee6e78f1d8e8717047a7c/entry/src/main/ets/common/utils/AxiosApi.ets#L39-L57
13bf96bb6441b2e6429327648d03947e66a6a090
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
通知提醒服务类
export class NotificationService { private static instance: NotificationService; private timedReminderService: TimedReminderService = TimedReminderService.getInstance(); private context?: common.UIAbilityContext; private settings: NotificationSettings = { enabled: true, soundEnabled: true, vibration...
AST#export_declaration#Left export AST#class_declaration#Left class NotificationService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left NotificationService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#p...
export class NotificationService { private static instance: NotificationService; private timedReminderService: TimedReminderService = TimedReminderService.getInstance(); private context?: common.UIAbilityContext; private settings: NotificationSettings = { enabled: true, soundEnabled: true, vibration...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L33-L504
0ad8c1bfa5658f9d91d9bbbf87ca1a0d8db5b393
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets
arkts
exitVoiceCall
停止录音,切换声音模式
private exitVoiceCall() { Logger.info(TAG, `exitVoiceCall`); AudioManagerModel.setVoiceScene(false); BufferModel.stopWorkTask(); }
AST#method_declaration#Left private exitVoiceCall AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#mem...
private exitVoiceCall() { Logger.info(TAG, `exitVoiceCall`); AudioManagerModel.setVoiceScene(false); BufferModel.stopWorkTask(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L207-L211
d41b927fd7e00cabf96482e78504a71348c50c1b
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
当前用户
aboutToAppear() { this.initializeApp(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initializeApp AST#memb...
aboutToAppear() { this.initializeApp(); }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/pages/Index.ets#L26-L28
eee5a7d41eb1c39e22e860879c47764e3fdcd2a0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets
arkts
getOffsetForDrawingAtPoint
根据给定的X和Y位置计算并返回第二个偏移量对象
getOffsetForDrawingAtPoint(posX: number, posY: number): MPPointF { let offset: MPPointF = this.getOffset(); this.mOffset2.x = offset.x; this.mOffset2.y = offset.y; return this.mOffset2; }
AST#method_declaration#Left getOffsetForDrawingAtPoint AST#parameter_list#Left ( AST#parameter#Left posX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left posY : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
getOffsetForDrawingAtPoint(posX: number, posY: number): MPPointF { let offset: MPPointF = this.getOffset(); this.mOffset2.x = offset.x; this.mOffset2.y = offset.y; return this.mOffset2; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets#L37-L42
aa1bb8f193943afce206353a3c0383dd6cd58774
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
product/oh/base/src/main/ets/pages/index.ets
arkts
isNeedCheckNewVersion
onpage show时判断,当前状态是否需要自动触发搜包
private isNeedCheckNewVersion(): boolean { if (this.newVersionStatus == NewVersionStatus.CHECKING) { return false; } let currentStatus = OtaUpdateManager.getInstance().getUpdateState(); this.log(`checkNewVersion, currentStatus = ${currentStatus} `); if (this.initUpdateStatus != currentStatus) ...
AST#method_declaration#Left private isNeedCheckNewVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member...
private isNeedCheckNewVersion(): boolean { if (this.newVersionStatus == NewVersionStatus.CHECKING) { return false; } let currentStatus = OtaUpdateManager.getInstance().getUpdateState(); this.log(`checkNewVersion, currentStatus = ${currentStatus} `); if (this.initUpdateStatus != currentStatus) ...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/product/oh/base/src/main/ets/pages/index.ets#L244-L255
c4ec6cb4f912634e4482c93ec33c806a4cb2cc67
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets
arkts
allBodyPlan
****************************解锁你的个人专属计划****************************
@Builder allBodyPlan() { // 头部图片区域 Stack({ alignContent: Alignment.BottomStart }) { Image("image/plan/musicBrank.png") .width('100%') .height(280) .objectFit(ImageFit.Cover) .borderRadius({ topLeft: 0, topRight: 0, bottomLeft: 20, bottomRight: 20 }) // 渐变遮罩 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right allBodyPlan AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 头部图片区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#componen...
@Builder allBodyPlan() { Stack({ alignContent: Alignment.BottomStart }) { Image("image/plan/musicBrank.png") .width('100%') .height(280) .objectFit(ImageFit.Cover) .borderRadius({ topLeft: 0, topRight: 0, bottomLeft: 20, bottomRight: 20 }) Column() ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets#L44-L79
834175479c67fffd10b770572e75004ad1607915
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/pages/HomePage.ets
arkts
HeaderSection
头部视图
@Builder HeaderSection() { Column() { Text('欢迎您,王安全员') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor(Color.White) Text('今天是 2026年1月25日 | 系统运行正常') .fontSize(13) .fontColor('#CCFFFFFF') .margin({ top: 8 }) } .width('100%') .height(140) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right HeaderSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder HeaderSection() { Column() { Text('欢迎您,王安全员') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor(Color.White) Text('今天是 2026年1月25日 | 系统运行正常') .fontSize(13) .fontColor('#CCFFFFFF') .margin({ top: 8 }) } .width('100%') .height(140) ...
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/HomePage.ets#L219-L239
4eb141f583172a3f37a592a2cff55aa55aab613b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
confirmReceiveOrder
确认收货订单 @returns {void} 无返回值
confirmReceiveOrder(): void { RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId)) .loading(true) .execute() .then((): void => { this.retryRequest(); this.hideConfirmReceiveDialog(); }); }
AST#method_declaration#Left confirmReceiveOrder 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#expr...
confirmReceiveOrder(): void { RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId)) .loading(true) .execute() .then((): void => { this.retryRequest(); this.hideConfirmReceiveDialog(); }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L287-L295
b2194e3a405751b106d1dd512c6589109112fa76
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Provider/Provider5.ets
arkts
ObservedObject
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...
@ObservedV2 export class ObservedObject { @Trace name: string; @Trace age: number; constructor(name: string, age: number) { this.name = name; this.age = age; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class ObservedObject AST#class_body#Left { AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation...
@ObservedV2 export class ObservedObject { @Trace name: string; @Trace age: number; constructor(name: string, age: number) { this.name = name; this.age = age; } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Provider/Provider5.ets#L15-L24
e3eb0ce13425590c4965c6438145eb382393a11b
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
addRoom
添加新房间
addRoom(roomName: string): boolean { if (!roomName || roomName.trim().length === 0) { return false; } // 检查是否已存在相同名称的房间 const existingRoom = this.rooms.find(room => room.name === roomName.trim()); if (existingRoom) { return false; } // 添加新房间 const newId = this.rooms.length;...
AST#method_declaration#Left addRoom AST#parameter_list#Left ( AST#parameter#Left roomName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Righ...
addRoom(roomName: string): boolean { if (!roomName || roomName.trim().length === 0) { return false; } const existingRoom = this.rooms.find(room => room.name === roomName.trim()); if (existingRoom) { return false; } const newId = this.rooms.length; this.rooms.push({ ...
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L233-L257
b619f6deb831c235162608de18d44b4a6cfbc0cc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
networkObserve
监听网络状态 @param netType 监听的网络类型(WI-FI、蜂窝数据等)
networkObserve(netType: connection.NetBearType) { // TODO:根据网络类型,设置不同的网络监听,用于WI-FI和蜂窝网络切换时判断各自网络状态的变化。 let netConnection: connection.NetConnection = connection.createNetConnection({ netCapabilities: { bearerTypes: [netType] } }) // 注册网络监听,注册成功后才能监听到对应类型的网络状态变化 netConnection.regis...
AST#method_declaration#Left networkObserve AST#parameter_list#Left ( AST#parameter#Left netType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#b...
networkObserve(netType: connection.NetBearType) { let netConnection: connection.NetConnection = connection.createNetConnection({ netCapabilities: { bearerTypes: [netType] } }) netConnection.register((error: BusinessError) => { let result = true; if (error) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L271-L328
a588aa548633ebcd3c824fc1755908c0cbdeaa7d
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
getLabelXOffset
returns the horizontal offset of the y-label
public getLabelXOffset(): number { return this.mXLabelOffset; }
AST#method_declaration#Left public getLabelXOffset 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_e...
public getLabelXOffset(): number { return this.mXLabelOffset; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L243-L245
84b5a3f9ca8f4592e8b36c9d3e3577e36be33b50
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/action/ToastUtil.ets
arkts
TODO 土司工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ToastUtil { private static defaultConfig: ToastConfig = new ToastConfig(); //默认样式 /** * 设置默认统一样式 * @param configs */ static setDefaultConfig(configs: (config: ToastConfig) => void): void { configs(ToastUtil.defaultConfig); } /** * 弹出土司,默认时长为2s,距离底部默认为80vp * @param message ...
AST#export_declaration#Left export AST#class_declaration#Left class ToastUtil AST#class_body#Left { AST#property_declaration#Left private static defaultConfig : AST#type_annotation#Left AST#primary_type#Left ToastConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#...
export class ToastUtil { private static defaultConfig: ToastConfig = new ToastConfig(); static setDefaultConfig(configs: (config: ToastConfig) => void): void { configs(ToastUtil.defaultConfig); } static showToast(message: string | Resource, options?: ToastOptions) { if (message || (typeof me...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L27-L112
e4edd6ef2f9acf0bc66258642641b5e3dcd98eda
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SelectionMenu.d.ets
arkts
Construct parameter types for SelectionMenuOptions. @extends MenuItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Construct parameter types for SelectionMenuOptions. @extends MenuItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface SelectionMenuOptions { /** * The options of EditorMenu. * * @type { ?Array<EditorMenuOptions> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The options of EditorMenu. * * @type { ?Array<EditorMenuOptions> } * @syscap SystemCapa...
AST#export_declaration#Left export AST#interface_declaration#Left interface SelectionMenuOptions AST#object_type#Left { /** * The options of EditorMenu. * * @type { ?Array<EditorMenuOptions> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The options of Editor...
export interface SelectionMenuOptions { editorMenuOptions?: Array<EditorMenuOptions>; expandedMenuOptions?: Array<ExpandedMenuOptions>; controller?: RichEditorController; onPaste?: (event?: EditorEventInfo) => void; onCopy?: (event?: EditorEventInfo) => void; on...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SelectionMenu.d.ets#L207-L339
b47f19b67a184865f7734ff1997cbb95e924ef07
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/model/BannerDataModel.ets
arkts
测试WanAndroid API result校验对象
export interface BannerDataModelData { desc: string; id: number; imagePath: string; isVisible: number; order: number; title: string; type: number; url: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface BannerDataModelData AST#object_type#Left { AST#type_member#Left desc : 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 id : AST#type_annotation#...
export interface BannerDataModelData { desc: string; id: number; imagePath: string; isVisible: number; order: number; title: string; type: number; url: string; }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/model/BannerDataModel.ets#L4-L13
ef70da7ae4a64417de1e989ff7b73ff1f043a24b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/data/DragToSwitchPicturesData.ets
arkts
Tabs组件数据
export const TAB_DATA: Array<TabDataModel> = [ new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX0, $r('app.string.dragtoswitchpictures_recommendation')), new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX1, $r('app.string.dragtoswitchpictures_second_hand_house')), new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX2, $...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TAB_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TabDataModel AST#primary_type#Right AST#type_annotation#Right...
export const TAB_DATA: Array<TabDataModel> = [ new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX0, $r('app.string.dragtoswitchpictures_recommendation')), new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX1, $r('app.string.dragtoswitchpictures_second_hand_house')), new TabDataModel(CONFIGURATION.TABS_TABBAR_INDEX2, $...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/data/DragToSwitchPicturesData.ets#L23-L33
47f6cb7e38e46f480637a608e7dd682ca81b884d
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/StrUtil.ets
arkts
truncate
截断字符串,如果字符串超出了限定的最大值。 被截断的字符串后面会以 omission 代替,omission 默认是 "..." @param string 要截断的字符串 @param options 选项对象 StrOptions @param options.length=20 允许的最大长度 @param options.omission='...' 超出后的代替字符 @param options.separator 截断点 @returns 截取后的字符串
static truncate(string: string = '', options?: StrOptions): string { if (!options) { options = new StrOptions(); } if (string.length <= options.length) { return string; } if (!options.separator) { return string.slice(0, options.length) + options.omission; } if (typeof optio...
AST#method_declaration#Left static truncate AST#parameter_list#Left ( AST#parameter#Left string : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#...
static truncate(string: string = '', options?: StrOptions): string { if (!options) { options = new StrOptions(); } if (string.length <= options.length) { return string; } if (!options.separator) { return string.slice(0, options.length) + options.omission; } if (typeof optio...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L237-L259
64188d10233895c5608e7ecfe5c075a4b1f204c8
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets
arkts
insert
插入数据 若为多组数据则调用 batchSaveDate ,否则直接插入
insert(tableName: string, values: dataRdb.ValuesBucket | Array<dataRdb.ValuesBucket>): Promise<number> { return new Promise<number>((success, error) => { if (!values) { // 检查插入数据是否为空 error(0); return; } if (values instanceof Array) { // 检查values是否为多个数据// 开始数据库事务 this.rdbSto...
AST#method_declaration#Left insert AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left values : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qual...
insert(tableName: string, values: dataRdb.ValuesBucket | Array<dataRdb.ValuesBucket>): Promise<number> { return new Promise<number>((success, error) => { if (!values) { error(0); return; } if (values instanceof Array) { this.rdbStore.beginTransaction(); this.batch...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L64-L94
fe59f60ae6037f61ada9fb20988396156975409b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
buildHomeContent
构建首页内容
@Builder buildHomeContent() { Column({ space: 16 }) { // 调试信息 Text(`调试:今日生日${this.todayBirthdays.length}个,总数${this.birthdayStats.total}`) .fontSize(12) .fontColor('#ff0000') .backgroundColor('#ffffff') .padding(8) .width('100%') // 欢迎横幅 this.buildWe...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHomeContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa...
@Builder buildHomeContent() { Column({ space: 16 }) { Text(`调试:今日生日${this.todayBirthdays.length}个,总数${this.birthdayStats.total}`) .fontSize(12) .fontColor('#ff0000') .backgroundColor('#ffffff') .padding(8) .width('100%') this.buildWelcomeBanner() ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L387-L411
872272fe0edcd4210ee2d89a93dce65729477361
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
confirmReceive
确认收货 @param {number} orderId - 订单 ID @returns {Promise<NetworkResponse<boolean>>} 是否成功
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.get("order/info/confirm", { params: { orderId } }); return resp.data; }
AST#method_declaration#Left async confirmReceive AST#parameter_list#Left ( AST#parameter#Left orderId : 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#...
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.get("order/info/confirm", { params: { orderId } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L125-L129
21c66db3e9f1e8948c20e8ca583818334670de60
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
startTask
开始任务
async startTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'in-progress' }); }
AST#method_declaration#Left async startTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi...
async startTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'in-progress' }); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L338-L342
a02fc6241356806ddef756be1d376bc4945e4db6
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/PersonalInformation.ets
arkts
PersonalInformation
使用 @Component 装饰器定义个人资料组件。
@Component export struct PersonalInformation { @StorageLink('nikeName') nikeName: string = ''; // 从存储链接昵称,默认为空字符串 @StorageLink('email') email: string = ''; // 从存储链接邮箱,默认为空字符串 @StorageLink('birthDate') birthDate: string = ''; // 从存储链接出生日期,默认为空字符串 @StorageLink('sex') sex: ResourceStr = $r('app.string.male'); // 从...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PersonalInformation AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'nikeName' AST#expression#Right ) AST#decorator#Right nikeName : AST#type_annotation#L...
@Component export struct PersonalInformation { @StorageLink('nikeName') nikeName: string = ''; @StorageLink('email') email: string = ''; @StorageLink('birthDate') birthDate: string = ''; @StorageLink('sex') sex: ResourceStr = $r('app.string.male'); @StorageLink('Hobbies') hobbies: string = ''; @Storage...
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L156-L431
915b748c1ca3b6649d13b85e7c693a770ea1164c
github
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/form/src/main/ets/default/view/FormServiceComponent.ets
arkts
FormServiceComponent
Form service view Component (phone adaptation).
@Component export struct FormServiceComponent { @StorageLink('screenWidth') @Watch('initPage') screenWidth: number = 0; @StorageLink('screenHeight') screenHeight: number = 0; @State formAppInfos: AppItemInfo[] = []; @State showFormInfos: CardItemInfo[] = []; private readonly mServiceFormManager: ServiceFormMa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FormServiceComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'screenWidth' AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Watch (...
@Component export struct FormServiceComponent { @StorageLink('screenWidth') @Watch('initPage') screenWidth: number = 0; @StorageLink('screenHeight') screenHeight: number = 0; @State formAppInfos: AppItemInfo[] = []; @State showFormInfos: CardItemInfo[] = []; private readonly mServiceFormManager: ServiceFormMa...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormServiceComponent.ets#L45-L364
c7a44dc8a4745cd1a3db40d527347b703347734b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/greeting/GreetingService.ets
arkts
deleteGreeting
删除祝福语 @param greetingId 祝福语ID @returns 是否成功
async deleteGreeting(greetingId: string): Promise<boolean> { try { // 检查祝福语是否存在 const existingGreeting = await this.getGreetingById(greetingId); if (!existingGreeting) { throw new Error('祝福语不存在'); } await this.databaseService.executeTransaction(async () => { // 删除相关的历史...
AST#method_declaration#Left async deleteGreeting AST#parameter_list#Left ( AST#parameter#Left greetingId : 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_ty...
async deleteGreeting(greetingId: string): Promise<boolean> { try { const existingGreeting = await this.getGreetingById(greetingId); if (!existingGreeting) { throw new Error('祝福语不存在'); } await this.databaseService.executeTransaction(async () => { await this.da...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/greeting/GreetingService.ets#L162-L197
cbae89f4a8d04a9bf34ebc64b2ba9daed779c052
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieDataSet.ets
arkts
getValueLinePart1OffsetPercentage
When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size @Override
public getValueLinePart1OffsetPercentage(): number { return this.mValueLinePart1OffsetPercentage; }
AST#method_declaration#Left public getValueLinePart1OffsetPercentage 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...
public getValueLinePart1OffsetPercentage(): number { return this.mValueLinePart1OffsetPercentage; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L217-L219
c1db2193b993dd98fc09ef388626f28db3a3a063
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
replace
替换字符串中匹配的正则为给定的字符串 @param str 待替换的字符串 @param pattern 要匹配的内容正则或字符串 @param replacement 替换的内容 @returns 返回替换后的字符串
static replace(str: string = '', pattern: RegExp | string, replacement: string): string { return str.replace(pattern, replacement); }
AST#method_declaration#Left static replace AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left A...
static replace(str: string = '', pattern: RegExp | string, replacement: string): string { return str.replace(pattern, replacement); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L103-L105
429bfc06a10a56755fb7712229f8ff2a3b0a881e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildSuggestions
构建建议操作
@Builder buildSuggestions() { Column({ space: 8 }) { Text('建议操作') .fontSize(12) .fontColor($r('app.color.text_secondary')) .width('100%') .textAlign(TextAlign.Start) .margin({ left: 16 }) Scroll() { Row({ space: 8 }) { ForEach(this.currentSugg...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa...
@Builder buildSuggestions() { Column({ space: 8 }) { Text('建议操作') .fontSize(12) .fontColor($r('app.color.text_secondary')) .width('100%') .textAlign(TextAlign.Start) .margin({ left: 16 }) Scroll() { Row({ space: 8 }) { ForEach(this.currentSugg...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L376-L410
f50a3a813f1864b97c279b3e3002f968858f4fd5
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/GlobalThemeState.ets
arkts
forceRefresh
强制刷新主题
forceRefresh(): void { this.notifyThemeChange(); }
AST#method_declaration#Left forceRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#...
forceRefresh(): void { this.notifyThemeChange(); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L59-L61
6f8b3adc48dc8ed62bf70846b33de2a859571151
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NoMoreLayout.ets
arkts
NoMoreLayout
The No more data layout component.
@Component export default struct NoMoreLayout { build() { Row() { Text($r('app.string.prompt_message')) .margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING }) .fontSize(Const.NoMoreLayoutConstant_TITLE_FONT) .textAlign(TextAlign.Center) } .width(Const.FULL_WIDTH) .j...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct NoMoreLayout AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_bod...
@Component export default struct NoMoreLayout { build() { Row() { Text($r('app.string.prompt_message')) .margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING }) .fontSize(Const.NoMoreLayoutConstant_TITLE_FONT) .textAlign(TextAlign.Center) } .width(Const.FULL_WIDTH) .j...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NoMoreLayout.ets#L21-L34
a97abf8b59a1f98b8952fe5d647ca4ba4b7305f4
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
UserInfo
导出需要的类型,解决模块导出问题
export { UserInfo, PageResponse } from '../model/CommonTypes';
AST#export_declaration#Left export { UserInfo , PageResponse } from '../model/CommonTypes' ; AST#export_declaration#Right
export { UserInfo, PageResponse } from '../model/CommonTypes';
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L10-L10
a02a288367ab84c184ef4247a392e15f6b60b2b4
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieData.ets
arkts
getDataSetByIndex
The PieData object can only have one DataSet. Use getDataSet() method instead. @param index @return @Override
public getDataSetByIndex(index: number): IPieDataSet | null { return index == 0 ? this.getDataSet() : null; }
AST#method_declaration#Left public getDataSetByIndex 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#union_type#Left AST#primary_type#...
public getDataSetByIndex(index: number): IPieDataSet | null { return index == 0 ? this.getDataSet() : null; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L86-L88
82dbc62bf5b5aa7fcb8b5a9eac9487838094a29d
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
recordMoodEntry
记录或更新今日情绪 @param emotion - 情绪类型 @param intensity - 情绪强度
private async recordMoodEntry(emotion: string, intensity: number): Promise<void> { try { const today = MoodEntry.getTodayDateString(); // 获取今日已有的情绪记录 const existingEntry = await this.rdbHelper.getMoodEntryByDate(today); if (existingEntry) { // 更新现有记录:增加消息计数,始终更新为最新情绪 const ...
AST#method_declaration#Left private async recordMoodEntry AST#parameter_list#Left ( AST#parameter#Left emotion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left intensity : AST#type_annotation#Left AST#primary_type#Left numb...
private async recordMoodEntry(emotion: string, intensity: number): Promise<void> { try { const today = MoodEntry.getTodayDateString(); const existingEntry = await this.rdbHelper.getMoodEntryByDate(today); if (existingEntry) { const newMessageCount = existingEntry.messageC...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L439-L473
8c8a17d83cc7858e4c4c2eddac413366527085bb
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/RequstDownload/entry/src/main/ets/pages/Index.ets
arkts
login
模拟登录
login() { //http请求对象 let httpRequest = http.createHttp(); //请求的登录名和密码参数 let params = "username=" + this.loginName + "&password=" + this.passwd let opt: http.HttpRequestOptions = { method: http.RequestMethod.POST, extraData: params, header: { 'Content-Type': 'application/x-www-form...
AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //http请求对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
login() { let httpRequest = http.createHttp(); let params = "username=" + this.loginName + "&password=" + this.passwd let opt: http.HttpRequestOptions = { method: http.RequestMethod.POST, extraData: params, header: { 'Content-Type': 'application/x-www-form-urlencoded' }, e...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/RequstDownload/entry/src/main/ets/pages/Index.ets#L203-L231
87b24e33174f46147771c12379c22ee4b94b726e
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/ext/UIExt.ets
arkts
隐藏软键盘 目前用禁止输入实现
export function extUIHideKeybroad() { inputMethod.getController().stopInputSession() }
AST#export_declaration#Left export AST#function_declaration#Left function extUIHideKeybroad AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
export function extUIHideKeybroad() { inputMethod.getController().stopInputSession() }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ext/UIExt.ets#L29-L31
12530edd39dca535c65d3acff81189b454d09096
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/model/FormDate.ets
arkts
时间格式 调整
export default class FormDate { // 月+日 formMonthDay(goal?: string) { let date = goal ? new Date(goal) : new Date(); return `${this.fill(date.getMonth() + 1)}/${date.getDate()}`; } // 换算当前星期几 formDay(): string { let day = new Date().getDay(); if (day === 1) { return '星期一'; } else if ...
AST#export_declaration#Left export default AST#class_declaration#Left class FormDate AST#class_body#Left { // 月+日 AST#method_declaration#Left formMonthDay AST#parameter_list#Left ( AST#parameter#Left goal ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#para...
export default class FormDate { formMonthDay(goal?: string) { let date = goal ? new Date(goal) : new Date(); return `${this.fill(date.getMonth() + 1)}/${date.getDate()}`; } formDay(): string { let day = new Date().getDay(); if (day === 1) { return '星期一'; } else if (day === 2) { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/FormDate.ets#L22-L80
3fdab7f4c60c28567bc6d96cc1529a39879cbb34
gitee
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/商品详情品牌研究所
export const BRAND_INFO = baseUrl + '/xhr/brand/info.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BRAND_INFO = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/brand/info.json' AST#expression#Right AST#binary_expression#Right AST#expression#Ri...
export const BRAND_INFO = baseUrl + '/xhr/brand/info.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L46-L46
2956fb75d1f8ef8d52df7b015fd661109ff519de
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
exportToCSV
导出为CSV格式
async exportToCSV(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting CSV export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, cu...
AST#method_declaration#Left async exportToCSV AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_anno...
async exportToCSV(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting CSV export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, cu...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L463-L504
f2cbf4e14a38c89c33a57403fe690c08bda7f09f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FramedRendering/entry/src/main/ets/view/DateItemView.ets
arkts
aboutToRecycle
[End Case4]
aboutToRecycle(): void { hiTraceMeter.startTrace('recycle_', 1); this.temp = []; this.step = 0; this.maxStep = 2; hiTraceMeter.finishTrace('recycle_', 1); }
AST#method_declaration#Left aboutToRecycle 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#expressio...
aboutToRecycle(): void { hiTraceMeter.startTrace('recycle_', 1); this.temp = []; this.step = 0; this.maxStep = 2; hiTraceMeter.finishTrace('recycle_', 1); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/view/DateItemView.ets#L59-L65
1f12aca855fc9f24856c77d2b3c37cb031c2ec35
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
saveSettings
保存设置 @param settings 设置对象
private async saveSettings(settings: AppSettings): Promise<void> { await this.preferencesService.putObject( SettingsService.SETTINGS_KEYS.APP_SETTINGS, settings ); }
AST#method_declaration#Left private async saveSettings AST#parameter_list#Left ( AST#parameter#Left settings : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g...
private async saveSettings(settings: AppSettings): Promise<void> { await this.preferencesService.putObject( SettingsService.SETTINGS_KEYS.APP_SETTINGS, settings ); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L893-L898
21a3dc2c7a333e225254533ff3b35962081623e4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/TokenStoreRepository.ets
arkts
@file Token 本地存储仓库,封装存取逻辑 @author Joker.X
export class TokenStoreRepository { /** * 本地数据源实例 */ private dataSource: TokenStoreDataSource; /** * 构造函数 * @param {TokenStoreDataSource} [dataSource] 可选自定义数据源 */ constructor(dataSource?: TokenStoreDataSource) { this.dataSource = dataSource ?? new TokenStoreDataSourceImpl(); } /** * ...
AST#export_declaration#Left export AST#class_declaration#Left class TokenStoreRepository AST#class_body#Left { /** * 本地数据源实例 */ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left TokenStoreDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_dec...
export class TokenStoreRepository { private dataSource: TokenStoreDataSource; constructor(dataSource?: TokenStoreDataSource) { this.dataSource = dataSource ?? new TokenStoreDataSourceImpl(); } saveToken(token: string): Promise<void> { return this.dataSource.setToken(token); } loadToke...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/TokenStoreRepository.ets#L7-L45
066c6ddaee6e993ca676c3544b8cc6ffd790715a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
录音配置接口
export interface RecordConfig { format: audio.AudioSampleFormat; sampleRate: number; channels: number; duration: number; // 最大录音时长(秒) outputPath: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RecordConfig AST#object_type#Left { AST#type_member#Left format : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left audio . AudioSampleFormat AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#typ...
export interface RecordConfig { format: audio.AudioSampleFormat; sampleRate: number; channels: number; duration: number; outputPath: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L39-L45
d247dfe1ef74df5ea612bcb8cb73de79defc26c7
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
features/harA/src/main/ets/components/ParamPage2.ets
arkts
ParamPage2
组件间传递参数暂不支持模板化
@Route({ name: RouterConstants.PAGE_PARAM2, param: { "name": { default: null }, "age": { default: 22 }, "score": { default: [80, 90, 100] }, "userInfo": { default: new Student() } } }) @Component export struct ParamPage2 { @State name :string ='' @State age: number = 0 @State score: number[]...
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . PAGE_PARAM2 AST#me...
@Route({ name: RouterConstants.PAGE_PARAM2, param: { "name": { default: null }, "age": { default: 22 }, "score": { default: [80, 90, 100] }, "userInfo": { default: new Student() } } }) @Component export struct ParamPage2 { @State name :string ='' @State age: number = 0 @State score: number[]...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/ParamPage2.ets#L11-L43
11aa0563a80b598176989a4d365f6eb00ac4752b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listslidetohistory/Index.ets
arkts
ListSlideToHistoryComponent
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 { ListSlideToHistoryComponent } from './src/main/ets/view/ListSlideToHistory'
AST#export_declaration#Left export { ListSlideToHistoryComponent } from './src/main/ets/view/ListSlideToHistory' AST#export_declaration#Right
export { ListSlideToHistoryComponent } from './src/main/ets/view/ListSlideToHistory'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/Index.ets#L16-L16
26d060f90f67ba5b5e6ccaa29f656ce710165659
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/SpotlightGuide.ets
arkts
close
关闭引导
private close(): void { this.getUIContext().animateTo({ duration: 300, curve: Curve.EaseIn }, () => { this.maskOpacity = 0; this.tooltipOpacity = 0; }); setTimeout(() => { this.show = false; AppStorage.setOrCreate('hasSeenSpotlightGuide', true); }, 300); }
AST#method_declaration#Left private close AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
private close(): void { this.getUIContext().animateTo({ duration: 300, curve: Curve.EaseIn }, () => { this.maskOpacity = 0; this.tooltipOpacity = 0; }); setTimeout(() => { this.show = false; AppStorage.setOrCreate('hasSeenSpotlightGuide', true); }, 300); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/SpotlightGuide.ets#L248-L261
7d0963a7a738615feff01785b7498eaa089ab161
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
14时06分
export class DateUtils { /** * 获取格式化日期,将传入的日期格式化为Date * @param date number类型的时间戳10-13位数据 * @returns */ static getFormatDate(date?: number | string | Date): Date { if (date == undefined || date == null) { //无参数 date = new Date(); } else if (typeof date == "string") { //字符串日期 if (date...
AST#export_declaration#Left export AST#class_declaration#Left class DateUtils AST#class_body#Left { /** * 获取格式化日期,将传入的日期格式化为Date * @param date number类型的时间戳10-13位数据 * @returns */ AST#method_declaration#Left static getFormatDate AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left A...
export class DateUtils { static getFormatDate(date?: number | string | Date): Date { if (date == undefined || date == null) { date = new Date(); } else if (typeof date == "string") { if (date.length == 0) { date = new Date(); } else if (RegexUtils.isDigits(date)) { date...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L39-L463
ec54788684d439ae251d96f80e019f64cc9c55cd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AssetUtil.ets
arkts
getSync
查询关键资产,同步 @param key @returns
static getSync(key: string): string { try { if (!AssetUtil.canIUse()) { LogUtil.error(`AssetStore-当前设备不支持该模块`); return ""; } let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key)); query.set(asset.Tag.RETURN_TYPE, asset.ReturnTyp...
AST#method_declaration#Left static getSync AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static getSync(key: string): string { try { if (!AssetUtil.canIUse()) { LogUtil.error(`AssetStore-当前设备不支持该模块`); return ""; } let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key)); query.set(asset.Tag.RETURN_TYPE, asset.ReturnTyp...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AssetUtil.ets#L128-L152
28e368e4b4e7b3613e8e181e5466447c3d51c08c
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/DatePickerDialogView.ets
arkts
aboutToAppear
底部导航条的高度
aboutToAppear(): void { this.initPickerData(); this.indicatorHeight = SysUtil.getIndicatorHeight(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.initPickerData(); this.indicatorHeight = SysUtil.getIndicatorHeight(); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/DatePickerDialogView.ets#L41-L45
b19e556585210cd5e38ca2553560c61f0fe76cf2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
runKnowledgeBasedRecommendation
知识基础推荐
private async runKnowledgeBasedRecommendation( type: RecommendationType, context: RecommendationContext, count: number ): Promise<RecommendationItem[]> { const items: RecommendationItem[] = []; // 根据规则生成推荐 switch (type) { case RecommendationType.GREETING: items.push(...await...
AST#method_declaration#Left private async runKnowledgeBasedRecommendation AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left RecommendationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST...
private async runKnowledgeBasedRecommendation( type: RecommendationType, context: RecommendationContext, count: number ): Promise<RecommendationItem[]> { const items: RecommendationItem[] = []; switch (type) { case RecommendationType.GREETING: items.push(...await this.gener...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L673-L683
21ad5c565ada492bf54b2af64aa10e33c0d8f67b
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
addSecondaryContent
添加次要分享内容(私有方法) @private
private static addSecondaryContent( data: systemShare.SharedData, params: ShareParams, primaryContent: systemShare.SharedRecord ): void { // 添加文件(如果不是主内容) if (params.filePath && primaryContent.utd !== utd.UniformDataType.FILE) { data.addRecord({ utd: params.utdType || utd.UniformData...
AST#method_declaration#Left private static addSecondaryContent AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
private static addSecondaryContent( data: systemShare.SharedData, params: ShareParams, primaryContent: systemShare.SharedRecord ): void { if (params.filePath && primaryContent.utd !== utd.UniformDataType.FILE) { data.addRecord({ utd: params.utdType || utd.UniformDataType.FILE, ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L303-L355
20628859305d7dba6b3a016da27f5ca2f7b55c0c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
loginByPhone
手机号验证码登录 @param {Record<string, string>} params - 手机号登录参数 @returns {Promise<NetworkResponse<Auth>>} 登录结果
async loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/phone", params); return response.data; }
AST#method_declaration#Left async loginByPhone AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_ann...
async loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/phone", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L71-L75
1e27df2abfd3981d5f2fad9b44b7cf75709332ae
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
getData
获取指定索引数据 @param {number} index - 索引值 @returns {VideoDataType} 返回指定索引数据
public getData(index: number): VideoDataType { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left VideoDataType AST#primary...
public getData(index: number): VideoDataType { return this.dataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L155-L157
b99321c1b1ab82bbf4f1a418e1fa450e42f58b08
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/RSA.ets
arkts
encryptSegmentSync
加密,分段,同步 @param data 加密或者解密的数据。data不能为null。 @param pubKey 指定加密公钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。 @param len 自定义的数据拆分长度。 @returns
static encryptSegmentSync(dataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 64): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, p...
AST#method_declaration#Left static encryptSegmentSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le...
static encryptSegmentSync(dataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 64): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, p...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L111-L127
60f74ae544266817fa0e00d36ebe8a0bc03636aa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinB.ets
arkts
SpinB
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinB { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; build() { Stack() { Canvas() .scale({ x: this.scale1, y: this.scale1 }) .bounceStyle() Canvas() .scale({...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinB AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinB { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; build() { Stack() { Canvas() .scale({ x: this.scale1, y: this.scale1 }) .bounceStyle() Canvas() .scale({...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinB.ets#L22-L70
f63e9b73823083dfa2f0b956ca177e041860b3df
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoParam.ets
arkts
@file Demo 模块导航参数定义 @author Joker.X 商品 ID 参数
export interface DemoGoodsParam { /** * 商品 ID */ goodsId: number; /** * 商品名称 */ goodsName: Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DemoGoodsParam AST#object_type#Left { /** * 商品 ID */ AST#type_member#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 商品名称 */ AST#typ...
export interface DemoGoodsParam { goodsId: number; goodsName: Resource; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoParam.ets#L9-L18
0b704766bea6c1bba3635d23b60e29be0d477d27
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDelete.ets
arkts
scheduleForDeletion
参数类型标注(规则45)
scheduleForDeletion(channelID: string, messageID: string): void { this.client.setTimeout(() => { this.deleted.delete(channelID + messageID); }, this.client.options.restWsBridgeTimeout); }
AST#method_declaration#Left scheduleForDeletion AST#parameter_list#Left ( AST#parameter#Left channelID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left messageID : AST#type_annotation#Left AST#primary_type#Left string AST#p...
scheduleForDeletion(channelID: string, messageID: string): void { this.client.setTimeout(() => { this.deleted.delete(channelID + messageID); }, this.client.options.restWsBridgeTimeout); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDelete.ets#L44-L48
902ff41fd8d663263d27d4bc01b2711fbb5637ee
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
clearAndPush
清空栈并跳转到指定页面 @param path 目标页面路径 @param options 跳转选项
async clearAndPush(path: string, options?: RouteOptions): Promise<void> { try { await router.clear(); await this.push(path, options); // 重置导航栈 this.navigationStack = [path]; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Cleared stack and navigated to: ${path}...
AST#method_declaration#Left async clearAndPush AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left RouteOptions AST#p...
async clearAndPush(path: string, options?: RouteOptions): Promise<void> { try { await router.clear(); await this.push(path, options); this.navigationStack = [path]; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Cleared stack and navigated to: ${path}`); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L160-L175
5936aa714b58ce092d8753634249d390d9ad021c
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/common/constants/HomeConstants.ets
arkts
Constants for home.
export class HomeConstants { /** * Column component spacing. */ static readonly COLUMN_SPACE: string = '12vp'; /** * Text transparency. */ static readonly TEXT_OPACITY: number = 0.6; }
AST#export_declaration#Left export AST#class_declaration#Left class HomeConstants AST#class_body#Left { /** * Column component spacing. */ AST#property_declaration#Left static readonly COLUMN_SPACE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expre...
export class HomeConstants { static readonly COLUMN_SPACE: string = '12vp'; static readonly TEXT_OPACITY: number = 0.6; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/common/constants/HomeConstants.ets#L19-L29
13b4b994049d7e5a8ded22ee16acfffdb0f1c4fd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildInputArea
构建输入区域
@Builder buildInputArea() { Column() { Divider() .color($r('app.color.divider')) .strokeWidth(0.5) Row({ space: 12 }) { // 语音按钮 Button() { Image(this.isListening ? $r('app.media.ic_mic_on') : $r('app.media.ic_mic')) .width(24) .height(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildInputArea AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_e...
@Builder buildInputArea() { Column() { Divider() .color($r('app.color.divider')) .strokeWidth(0.5) Row({ space: 12 }) { Button() { Image(this.isListening ? $r('app.media.ic_mic_on') : $r('app.media.ic_mic')) .width(24) .height(24) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets#L415-L479
2367738c250d94631875b1feffd1c33e64d055e1
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets
arkts
When using the actual network address, the suffix of the actual address must be filled in.
export async function httpRequest() { fs.access(fileUrl, fs.AccessModeType.READ).then((res) => { // Check if the file exists if (!res) { // If there is no address in the sandbox, re-request the network image resources. http.createHttp() .request('https://www.example.com/xxx.png', // Please fill in a...
AST#export_declaration#Left export AST#function_declaration#Left async function httpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
export async function httpRequest() { fs.access(fileUrl, fs.AccessModeType.READ).then((res) => { if (!res) { http.createHttp() .request('https://www.example.com/xxx.png', (error: BusinessError, data: http.HttpResponse) => { if (error) { return; ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets#L28-L48
6e0e02d071cbd07ce617b250e03d12d7a38c9c63
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets
arkts
onBottomClose
弹窗底部关闭按钮 点击回调 @param action @returns
onBottomClose(action: ActionCallback) { this.builderOptions.attachAction = action }
AST#method_declaration#Left onBottomClose AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left ActionCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST...
onBottomClose(action: ActionCallback) { this.builderOptions.attachAction = action }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets#L36-L38
5df0749b21e3c41ed35b87cfa8c919aa4b1634bd
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeaderV2.d.ets
arkts
The callback function that will be invoked when the selectedIndex of the SubHeaderV2Select is selected. @typedef { function } SubHeaderV2SelectOnSelect @param { number } selectedIndex - the index of selected item @param { ?string } selectedContent - the content of selected item @syscap SystemCapability.ArkUI.ArkUI.Ful...
export type SubHeaderV2SelectOnSelect = (selectedIndex: number, selectedContent?: string) => void;
AST#export_declaration#Left export AST#type_declaration#Left type SubHeaderV2SelectOnSelect = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left selectedIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#...
export type SubHeaderV2SelectOnSelect = (selectedIndex: number, selectedContent?: string) => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeaderV2.d.ets#L149-L149
1ef7f2987b1076dba386f5e5d68693f0375b41f8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowSpaceBetweenCenter
横向两端分布 + 垂直居中
@ComponentV2 export struct RowSpaceBetweenCenter { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Par...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceBetweenCenter AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary...
@ComponentV2 export struct RowSpaceBetweenCenter { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L385-L460
209844b3f76163b00784ec3603819fd242bbafb3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
encrypt
加密,异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。 @returns
static async encrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { return CryptoUtil.encrypt(data, symKey, params, transformation); }
AST#method_declaration#Left static async encrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey...
static async encrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { return CryptoUtil.encrypt(data, symKey, params, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L142-L145
cc037ac36dd1321bd8674fdd0873bd37ab97241e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initLoadingDefault
初始化LoadingDialogOptions参数 @param options
static initLoadingDefault(options: LoadingOptions) { options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext(); options.alignment = DialogAlignment.Center; //弹窗的对齐方式。 options.isModal = options.isModal ?? ActionParameter.config.isModal; //弹窗是否为模态窗口。 options.showInSubWindow = options.showIn...
AST#method_declaration#Left static initLoadingDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_state...
static initLoadingDefault(options: LoadingOptions) { options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext(); options.alignment = DialogAlignment.Center; options.isModal = options.isModal ?? ActionParameter.config.isModal; options.showInSubWindow = options.showInSubWindow ?? ActionPar...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L501-L551
747e7dc59b1035c4e15b5f40d677e736c56f56d7
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/WinLoadingUtil.ets
arkts
引入命名路由页面
export class WinLoadingUtil { /** * 缓存窗体集合,关闭时需要 */ private static cacheWindow: window.Window; /** * 根据参数创建窗口 * @param options * @returns */ static async showLoading(options?: efLoadingOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { //当前窗口的编码 ...
AST#export_declaration#Left export AST#class_declaration#Left class WinLoadingUtil AST#class_body#Left { /** * 缓存窗体集合,关闭时需要 */ AST#property_declaration#Left private static cacheWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type...
export class WinLoadingUtil { private static cacheWindow: window.Window; static async showLoading(options?: efLoadingOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { let winName = 'efLoading' + RandomUtil.randomNumber(2000, 2000000); let efS...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/WinLoadingUtil.ets#L33-L96
b3420d48688c7f0094fd0083563d73f3d9b9ca30
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/bluetooth.ets
arkts
getPairStateText
Get pair state text @param device
getPairStateText(device: BluetoothDevice): string { return device.connectionState == BondState.BOND_STATE_BONDING ? JSON.parse(JSON.stringify($r('app.string.bluetooth_state_pairing'))) : ''; }
AST#method_declaration#Left getPairStateText AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left BluetoothDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
getPairStateText(device: BluetoothDevice): string { return device.connectionState == BondState.BOND_STATE_BONDING ? JSON.parse(JSON.stringify($r('app.string.bluetooth_state_pairing'))) : ''; }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L584-L586
225e7ae04356b068813a877edbc6f6beb2ed616d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets
arkts
disMountPublicDir
[Start cross_device_file_access_B] 取消公共文件目录挂载,断开链路。
function disMountPublicDir(): void { // 通过分布式设备管理的接口获取设备A的networkId信息 let dmInstance = distributedDeviceManager.createDeviceManager('ohos.samples.distributedmusicplayer'); let deviceInfoList: distributedDeviceManager.DeviceBasicInfo[] = dmInstance.getAvailableDeviceListSync(); // 两台设备组网连接,deviceInfoList[0]即对应另一...
AST#function_declaration#Left function disMountPublicDir 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 { // 通过分布式设备管理的接口获取设备A的networkId信息 AST#statement#Left AST#variable_declaration#Lef...
function disMountPublicDir(): void { let dmInstance = distributedDeviceManager.createDeviceManager('ohos.samples.distributedmusicplayer'); let deviceInfoList: distributedDeviceManager.DeviceBasicInfo[] = dmInstance.getAvailableDeviceListSync(); let networkId = deviceInfoList[0].networkId; fs.disconnectDfs...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets#L137-L149
e0d4e85bd0a93017b88fd67a9b3a38aa7425428a
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
aboutToDisappear
离开页面时,重置音视频播放器。
public aboutToDisappear(): void { if (this.avPlayer.state === 'playing') { this.avPlayer.reset(); } }
AST#method_declaration#Left public aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#...
public aboutToDisappear(): void { if (this.avPlayer.state === 'playing') { this.avPlayer.reset(); } }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L229-L233
8fddcd25e6f4078f7ee1d050d52d12c074ab6491
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/WantAgentUtil.ets
arkts
createWantAgentForCommonEvent
create wantAgent for common event @param mAction @return return the created WantAgent object.
async createWantAgentForCommonEvent(action: string) { let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [{ action: action }], operationType: wantAgent.OperationType.SEND_COMMON_EVENT, requestCode: REQUEST_CODE // requestCode是WantAgentInfo的请求码,是使用者定义的一个私有值 } return await wantAgent.getWa...
AST#method_declaration#Left async createWantAgentForCommonEvent AST#parameter_list#Left ( AST#parameter#Left action : 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#va...
async createWantAgentForCommonEvent(action: string) { let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [{ action: action }], operationType: wantAgent.OperationType.SEND_COMMON_EVENT, requestCode: REQUEST_CODE } return await wantAgent.getWantAgent(wantAgentInfo); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/WantAgentUtil.ets#L47-L54
3ab1a3dc890e9e777969ee60a8312e2506f2f1dd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/launch/src/main/ets/navigation/GuideNav.ets
arkts
GuideNav
@file 引导页导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function GuideNav(): void { GuidePage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function GuideNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_compo...
@Builder export function GuideNav(): void { GuidePage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/navigation/GuideNav.ets#L8-L11
46d50f8f67a03f9970a6e5430cc43c3836070867
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
日历日期的代办事项
export interface CalendarDayTodos { date: string; todos: Todo[]; total: number; completedCount: number; hasHighPriority: boolean; hasReminder: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarDayTodos AST#object_type#Left { AST#type_member#Left date : 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 todos : AST#type_annotation#...
export interface CalendarDayTodos { date: string; todos: Todo[]; total: number; completedCount: number; hasHighPriority: boolean; hasReminder: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L146-L153
d2cfe6bf4aa968cc841cf37641549c1504f03f20
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initializeBackupManager
初始化备份管理系统
private initializeBackupManager(): void { try { const backupManager = SimpleBackupManager.getInstance(); hilog.info(0x0000, 'EntryAbility', 'Backup manager initialized successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to initialize backup manager: %{public}s', error...
AST#method_declaration#Left private initializeBackupManager 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#try_statement#Left try AST#block_statement#Left { AST#...
private initializeBackupManager(): void { try { const backupManager = SimpleBackupManager.getInstance(); hilog.info(0x0000, 'EntryAbility', 'Backup manager initialized successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to initialize backup manager: %{public}s', error...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/entryability/EntryAbility.ets#L75-L82
256547ae1d0eb9f67e3ae22cfe72b6c3d2dd1715
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets
arkts
loadShowData
读取car.json里的数据,用于展示行标题
loadShowData(): void { this.carTypeData.setData(this.carType); const context: Context = getContext(this); // 读取car.json里的数据 let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('car.json'); // 将数据解码,转成字符串 let stringData: string = util.TextDecoder.create('utf-8').decodeToStrin...
AST#method_declaration#Left loadShowData 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 AS...
loadShowData(): void { this.carTypeData.setData(this.carType); const context: Context = getContext(this); let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('car.json'); let stringData: string = util.TextDecoder.create('utf-8').decodeToString(jsonData); let data: [] =...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L61-L82
c215ca223c9cdb9e8067a572d92e5e340357544d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets
arkts
initResourceData
初始化播放文章列表
initResourceData() { const context: Context = getContext(this); // 读取string.json中文章的数据 try { let str = ''; for(let i = CONFIGURATION.PAGEFLIPPAGESTART; i <= CONFIGURATION.PAGEFLIPPAGEEND; i++) { str = context.resourceManager.getStringByNameSync(STRINGCONFIGURATION.PAGEINFO + i.toString()...
AST#method_declaration#Left initResourceData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Rig...
initResourceData() { const context: Context = getContext(this); try { let str = ''; for(let i = CONFIGURATION.PAGEFLIPPAGESTART; i <= CONFIGURATION.PAGEFLIPPAGEEND; i++) { str = context.resourceManager.getStringByNameSync(STRINGCONFIGURATION.PAGEINFO + i.toString()); th...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets#L133-L151
e61b856797be8d9feb83ee365f89173ae8422a9e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Retrieves the storage of the specific index window. @param i The index of windows.
export function storage_of_index(i: number) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; let windowStorage = windowStorages[i]; return windowStorage; }
AST#export_declaration#Left export AST#function_declaration#Left function storage_of_index AST#parameter_list#Left ( AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST...
export function storage_of_index(i: number) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; let windowStorage = windowStorages[i]; return windowStorage; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L502-L506
38183fe82cdbf9ba62391f10ac3e6dd8743476b3
gitee