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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
reset
重置播放器 @returns {Promise<void>}
async reset(): Promise<void> { await this.avplayerModel.resetAVPlayer(); }
AST#method_declaration#Left async reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
async reset(): Promise<void> { await this.avplayerModel.resetAVPlayer(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L258-L260
5f51a6c9221daa9e89da65b5c83094511a528e54
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets
arkts
setServer
设置服务器 @param objectClass
setServer(objectClass: HttpProxyCacheServer): void { try { const currentServer: HttpProxyCacheServer = this.getServer(); currentServer.shutdown(); } catch (err) { } this.objects.set(SERVER_STR, objectClass); }
AST#method_declaration#Left setServer AST#parameter_list#Left ( AST#parameter#Left objectClass : AST#type_annotation#Left AST#primary_type#Left HttpProxyCacheServer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#p...
setServer(objectClass: HttpProxyCacheServer): void { try { const currentServer: HttpProxyCacheServer = this.getServer(); currentServer.shutdown(); } catch (err) { } this.objects.set(SERVER_STR, objectClass); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets#L61-L68
2444493e3713769578cc6a20295a2663b723bfd3
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets
arkts
digestSHA512
SHA512摘要 @param str 带摘要的字符串 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 摘要后的字符串
static digestSHA512(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SHA512', resultCoding); }
AST#method_declaration#Left static digestSHA512 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
static digestSHA512(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SHA512', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets#L74-L76
bb8c51c8e20f4800b26221ab4c4e3c97532210c5
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/ObjectUtil.ets
arkts
notEqual
判断两个传入的数值或者是字符串是否不相等 @param source @param target @returns
static notEqual(source: string | number, target: string | number): boolean { return false == ObjectUtil.equal(source, target); }
AST#method_declaration#Left static notEqual AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS...
static notEqual(source: string | number, target: string | number): boolean { return false == ObjectUtil.equal(source, target); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ObjectUtil.ets#L40-L42
d3cfa7afd7571f2822971dd140c416d064d7a4e0
gitee
linwu-hi/open_neteasy_cloud.git
b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4
entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getListData
Get sub list data in a category. @param {number} itemSize The size of listData of category. @return {Array<ListItemData>} ListData of category.
private getListData(itemSize: number): Array<ListItemData> { let listData: Array<ListItemData> = []; for (let i = 0; i < itemSize; i++) { let listItem = new ListItemData(); listItem.title = $r('app.string.list_item_title'); listItem.summary = $r('app.string.list_item_summary'); listItem....
AST#method_declaration#Left private getListData AST#parameter_list#Left ( AST#parameter#Left itemSize : 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#...
private getListData(itemSize: number): Array<ListItemData> { let listData: Array<ListItemData> = []; for (let i = 0; i < itemSize; i++) { let listItem = new ListItemData(); listItem.title = $r('app.string.list_item_title'); listItem.summary = $r('app.string.list_item_summary'); listItem....
https://github.com/linwu-hi/open_neteasy_cloud.git/blob/b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4/entry/src/main/ets/viewmodel/PageViewModel.ets#L31-L41
2404143a87cb0bced72ea5b278cd4fe694d295b6
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets
arkts
更新日期
constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null) { this.fileName = fileName; this.sizeInBytes = sizeInBytes; this.updateDate = updateDate; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left A...
constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null) { this.fileName = fileName; this.sizeInBytes = sizeInBytes; this.updateDate = updateDate; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L7-L11
67176a47acaececde4aa126beac54941d49f0975
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getTipDateStr
格式化时间戳,获取提示性时间字符串 @param date 时间戳:10位时间戳:表示从1970年1月1日00:00:00 GMT开始计算的秒数,精度为秒。 13位时间戳:表示从1970年1月1日00:00:00 GMT开始计算的毫秒数,精度为毫秒。 @returns
static getTipDateStr(date: number | string | Date): string { let timeMs = DateUtil.getFormatDate(date).getTime(); if (timeMs.toString().length == 10) { timeMs = timeMs * 1000 //如果是10位的时间戳转化为13位的 } let dateNow = new Date(); let dateUp = new Date(timeMs); if (dateNow.getTime() - timeMs < 60 ...
AST#method_declaration#Left static getTipDateStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#R...
static getTipDateStr(date: number | string | Date): string { let timeMs = DateUtil.getFormatDate(date).getTime(); if (timeMs.toString().length == 10) { timeMs = timeMs * 1000 } let dateNow = new Date(); let dateUp = new Date(timeMs); if (dateNow.getTime() - timeMs < 60 * 1000) { ret...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L399-L417
5d3001ac12edac401578595c53d1ba16743332c6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/common/DynamicLoader.ets
arkts
注册动态回调类
export class DynamicLoader { private callback: (key: string) => void = (): void => { }; private static instance: DynamicLoader = new DynamicLoader(); register(callback: (key: string) => void) { this.callback = callback } async fire(key: string) { this.callback(key) } public static getInstance...
AST#export_declaration#Left export AST#class_declaration#Left class DynamicLoader AST#class_body#Left { AST#property_declaration#Left private callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
export class DynamicLoader { private callback: (key: string) => void = (): void => { }; private static instance: DynamicLoader = new DynamicLoader(); register(callback: (key: string) => void) { this.callback = callback } async fire(key: string) { this.callback(key) } public static getInstance...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/common/DynamicLoader.ets#L17-L36
7764c4c21f2ef5622a628d3014fe79e14f6dfc1d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
buildOrderStatusRow
构建订单状态行 @returns {void} 无返回值
@Builder private buildOrderStatusRow(): void { Row() { this.buildOrderStatusItem({ icon: $r("app.media.ic_pay"), label: $r("app.string.pending_payment"), count: this.vm.orderCount.pendingPayment, tabIndex: 1 }); this.buildOrderStatusItem({ icon: $r("app.me...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildOrderStatusRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left ...
@Builder private buildOrderStatusRow(): void { Row() { this.buildOrderStatusItem({ icon: $r("app.media.ic_pay"), label: $r("app.string.pending_payment"), count: this.vm.orderCount.pendingPayment, tabIndex: 1 }); this.buildOrderStatusItem({ icon: $r("app.me...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L311-L347
6620bf3411fdacbc59afc919ba54ae9903cd618c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
put
put 请求 @param efClientParams put请求入参实体 @returns
async put<F, E>(efClientParams: efClientParams<F>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: AxiosRespons...
AST#method_declaration#Left async put AST#type_parameters#Left < AST#type_parameter#Left F AST#type_parameter#Right , AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
async put<F, E>(efClientParams: efClientParams<F>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: AxiosResponse<E> = await efAxios.put<E, AxiosResponse<E>, F...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L229-L259
bc5940c60733130b2e4824b8febfbc349ec54a25
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navigationbarchange/src/main/ets/view/NavigationBarChange.ets
arkts
NavigationBarChangeView
功能描述: 本示例介绍使用Scroll组件的滚动事件 onScroll 实现状态栏显隐变化 推荐场景: 各种软件的首页、我的等页面 核心组件: 1. Header 实现步骤: 1. 在置顶位置使用stack组件添加两层状态栏 2. 通过获取Scroll的偏移量,计算透明度,分别对状态栏的组件设置透明度来实现状态栏的显隐变化效果
@Component export struct NavigationBarChangeView { // Scroll的偏移量 @State scrollOffset: number = 0; // 状态栏组件的透明度 @State headOpacity: number = 0; // 是否在顶部的标志 @State isTop: Boolean = true; // 状态栏的背景颜色 @State titleBackgroundColor: Resource = $r('app.color.navigationbarchange_color_background'); // 透明度默认值 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationBarChangeView AST#component_body#Left { // Scroll的偏移量 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right scrollOffset : AST#type_annotation#Left AST#primary_type#Left number AST#pri...
@Component export struct NavigationBarChangeView { @State scrollOffset: number = 0; @State headOpacity: number = 0; @State isTop: Boolean = true; @State titleBackgroundColor: Resource = $r('app.color.navigationbarchange_color_background'); private opacityDefaultValue: number = 1; private o...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationbarchange/src/main/ets/view/NavigationBarChange.ets#L29-L170
c34571ac5b1de8360d86fc071a9feee4ee9b7469
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_audio/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.1.0';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.1.0' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.1.0';
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_audio/BuildProfile.ets#L4-L4
f80311e26d23f2a8210dd6d1181ddda3e6bceaeb
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbility/entry/src/main/ets/pages/PayCode.ets
arkts
stopSecondAbility
停止SecondAbility
stopSecondAbility() { //TODO let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; // UIAbilityContext // context为需要停止的UIAbility实例的AbilityContext context.terminateSelf((err) => { if (err.code) { hilog.error(DOMAIN_NUMBER, TAG, `Failed to terminate self. Code i...
AST#method_declaration#Left stopSecondAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //TODO AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContex...
stopSecondAbility() { let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; context.terminateSelf((err) => { if (err.code) { hilog.error(DOMAIN_NUMBER, TAG, `Failed to terminate self. Code is ${err.code}, message is ${err.message}`); return; }...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbility/entry/src/main/ets/pages/PayCode.ets#L102-L112
27183c05aa9732d8cabc3965656540efa0ba8a14
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets
arkts
SchedulePoint
自定义添加日程组件SchedulePoint 功能描述: 1.提供添加日程以及日程提醒功能,添加的日程会同步到系统日历,Calendar Kit日历服务会根据创建的日程自动进行相应的日程提醒。 2.添加日程后,添加的日程点可以显示在CustomCalendar的月视图和周视图上。 实现思路 1.通过Calendar Kit日历与日程管理能力,使用getCalendarManager获取管理日历对象,然后createCalendar创建日历账户。 2.使用getCalendar获取日历对象,然后通过配置CalendarConfig中enableReminder为true启用日程提醒功能。 3.配置日程参数calendarManag...
@Component export struct SchedulePoint { // 是否显示半模态转场标志位 @State isShow: boolean = false; // 日程标题 @State title: string = ''; // 日程地点 @State location: string = ''; // 日程开始时间 @State startTime: Date = new Date(); // 日程开始时间字符串 @State scheduleStartTime: string = ''; // 日程结束时间 @State endTime: Date = ne...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SchedulePoint AST#component_body#Left { // 是否显示半模态转场标志位 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
@Component export struct SchedulePoint { @State isShow: boolean = false; @State title: string = ''; @State location: string = ''; @State startTime: Date = new Date(); 字符串 @State scheduleStartTime: string = ''; @State endTime: Date = new Date(); 字符串 @State scheduleEndTime: string = ''; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L64-L510
0051055625403e65e51dec088dc3c7f70643dbd0
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
DeleteButton
Delete button builder for account swipe action
@Builder DeleteButton(accountId: string) { Row() { Text('删除') .fontSize(16) .fontColor('#FFFFFF') .fontWeight(FontWeight.Medium) } .width(80) .height('100%') .backgroundColor('#FF3B30') .justifyContent(FlexAlign.Center) .onClick(() => { this.deleteAccoun...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteButton AST#parameter_list#Left ( AST#parameter#Left accountId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo...
@Builder DeleteButton(accountId: string) { Row() { Text('删除') .fontSize(16) .fontColor('#FFFFFF') .fontWeight(FontWeight.Medium) } .width(80) .height('100%') .backgroundColor('#FF3B30') .justifyContent(FlexAlign.Center) .onClick(() => { this.deleteAccoun...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1616-L1631
0c816d8d1b7e177b4cfd5101cd295adf0b52f2b5
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
saveEdit
保存编辑
async saveEdit() { if (!this.editingItem) return; if (!this.token) { promptAction.showToast({ message: '请先登录', duration: 2000 }); return; } let request: UpdateProfileRequest = {}; let key = this.editingItem.key; if (key === 'gender') { request.gender = this.editingGender;...
AST#method_declaration#Left async saveEdit AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_...
async saveEdit() { if (!this.editingItem) return; if (!this.token) { promptAction.showToast({ message: '请先登录', duration: 2000 }); return; } let request: UpdateProfileRequest = {}; let key = this.editingItem.key; if (key === 'gender') { request.gender = this.editingGender;...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L187-L230
af597cd3873f5b68e1e4683170328e6cc0355539
github
fourseas1998/hos.RankingDemo.git
5a98167826252c3c2b5ac58fa9a3db29d5f49d02
entry/src/main/ets/pages/RankPage.ets
arkts
aboutToAppear
加载初始化数据
aboutToAppear(){ this.dataSource1 = rankModel.loadRankDataSource1(); this.dataSource2 = rankModel.loadRankDataSource2(); }
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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource1 AST#member_expression#Ri...
aboutToAppear(){ this.dataSource1 = rankModel.loadRankDataSource1(); this.dataSource2 = rankModel.loadRankDataSource2(); }
https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/pages/RankPage.ets#L22-L25
c53348ce05773cc4675d3774195ff9691b6688eb
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getYChartMax
Returns the maximum value this chart can display on it's y-axis.
public getYChartMax(): number { return this.mYAxis.mAxisMaximum; }
AST#method_declaration#Left public getYChartMax 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_expr...
public getYChartMax(): number { return this.mYAxis.mAxisMaximum; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L358-L360
d27ac752dfb551b73dbac539423e10d717e23945
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
AI响应接口
export interface AIResponse { message: ChatMessage; intent: IntentResult; suggestions: SuggestedAction[]; followUpQuestions: string[]; context: Partial<ConversationContext>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIResponse AST#object_type#Left { AST#type_member#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left intent : AST#type_annotati...
export interface AIResponse { message: ChatMessage; intent: IntentResult; suggestions: SuggestedAction[]; followUpQuestions: string[]; context: Partial<ConversationContext>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L228-L234
8ef4c6d6808b46e8142561b41a036eab00c935db
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
getCenterCircleBox
returns the center of the circlebox @return
public getCenterCircleBox(): MPPointF { return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY()); }
AST#method_declaration#Left public getCenterCircleBox AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#cal...
public getCenterCircleBox(): MPPointF { return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY()); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L552-L554
11de41bd7481bd3c6bfce22b3e6cd61be212d833
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
decode2048PKCS1Segment
2048位解密-分段 @param decodeStr 待解密的字符串 @param priKey 2048位RSA私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static decode2048PKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, dataCoding, isPem); }
AST#method_declaration#Left static decode2048PKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#...
static decode2048PKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, dataCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L150-L154
98295f14c33e02e9333339dba1da575aa00d9f8b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/ShowToast.ets
arkts
getErrorHint
Obtain the error message. @param error BusinessError.
function getErrorHint(error: BusinessError): string { const mainErrorMessage: string = error.message.split('.').shift() as string; return `${error.code}: ${mainErrorMessage}.`; }
AST#function_declaration#Left function getErrorHint AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS...
function getErrorHint(error: BusinessError): string { const mainErrorMessage: string = error.message.split('.').shift() as string; return `${error.code}: ${mainErrorMessage}.`; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/ShowToast.ets#L11-L14
bec8d5c7dda23408cce134e187a20c546d9ac531
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets
arkts
wrongConcurrentFunc
[Start wrong_1] Sample3.ets
@Concurrent function wrongConcurrentFunc() { let promise = Promise.resolve(); promise.then(() => { try { taskpool.Task.sendData(); } catch (error) { let err = error as BusinessError; hilog.warn(0x000, 'testTag', `sendData failed, code=${err.code}, message=${err.message}`); } }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function wrongConcurrentFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promise = AST#expression#Left AST#cal...
@Concurrent function wrongConcurrentFunc() { let promise = Promise.resolve(); promise.then(() => { try { taskpool.Task.sendData(); } catch (error) { let err = error as BusinessError; hilog.warn(0x000, 'testTag', `sendData failed, code=${err.code}, message=${err.message}`); } }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets#L7-L18
8e8886df0fe02459a4046d5ee2a339f6fc541f39
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/checker/StrictChecker.ets
arkts
严格检测是否有权限。 严格检测指的是不使用系统提供的checkAccessToken、checkAccessTokenSync等方法来检测是否有权限。 而是直接访问相关权限代码,如果没有发生异常,则说明有权限。
export class StrictChecker implements PermissionChecker { hasPermission(permissions: Array<Permissions>): boolean { // 暂时先不使用严格检测 return true } }
AST#export_declaration#Left export AST#class_declaration#Left class StrictChecker AST#implements_clause#Left implements PermissionChecker AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left hasPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#pr...
export class StrictChecker implements PermissionChecker { hasPermission(permissions: Array<Permissions>): boolean { return true } }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/checker/StrictChecker.ets#L9-L15
2c1987b702eb896ac1f51a554eb0ba1aaa1e8317
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/LogService.ets
arkts
log
记录日志
log(level: LogLevel, tag: string, message: string): void { const timestamp = this.getTimestamp(); const logLine = `[${timestamp}] [${level}] [${tag}] ${message}`; // 同时输出到控制台(无论初始化是否成功) switch (level) { case LogLevel.ERROR: console.error(logLine);
AST#method_declaration#Left log AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left LogLevel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#ty...
log(level: LogLevel, tag: string, message: string): void { const timestamp = this.getTimestamp(); const logLine = `[${timestamp}] [${level}] [${tag}] ${message}`; switch (level) { case LogLevel.ERROR: console.error(logLine);
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L117-L124
07e16ec45fd3626b9b9c03653cb101c62923e5a1
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/cs/CsNavigator.ets
arkts
toChat
跳转到客服聊天 @returns {void} 无返回值
static toChat(): void { navigateTo(CsRoutes.Chat); }
AST#method_declaration#Left static toChat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expres...
static toChat(): void { navigateTo(CsRoutes.Chat); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/cs/CsNavigator.ets#L13-L15
12e6d20ee5d32794c9bff74798086fc8e66dc4ba
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets
arkts
closeDialog
关闭全局弹窗
public static closeDialog(result?: DialogInfo) { try { RouterModule._stack.pop(result); } catch (err) { Logger.error(TAG, 'close dialog failed::' + JSON.stringify(err)); } }
AST#method_declaration#Left public static closeDialog AST#parameter_list#Left ( AST#parameter#Left result ? : AST#type_annotation#Left AST#primary_type#Left DialogInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_st...
public static closeDialog(result?: DialogInfo) { try { RouterModule._stack.pop(result); } catch (err) { Logger.error(TAG, 'close dialog failed::' + JSON.stringify(err)); } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets#L86-L93
0544eba558a73ee4318f377ca38c878efc3d78d0
github
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/globals/event.ets
arkts
login
Auth
public async login() { logger.info('AppEvent.login is called') await Sqliter.initUserDatabase() const messages = await this.queryUserMessages() const orders = await this.queryUserOrders() const card = await this.queryUserCard() const user = await this.recentUser() await store.storeMessage...
AST#method_declaration#Left public async login 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#member...
public async login() { logger.info('AppEvent.login is called') await Sqliter.initUserDatabase() const messages = await this.queryUserMessages() const orders = await this.queryUserOrders() const card = await this.queryUserCard() const user = await this.recentUser() await store.storeMessage...
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L15-L35
d86685c154f0a8be2f16dfaa3e5387649d0e058b
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets
arkts
The config is a option of Slider which control speed.
export enum SliderSpeed { MIN = 1, MAX = 10, STEP = 1, };
AST#export_declaration#Left export AST#enum_declaration#Left enum SliderSpeed AST#enum_body#Left { AST#enum_member#Left MIN = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MAX = AST#expression#Left 10 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left STEP = AST#...
export enum SliderSpeed { MIN = 1, MAX = 10, STEP = 1, };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets#L28-L32
c0d5ec1d1567679c24b69783a54824bbb3e0db93
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/attach/PresetAttachHelper.ets
arkts
图片挂件 @description 可自定义挂件,继承IPresetAttachImage接口即可
export interface IPresetAttachImage { width?: Length height?: Length image: ResourceStr margin?: Margin padding?: Padding markAnchor?: Position | LocalizedPosition alignRules?: AlignRuleOption // position?: Position | Edges | LocalizedEdges }
AST#export_declaration#Left export AST#interface_declaration#Left interface IPresetAttachImage AST#object_type#Left { AST#type_member#Left width ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left height ? : AST#type_annot...
export interface IPresetAttachImage { width?: Length height?: Length image: ResourceStr margin?: Margin padding?: Padding markAnchor?: Position | LocalizedPosition alignRules?: AlignRuleOption }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/attach/PresetAttachHelper.ets#L73-L82
e75fb23f21b89aebb4e2387f6c79f48ccb11a346
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
isAxisMinCustom
Returns true if the axis min value has been customized (and is not calculated automatically) @return
public isAxisMinCustom(): boolean { return this.mCustomAxisMin; }
AST#method_declaration#Left public isAxisMinCustom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
public isAxisMinCustom(): boolean { return this.mCustomAxisMin; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L720-L722
201e35aa58fc9bdd3df61f8c5c9bc9386cd362ca
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
buildGroupHeader
构建美观的分组标题
@Builder buildGroupHeader(letter: string) { Row() { // 字母圆圈 Row() { Text(letter) .fontSize(16) .fontColor('#FFFFFF') .fontWeight(FontWeight.Bold) } .width(32) .height(32) .backgroundColor('#4A90E2') .borderRadius(16) .justifyCon...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGroupHeader AST#parameter_list#Left ( AST#parameter#Left letter : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b...
@Builder buildGroupHeader(letter: string) { Row() { Row() { Text(letter) .fontSize(16) .fontColor('#FFFFFF') .fontWeight(FontWeight.Bold) } .width(32) .height(32) .backgroundColor('#4A90E2') .borderRadius(16) .justifyContent(Fl...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L908-L957
ee9900b892a081b8a48fdf194809ff1b5ebb2794
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
set_global_custom_UA
UA Stuff Sets the custom user agent of all tabs. Resets the custom user agent to ArkWeb default if param is "" (empty). @param ua A string, the user agent params.
set_global_custom_UA(ua: string) { // Reset default if no input if (ua == "") { this.reset_global_custom_UA(); console.log("[bunch_of_tabs][UA] Reset global_custom_UA to ArkWeb default! ua: " + this.get_global_default_UA()) return; } for (let index = 0; index < this.Tabs.length; index...
AST#method_declaration#Left set_global_custom_UA AST#parameter_list#Left ( AST#parameter#Left ua : 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 { // Reset default if no input AST#statement#L...
set_global_custom_UA(ua: string) { if (ua == "") { this.reset_global_custom_UA(); console.log("[bunch_of_tabs][UA] Reset global_custom_UA to ArkWeb default! ua: " + this.get_global_default_UA()) return; } for (let index = 0; index < this.Tabs.length; index++) { this.Tabs[index]...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L162-L174
9d185f8537ea5ee1465ef39f71730dc0bb5c0812
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
首页数据接口
export interface HomePageData { userId: number; username: string; nickname: string; avatar: string; signature: string; dreamStats: DreamStats; todayTasks: PageResponse<Task>; upcomingTasks: PageResponse<Task>; recentDreams: Dream[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface HomePageData AST#object_type#Left { AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation...
export interface HomePageData { userId: number; username: string; nickname: string; avatar: string; signature: string; dreamStats: DreamStats; todayTasks: PageResponse<Task>; upcomingTasks: PageResponse<Task>; recentDreams: Dream[]; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L243-L253
35ff66cdb2e38bc2bb6311e4b2fa3a5b7c7578f2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/TabBarAttribute.ets
arkts
自定义页签条属性
export class TabBarAttribute { // 页签项宽度 private innerBarItemWidth: Length | undefined; // 页签条边缘滑动效果 private innerBarEdgeEffect: EdgeEffect; // 页签条高度 private innerBarHeight: Length | undefined; // 是否可以滚动页签条(false则所有页签均分屏幕宽度) private innerScrollable: boolean; // 页签条位置 private innerBarVertical: BarPosi...
AST#export_declaration#Left export AST#class_declaration#Left class TabBarAttribute AST#class_body#Left { // 页签项宽度 AST#property_declaration#Left private innerBarItemWidth : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type...
export class TabBarAttribute { private innerBarItemWidth: Length | undefined; private innerBarEdgeEffect: EdgeEffect; private innerBarHeight: Length | undefined; private innerScrollable: boolean; private innerBarVertical: BarPosition; private innerBarMargin: Margin | undefined; privat...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/TabBarAttribute.ets#L21-L76
b836d5a60b3609fc7fa1108c858d9394e5e27c5b
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/observe/IObservedData.ets
arkts
弹窗Observed数据 基础接口定义
export interface IObservedData { // dialogTheme: BaseDialogTheme dialogId?: string /** * 内部监听弹窗是否显示 */ _isShowing?: boolean; //TODO: 这边添加 尺寸变化?? /** * 尺寸变化 */ breakpoint?: 'xs' | 'md' | 'lg' }
AST#export_declaration#Left export AST#interface_declaration#Left interface IObservedData AST#object_type#Left { // dialogTheme: BaseDialogTheme AST#type_member#Left dialogId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * 内部监听弹窗是...
export interface IObservedData { dialogId?: string _isShowing?: boolean; breakpoint?: 'xs' | 'md' | 'lg' }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/observe/IObservedData.ets#L4-L17
abb843a61c7c40cf3ab47bda535aea16360bb4d2
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/views/StateComponent.ets
arkts
holdContent
占位组件
@Builder holdContent() { if (this.showSkeleton && this.viewState == ViewStateConstant.VIEW_STATE_LOADING) { CommonSkeleton() } else { Column() { Image(this.convertImage()) .width($r('app.float.size_100')) .height($r('app.float.size_100')) Text(this.convertValue(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right holdContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#L...
@Builder holdContent() { if (this.showSkeleton && this.viewState == ViewStateConstant.VIEW_STATE_LOADING) { CommonSkeleton() } else { Column() { Image(this.convertImage()) .width($r('app.float.size_100')) .height($r('app.float.size_100')) Text(this.convertValue(...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/StateComponent.ets#L27-L53
e8f469a8ef8efa310d8f5be118120fa1028e2f5d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
switchLanguage
切换语言
private async switchLanguage(language: SupportedLanguage): Promise<void> { try { await this.i18nManager.switchLanguage(language); this.currentLanguage = language; // 重新加载推荐语言 this.detectedLanguages = await this.languageDetector.recommendLanguages(this.currentLanguage); hi...
AST#method_declaration#Left private async switchLanguage AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le...
private async switchLanguage(language: SupportedLanguage): Promise<void> { try { await this.i18nManager.switchLanguage(language); this.currentLanguage = language; this.detectedLanguages = await this.languageDetector.recommendLanguages(this.currentLanguage); hilog.info(Lo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L578-L590
9777405d181df48fe87f66d0ed99e638962e483b
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q1/grammar/entry/src/main/ets/pages/StateManagement.ets
arkts
StateManagement_textSty
同样的样式记得复用 text
@Extend(Text) function StateManagement_textSty() { .fontSize(30) .fontWeight(FontWeight.Bold) .fontColor(Color.Green) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function StateManagement_textSty AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#L...
@Extend(Text) function StateManagement_textSty() { .fontSize(30) .fontWeight(FontWeight.Bold) .fontColor(Color.Green) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/StateManagement.ets#L59-L63
b6bcead3538165501bad2d11799a40bfe70834bf
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/TaskConfig.ets
arkts
setHardwareDecoder
默认不重试
public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder { this.useHardwareDecoder = useHardwareDecoder; return this; }
AST#method_declaration#Left public setHardwareDecoder AST#parameter_list#Left ( AST#parameter#Left useHardwareDecoder : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder { this.useHardwareDecoder = useHardwareDecoder; return this; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskConfig.ets#L56-L59
3d7afc3c641035d786475ccda71b7cde72efee9d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.DialogV2.d.ets
arkts
SelectDialogV2
Declare CustomDialog SelectDialogV2 @struct { SelectDialogV2 } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@ComponentV2 export declare struct SelectDialogV2 { /** * Sets the SelectDialogV2 title. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Require @Param title: ResourceStr; /** * Sets the SelectDialogV2 content....
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SelectDialogV2 AST#component_body#Left { /** * Sets the SelectDialogV2 title. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplat...
@ComponentV2 export declare struct SelectDialogV2 { @Require @Param title: ResourceStr; @Param content?: ResourceStr; @Param selectedIndex?: number; @Param confirm?: AdvancedDialogV2Button; @Require @Param radioContent: SheetInfo[]; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L398-L456
80771b7f90ae9e2eb98bbdd005af91d3d35f6aab
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/model/WeekCalendarModel.ets
arkts
每日结余
constructor(weekTitle: string, dateStr: string, date: Date) { this.weekTitle = weekTitle; this.dateStr = dateStr; this.date = date; this.accountingList = []; this.dayInfo = new DayInfo(dateStr, 0 , 0); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left weekTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
constructor(weekTitle: string, dateStr: string, date: Date) { this.weekTitle = weekTitle; this.dateStr = dateStr; this.date = date; this.accountingList = []; this.dayInfo = new DayInfo(dateStr, 0 , 0); }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/model/WeekCalendarModel.ets#L12-L18
449125008aded1c10994c8884e74d40ab145fa20
github
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/data/customUiData.ets
arkts
@Observed
export class CustomUiInfo { width: number; height: number; showUi: boolean; x: number; y: number; offsetLeft: number; offsetRight: number; data: EntryOhos | null; isInbounds: boolean; constructor( width: number, height: number, showUi: boolean = false, x: number = 0, y: number =...
AST#export_declaration#Left export AST#class_declaration#Left class CustomUiInfo AST#class_body#Left { AST#property_declaration#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left height : AST#...
export class CustomUiInfo { width: number; height: number; showUi: boolean; x: number; y: number; offsetLeft: number; offsetRight: number; data: EntryOhos | null; isInbounds: boolean; constructor( width: number, height: number, showUi: boolean = false, x: number = 0, y: number =...
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/data/customUiData.ets#L19-L51
3839663e03ef98bd1485a55841b8907e57958d4b
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/Unicode.ets
arkts
Character codes and comments source: https://www.w3.org/International/questions/qa-bidi-unicode-controls#basedirection
export class UnicodeCtrlChar { /** Sets base direction to LTR and isolates the embedded content from the surrounding text */ static LeftToRightIsolate: string = "\u2066"; /** Sets base direction to RTL and isolates the embedded content from the surrounding text */ static RightToLeftIsolate: string = "\u2067"; ...
AST#export_declaration#Left export AST#class_declaration#Left class UnicodeCtrlChar AST#class_body#Left { /** Sets base direction to LTR and isolates the embedded content from the surrounding text */ AST#property_declaration#Left static LeftToRightIsolate : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
export class UnicodeCtrlChar { static LeftToRightIsolate: string = "\u2066"; static RightToLeftIsolate: string = "\u2067"; static FirstStrongIsolate: string = "\u2068"; static PopDirectionalIsolate: string = "\u2069"; static Matcher: RegExp = new RegExp(`[${UnicodeCtrlChar.LeftToRightIsolate}$...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Unicode.ets#L5-L19
1d95d03a8a7dd5a2fc5167164f7ce297da72ff8c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
startSideBarUnlockTimer
启动侧边栏联动解锁计时器 @param {number} targetIndex - 目标索引 @returns {void} 无返回值
private startSideBarUnlockTimer(targetIndex: number): void { this.clearSideBarUnlockTimer(); const duration: number = this.calculateUnlockDuration(targetIndex); this.sideBarUnlockTimer = setTimeout((): void => { this.finishSideBarScroll(); this.sideBarUnlockTimer = -1; }, duration); }
AST#method_declaration#Left private startSideBarUnlockTimer AST#parameter_list#Left ( AST#parameter#Left targetIndex : 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 vo...
private startSideBarUnlockTimer(targetIndex: number): void { this.clearSideBarUnlockTimer(); const duration: number = this.calculateUnlockDuration(targetIndex); this.sideBarUnlockTimer = setTimeout((): void => { this.finishSideBarScroll(); this.sideBarUnlockTimer = -1; }, duration); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L156-L163
3bc22c35a8eee06542e32302e79fefae6a4762b7
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AbilityUtils.ets
arkts
toNfcSetting
跳转NFC设置页面
static toNfcSetting(): Promise<void> { return AbilityUtils.toAppSetting(AbilityUtils.uri_nfc) }
AST#method_declaration#Left static toNfcSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
static toNfcSetting(): Promise<void> { return AbilityUtils.toAppSetting(AbilityUtils.uri_nfc) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L59-L61
9541a43afad5b7b9cb25f04677cbdf57e191e48a
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
arkts
createDbsIfNeeds
MARK: - 数据库初始化
private createDbsIfNeeds(): void { if (!this.db) return; // 创建声音表 const sql = `CREATE TABLE IF NOT EXISTS "${Tables.CSound.name}" ( "${Tables.CSound.Col.idxx}" INTEGER PRIMARY KEY AUTOINCREMENT, "${Tables.CSound.Col.lang}" TEXT, "${Tables.CSound.Col.text}" TEXT, "${Tables.CSound.Col...
AST#method_declaration#Left private createDbsIfNeeds 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_statement#Left if ( AST#expression#Left AST#member_express...
private createDbsIfNeeds(): void { if (!this.db) return; const sql = `CREATE TABLE IF NOT EXISTS "${Tables.CSound.name}" ( "${Tables.CSound.Col.idxx}" INTEGER PRIMARY KEY AUTOINCREMENT, "${Tables.CSound.Col.lang}" TEXT, "${Tables.CSound.Col.text}" TEXT, "${Tables.CSound.Col.data}" ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L53-L66
61cd9526f277a4ca965c920cd7e6d539cb2f386f
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/common/XiaoXunConstants.ets
arkts
首页目录信息配置数组
export const MenuList: HMenuItem[] = [ { id: 0, bgImg: $r("app.media.xf_list01"), title: '通义千问', desc:'内容生成、聊天对话', url:'pages/TongYiPage', welcomeMessage:'主人好,我是小讯百问智能助理,你的贴心小助手~', inputTextPlaceHolder:'请输入您想问的问题吧~' }, { id: 1, bgImg: $r("app.media.xf_list02"), title: '文心一言...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MenuList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HMenuItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#express...
export const MenuList: HMenuItem[] = [ { id: 0, bgImg: $r("app.media.xf_list01"), title: '通义千问', desc:'内容生成、聊天对话', url:'pages/TongYiPage', welcomeMessage:'主人好,我是小讯百问智能助理,你的贴心小助手~', inputTextPlaceHolder:'请输入您想问的问题吧~' }, { id: 1, bgImg: $r("app.media.xf_list02"), title: '文心一言...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/common/XiaoXunConstants.ets#L5-L33
1050491374d7f5d4bd9b44cc2527dcde04711620
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets
arkts
map对象,key为componentId,value为SearchNodeController
build() { Stack() { // 性能知识点:此处componentId项确定且数量较少,使用了ForEach,在数据量多的情况下,推荐使用LazyForeEach。[LazyForeEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-rendering-control-lazyforeach-0000001820879609) ForEach(this.componentIdArr, (componentId: string) => { NodeContainer(this.n...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { // 性能知识点:此处componentId项确定且数量较少,使用了ForEach,在数据量多的情况下,推荐使用LazyForeEach。[LazyForeEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-...
build() { Stack() { ForEach(this.componentIdArr, (componentId: string) => { NodeContainer(this.nodeControllerMap.get(componentId)); }, (embedId: string) => embedId) Web({ src: $rawfile("nativeembed_view.html"), controller: this.browserTabController }) .backgroundColor...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets#L205-L259
13f8750edd62406abeba023e088a47b1be5d051a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoHelper.ets
arkts
strToUint8Array
字符串转Uint8Array @param symKey 字符串 @param coding 编码方式(base64/hex/utf8/utf-8)。 @param keyLen 密钥规格的最小长度,默认为0,为0时不补全。 @returns
static strToUint8Array(str: string, coding: crypto.BhuCoding, keyLen: number = 0): Uint8Array { if (coding === 'base64') { //base64 let uint8Array = Base64Util.decodeSync(str); uint8Array = CryptoHelper.getUint8ArrayPaddingZero(uint8Array, keyLen) return uint8Array; } else if (coding === 'hex'...
AST#method_declaration#Left static strToUint8Array AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type...
static strToUint8Array(str: string, coding: crypto.BhuCoding, keyLen: number = 0): Uint8Array { if (coding === 'base64') { let uint8Array = Base64Util.decodeSync(str); uint8Array = CryptoHelper.getUint8ArrayPaddingZero(uint8Array, keyLen) return uint8Array; } else if (coding === 'hex') { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L61-L75
497d38fb898f35f60d1dfb71fb5500cd26ce68fe
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/login/LoginView.ets
arkts
shakeCheckAgree
MARK: - 登录相关方法
private shakeCheckAgree(){ bounce({set:(x,y) => { this.checkAgreeShakeOffsetX = x },isHorizontal: true, onFinished: () => { }}) }
AST#method_declaration#Left private shakeCheckAgree 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 bounce ( AST#component_parameters#Left { AST#component_parameter#Left set : AST#expression#Left AST...
private shakeCheckAgree(){ bounce({set:(x,y) => { this.checkAgreeShakeOffsetX = x },isHorizontal: true, onFinished: () => { }}) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LoginView.ets#L256-L258
8241207a11e2603ecfa6ef58dd8f988a9b734501
github
Hyricane/meikou-mall.git
ae4c2482ba82b78e684de213a4f33aad9af076c5
commons/basic/src/main/ets/utils/Request.ets
arkts
实例化 通用配置
export const axiosInstance = axios.create({ baseURL: 'https://meikou-api.itheima.net/', timeout: 20000 }) // 后端返回的数据格式 code, msg, result interface HttpResponse<T> { code: string msg: string result: T } // AxiosResponse 是 axios 响应类型
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left axiosInstance = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Lef...
export const axiosInstance = axios.create({ baseURL: 'https://meikou-api.itheima.net/', timeout: 20000 }) interface HttpResponse<T> { code: string msg: string result: T }
https://github.com/Hyricane/meikou-mall.git/blob/ae4c2482ba82b78e684de213a4f33aad9af076c5/commons/basic/src/main/ets/utils/Request.ets#L4-L16
44192aa6eeb032691046b3159e1cedff9351e9e3
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setValueFormatter
Sets the formatter to be used for formatting the axis labels. If no formatter is set, the chart will automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart. @param f
public setValueFormatter(f: IAxisValueFormatter): void { if (!f || f == null) { this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals); } else { this.mAxisValueFormatter = f; } }
AST#method_declaration#Left public setValueFormatter AST#parameter_list#Left ( AST#parameter#Left f : AST#type_annotation#Left AST#primary_type#Left IAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void A...
public setValueFormatter(f: IAxisValueFormatter): void { if (!f || f == null) { this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals); } else { this.mAxisValueFormatter = f; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L529-L535
a68381c3c78daa0de6a8f41ba56c31e9edc43b33
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/graphic/DisplaySoloist/entry/src/main/ets/pages/Index.ets
arkts
[End display_soloist_disappear] [EndExclude display_soloist_create_xcomponent]
build() { Column() { Row() { // [StartExclude display_soloist_create_xcomponent] Text('30fps') .fontWeight(FontWeight.Bold) .fontSize(12) .fontColor(Color.Red) .textAlign(TextAlign.End) .width(40) .height(30) // [EndExclude di...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // [StartExcl...
build() { Column() { Row() { Text('30fps') .fontWeight(FontWeight.Bold) .fontSize(12) .fontColor(Color.Red) .textAlign(TextAlign.End) .width(40) .height(30) XComponent({ id: 'xcomponentId_30', ty...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/graphic/DisplaySoloist/entry/src/main/ets/pages/Index.ets#L43-L132
b6ea450c2427bc66b502185f98a96bfaceaa0557
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentstack/Index.ets
arkts
ComponentStackComponent
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 { ComponentStackComponent } from "./src/main/ets/view/ComponentStack";
AST#export_declaration#Left export { ComponentStackComponent } from "./src/main/ets/view/ComponentStack" ; AST#export_declaration#Right
export { ComponentStackComponent } from "./src/main/ets/view/ComponentStack";
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/Index.ets#L17-L17
290c200c723cfe88b46da262382563da6f29397e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
代办事项搜索结果
export interface TodoSearchResult { todos: Todo[]; total: number; page: number; pageSize: number; totalPages: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TodoSearchResult AST#object_type#Left { AST#type_member#Left todos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Todo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#t...
export interface TodoSearchResult { todos: Todo[]; total: number; page: number; pageSize: number; totalPages: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L99-L105
e1ff58157cd3af798653687cc3ea7c889539ab8c
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
setZoom
Sets the scale factor to the specified values. @param scaleX @param scaleY @return
public setZoom(scaleX: number, scaleY: number, x?: number, y?: number): Matrix { var save: Matrix = new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && y != undefined) { save.setScale(scaleX, scaleY, x, y); } else { save.setScale(scaleX, scaleY); } retu...
AST#method_declaration#Left public setZoom AST#parameter_list#Left ( AST#parameter#Left scaleX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left scaleY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
public setZoom(scaleX: number, scaleY: number, x?: number, y?: number): Matrix { var save: Matrix = new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && y != undefined) { save.setScale(scaleX, scaleY, x, y); } else { save.setScale(scaleX, scaleY); } retu...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L248-L258
0881c6085ebc38ac36c5d922921378d2879d7f55
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/MockDataService.ets
arkts
getTasks
获取任务列表
static getTasks(): Task[] { return [ { id: '1', title: '完成首页开发', description: '实现首页UI和交互逻辑', status: 'in_progress', assignee: '开发者A', dueDate: '2025-12-25' }, { id: '2', title: '优化网络请求', description: '优化网络请求性能和错误处理', s...
AST#method_declaration#Left static getTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Task [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ret...
static getTasks(): Task[] { return [ { id: '1', title: '完成首页开发', description: '实现首页UI和交互逻辑', status: 'in_progress', assignee: '开发者A', dueDate: '2025-12-25' }, { id: '2', title: '优化网络请求', description: '优化网络请求性能和错误处理', s...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L402-L429
d975b971c2892fa293fd6581ffeafe8ea4def8fb
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
编辑记录管理器
export class EditRecordManager { /** * 操作记录栈,用于回退操作 */ private operateRecords: Array<OperateRecord> = new Array(); /** * 操作记录数据是否存在记录监听,用于通知外部刷新撤销按钮颜色状态 */ private recordsMonitor: (exist: boolean) => void; constructor(recordsMonitor: (exist: boolean) => void) { this.recordsMonitor = recordsMo...
AST#export_declaration#Left export AST#class_declaration#Left class EditRecordManager AST#class_body#Left { /** * 操作记录栈,用于回退操作 */ AST#property_declaration#Left private operateRecords : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST...
export class EditRecordManager { private operateRecords: Array<OperateRecord> = new Array(); private recordsMonitor: (exist: boolean) => void; constructor(recordsMonitor: (exist: boolean) => void) { this.recordsMonitor = recordsMonitor; } addCropRecord(crop: CropData): void { this.addRecord...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L52-L166
9f426a25f6fc1601da64a502392cb258dc99f965
gitee
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/ 分类列表
export const URL_SORT_LIST_NEW = baseUrl + '/item/list.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left URL_SORT_LIST_NEW = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/item/list.json' AST#expression#Right AST#binary_expression#Right AST#expression#...
export const URL_SORT_LIST_NEW = baseUrl + '/item/list.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L52-L52
29e2aa42bcb98a520fbad0225f8a53954b41e98a
github
yinxing2008/blog_hongmeng_ArkUI.git
7db4c777d9240a46eaf7348e55ccf73c238445fa
entry/src/main/ets/data/Blog.ets
arkts
厦门大学计算机专业 | 前华为工程师 专注《零基础学编程系列》 http://lblbc.cn/blog 包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙 公众号:蓝不蓝编程
export class Blog { private id: number; private title: string = ''; private content: string = ''; public getId() { return this.id } public setId(id: number) { this.id = id } public getTitle() { return this.title } public setTitle(title: string) { this.title = title } public ...
AST#export_declaration#Left export AST#class_declaration#Left class Blog AST#class_body#Left { AST#property_declaration#Left private id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private title : ...
export class Blog { private id: number; private title: string = ''; private content: string = ''; public getId() { return this.id } public setId(id: number) { this.id = id } public getTitle() { return this.title } public setTitle(title: string) { this.title = title } public ...
https://github.com/yinxing2008/blog_hongmeng_ArkUI.git/blob/7db4c777d9240a46eaf7348e55ccf73c238445fa/entry/src/main/ets/data/Blog.ets#L7-L35
316fc2b60cf56304224a62c6f947aafe96aec046
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets
arkts
MembershipCard
会员权益卡片
@Builder MembershipCard() { Row({ space: AppDimensions.spaceMedium }) { Row({ space: AppDimensions.spaceSmall }) { Text('👑') .fontSize(18) Text('5 VIP Benefits!') .fontSize(AppTypography.fontSizeMedium) .fontColor(AppColors.vip) .fontWeight(AppTypogr...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MembershipCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_paramet...
@Builder MembershipCard() { Row({ space: AppDimensions.spaceMedium }) { Row({ space: AppDimensions.spaceSmall }) { Text('👑') .fontSize(18) Text('5 VIP Benefits!') .fontSize(AppTypography.fontSizeMedium) .fontColor(AppColors.vip) .fontWeight(AppTypogr...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets#L87-L121
37d2e0d35fe53ff5fd614d4724d2ea7605f34670
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
performSearch
执行搜索
private async performSearch(keyword: string): Promise<void> { try { this.loading = true; // 并行搜索联系人和祝福语 const searchResults = await Promise.all([ this.searchContacts(keyword), this.searchGreetings(keyword) ]); const contacts = searchResults[0]; const greeti...
AST#method_declaration#Left private async performSearch AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
private async performSearch(keyword: string): Promise<void> { try { this.loading = true; const searchResults = await Promise.all([ this.searchContacts(keyword), this.searchGreetings(keyword) ]); const contacts = searchResults[0]; const greetings = searchRe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L108-L134
0ee21f3befe0f516608eb9bd98f5eb98f3faf132
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
features/harA/src/main/ets/components/LoginPage.ets
arkts
LoginPage
@author: HZWei @date: 2024/7/18 @desc:
@Preview @Route() @Component export struct LoginPage{ aboutToAppear(): void { console.log('LoginPage aboutToAppear') } aboutToDisappear(): void { console.log('LoginPage aboutToDisappear') } build() { NavDestination(){ Column({space:15}){ Button('填写登录验证码').onClick((event: ClickE...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Route ( ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct LoginPage AST#component_body#Left { AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#paramet...
@Preview @Route() @Component export struct LoginPage{ aboutToAppear(): void { console.log('LoginPage aboutToAppear') } aboutToDisappear(): void { console.log('LoginPage aboutToDisappear') } build() { NavDestination(){ Column({space:15}){ Button('填写登录验证码').onClick((event: ClickE...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/LoginPage.ets#L10-L47
cc23b9b00fbd4062d4111603d6450c14ff200673
gitee
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/common/utils/FileManager.ets
arkts
getAllFilesWithInfo
修改 getAllFilesWithInfo 方法
async getAllFilesWithInfo(): Promise<FileInfo[]> { try { const filesDir = this.getFilesDir(); console.log(`[getAllFilesWithInfo] 读取目录: ${filesDir}`); // 使用 fileIo 而不是 fs(与 getAllFiles 保持一致) const files = fileIo.listFileSync(filesDir); console.log(`[getAllFilesWithInfo] 找到文件: ${files.l...
AST#method_declaration#Left async getAllFilesWithInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FileInfo [ ] AST#array_type#Right AST#pri...
async getAllFilesWithInfo(): Promise<FileInfo[]> { try { const filesDir = this.getFilesDir(); console.log(`[getAllFilesWithInfo] 读取目录: ${filesDir}`); const files = fileIo.listFileSync(filesDir); console.log(`[getAllFilesWithInfo] 找到文件: ${files.length} 个`); const fileInfos: Fil...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L159-L215
791b0328fc8493931f7dc20c100a18f492b541bd
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/entryability/EntryAbility.ets
arkts
registerRouter
注册路由
registerRouter(): void { new MainGraph().register(); new AuthGraph().register(); new UserGraph().register(); new DemoGraph().register(); }
AST#method_declaration#Left registerRouter 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...
registerRouter(): void { new MainGraph().register(); new AuthGraph().register(); new UserGraph().register(); new DemoGraph().register(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L94-L99
40367392dc1a323c3e3c37757b8b1be05d02561b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
setGrayScale
设置灰阶,APP一键置灰。 @param grayScale 该参数为浮点数,取值范围为[0.0, 1.0]。 @param onlyMainWindow 是否只置灰主窗口,默认false。 @returns
static async setGrayScale(grayScale: number = 1.0, onlyMainWindow: boolean = false): Promise<void> { AppUtil.getMainWindow().setWindowGrayScale(grayScale); if (!onlyMainWindow) { let subWindows = await AppUtil.getContext().windowStage.getSubWindow(); if (subWindows && subWindows.length > 0) { ...
AST#method_declaration#Left static async setGrayScale AST#parameter_list#Left ( AST#parameter#Left grayScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.0 AST#expression#Right AST#parameter#Right , AST#parameter#Left onlyMainWindow : A...
static async setGrayScale(grayScale: number = 1.0, onlyMainWindow: boolean = false): Promise<void> { AppUtil.getMainWindow().setWindowGrayScale(grayScale); if (!onlyMainWindow) { let subWindows = await AppUtil.getContext().windowStage.getSubWindow(); if (subWindows && subWindows.length > 0) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L125-L133
a4fa3607fc289be85af6b661be03fb4066f28a46
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
decrypt
解密,异步 @param data 加密或者解密的数据。data不能为null。 @param key 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。 @returns
static async decrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, key, ...
AST#method_declaration#Left static async decrypt 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 key : ...
static async decrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, key, ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L70-L76
50c5159fc142692cb50b91bef664f5f0015d0635
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
SingleCodeLayout
单个二维码的位置图片
@Builder SingleCodeLayout() { Column() { Image($rawfile('scan_selected.svg')) // TODO: 知识点: 在扫描结果返回的水平坐标和纵坐标位置上展示图片 .selected(true, this.singleCodeX, this.singleCodeY) .scale({ x: this.singleCodeScale, y: this.singleCodeScale }) .opacity(this.singleCodeOpacity) .onApp...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SingleCodeLayout 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...
@Builder SingleCodeLayout() { Column() { Image($rawfile('scan_selected.svg')) .selected(true, this.singleCodeX, this.singleCodeY) .scale({ x: this.singleCodeScale, y: this.singleCodeScale }) .opacity(this.singleCodeOpacity) .onAppear(() => { this.singleCode...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L112-L127
85a1a1b27b89c84480bb7856d36e62c9e3d59fec
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/cache/CacheUtil.ets
arkts
const
@Author csx @DateTime 2024/2/22 11:21:02 @TODO CacheUtil 缓存工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core
export namespace CacheUtil { /** * 私有缓存对象 */ const cache: Record<string, Object> = {};
AST#export_declaration#Left export AST#ERROR#Left namespace CacheUtil AST#ERROR#Right { /** * 私有缓存对象 */ const AST#ERROR#Left cache : Record < string AST#ERROR#Right , Object AST#ERROR#Left > = { AST#ERROR#Right } ; AST#export_declaration#Right
export namespace CacheUtil { const cache: Record<string, Object> = {};
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/CacheUtil.ets#L23-L28
11fcd87e2b786fde797d79647b77dbca900725b7
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/ZhuCePage.ets
arkts
registerUser
注册用户方法
async registerUser() { if (!this.account || !this.password) { console.error('账号和密码不能为空'); promptAction.showToast({ message: '账号和密码不能为空', duration: 2000 }); return; } try { let httpRequest = http.createHttp(); let response = await httpRequest.request( this.serverUrl + "...
AST#method_declaration#Left async registerUser AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#ex...
async registerUser() { if (!this.account || !this.password) { console.error('账号和密码不能为空'); promptAction.showToast({ message: '账号和密码不能为空', duration: 2000 }); return; } try { let httpRequest = http.createHttp(); let response = await httpRequest.request( this.serverUrl + "...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/ZhuCePage.ets#L184-L229
ce042e467cdae149598ae5f560ac84038c4db842
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
runJavaScriptFun
异步执行JavaScript方法 @param webController @param funName 方法名 @param param 方法参数 @returns
static async runJavaScriptFun(webController: webview.WebviewController, funName: string, param?: string): Promise<string> { if (param) { return ArkWebHelper.runJavaScript(webController, `${funName}('${param}')`); } else { return ArkWebHelper.runJavaScript(webController, `${funName}()`); } }
AST#method_declaration#Left static async runJavaScriptFun AST#parameter_list#Left ( AST#parameter#Left webController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#pa...
static async runJavaScriptFun(webController: webview.WebviewController, funName: string, param?: string): Promise<string> { if (param) { return ArkWebHelper.runJavaScript(webController, `${funName}('${param}')`); } else { return ArkWebHelper.runJavaScript(webController, `${funName}()`); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L92-L98
2c4f0618761d50076965313547272ea2f1f994d0
gitee
charon2pluto/MoodDiary-HarmonyOS.git
0ec7ee6861e150bc9b4571062dbf302d1b106b8c
entry/src/main/ets/model/MoodData.ets
arkts
文件位置: entry/src/main/ets/model/MoodData.ets
export default class MoodData { id: number | null = null; userId: number; // ★ 新增:用户ID date: number; // 记录日期的时间戳 moodType: number; // 心情类型 moodScore: number; // 心情强度 reason: string; // 简短原因 diaryContent: string; // 日记正文 images: string; // 图片路径 // ★ 修改:构造函数增加 userId 参数...
AST#export_declaration#Left export default AST#class_declaration#Left class MoodData AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type...
export default class MoodData { id: number | null = null; userId: number; date: number; moodType: number; moodScore: number; reason: string; diaryContent: string; images: string; constructor(id: number, userId: number, date: number, moodType: number, moodSco...
https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/model/MoodData.ets#L2-L23
4ee5fa7d0b4303d1e393397b07b9bfa581ba5ff1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
readSync
从文件读取数据,以同步方法。 @param fd number 已打开的文件描述符。 @param buffer ArrayBuffer 用于保存读取到的文件数据的缓冲区。 @param options 支持如下选项: offset,number类型,表示期望读取文件的位置。可选,默认从当前位置开始读。 length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度。 @returns
static readSync(fd: number, buffer: ArrayBuffer, options?: ReadOptions): number { return fs.readSync(fd, buffer, options) }
AST#method_declaration#Left static readSync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_ty...
static readSync(fd: number, buffer: ArrayBuffer, options?: ReadOptions): number { return fs.readSync(fd, buffer, options) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L438-L440
aad5638dff8134552fe681fcf04ada8a28d2b61e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsDetailTopBar.ets
arkts
构建商品详情顶部导航栏 @returns {void} 无返回值
build(): void { Stack({ alignContent: Alignment.TopStart }) { Column() { if (this.topInset > 0) { Blank().height(this.topInset); } this.TopBarRow(false); } .width(P100) .backgroundColor($r("app.color.bg_white")) .opacity(this.getBackgroundOpacity()) ...
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 Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignConten...
build(): void { Stack({ alignContent: Alignment.TopStart }) { Column() { if (this.topInset > 0) { Blank().height(this.topInset); } this.TopBarRow(false); } .width(P100) .backgroundColor($r("app.color.bg_white")) .opacity(this.getBackgroundOpacity()) ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailTopBar.ets#L42-L62
650ca1206bdd5d0d6add65bcdb4f6fc9799c130c
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/GridItemDrag.ets
arkts
GridItemDrag
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct GridItemDrag { @State numbers: string[] = Array.from({ length: 15 }, (item: string, i: number) => i.toString()); @State dragIndex: number = -1 // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder(item: string) { Text(item) .fontSize(16) .width(80) .height(60) .backgrou...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridItemDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right numbers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_typ...
@Component export struct GridItemDrag { @State numbers: string[] = Array.from({ length: 15 }, (item: string, i: number) => i.toString()); @State dragIndex: number = -1 @Builder pixelMapBuilder(item: string) { Text(item) .fontSize(16) .width(80) .height(60) .backgroundColor(0xF9CF93...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/GridItemDrag.ets#L16-L68
e58d1478e6e273a29bf4e6f103637432cf06af4c
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/MediaTools.ets
arkts
fill
日期不足两位补 0 @param {string} value - 数据值 @return {string} - 日期不足两位补 0
private static fill(value: number): string { return value.toString().padStart(2, '0'); }
AST#method_declaration#Left private static fill AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
private static fill(value: number): string { return value.toString().padStart(2, '0'); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/MediaTools.ets#L43-L45
f00c21a9719fb434532b3e9bb7748a663b5192be
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets
arkts
red
from Color red() @param color
public static red(color: number): number { return (color >> 16) & 0xff; }
AST#method_declaration#Left public static red AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
public static red(color: number): number { return (color >> 16) & 0xff; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets#L268-L270
270ff0ce32736fcf8986a207c3dc190c1443c738
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/LocationUtil.ets
arkts
@Author csx @DateTime 2024/4/10 23:26 @TODO LocationUtil 位置工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
export class LocationUtil { /** * 获取当前精准定位定位-需要APPROXIMATELY_LOCATION和LOCATION权限 * @returns geoLocationManager.Location 对象 */ private static async getCurrentLocation(): Promise<geoLocationManager.Location> { //解析定位 let current = await geoLocationManager.getCurrentLocation({ scenario: geoLocat...
AST#export_declaration#Left export AST#class_declaration#Left class LocationUtil AST#class_body#Left { /** * 获取当前精准定位定位-需要APPROXIMATELY_LOCATION和LOCATION权限 * @returns geoLocationManager.Location 对象 */ AST#method_declaration#Left private static async getCurrentLocation AST#parameter_list#Left ( ) AST#parameter_...
export class LocationUtil { private static async getCurrentLocation(): Promise<geoLocationManager.Location> { let current = await geoLocationManager.getCurrentLocation({ scenario: geoLocationManager.LocationRequestScenario.DAILY_LIFE_SERVICE, maxAccuracy: 0, timeoutMs: 1000 }); r...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/LocationUtil.ets#L28-L135
379246cc66df1cdd03a4cd962e47afafc827ada3
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
Message
========== 核心模块 ========== Message 基类和相关类型 所有生成的消息类都继承自 Message
export { Message, MessageConstructor } from './Message'
AST#export_declaration#Left export { Message , MessageConstructor } from './Message' AST#export_declaration#Right
export { Message, MessageConstructor } from './Message'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L30-L30
330cad5bb969e6c6b6e0f284eb9587b8b5099c49
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/DatabaseService.ets
arkts
update
更新数据 @param tableName 表名 @param data 更新的数据对象 @param whereClause 条件子句 @param whereArgs 条件参数 @returns 受影响的行数
async update(tableName: string, data: Record<string, relationalStore.ValueType>, whereClause?: string, whereArgs?: Array<string>): Promise<number> { try { this.checkInitialized(); const valueBucket: relationalStore.ValuesBucket = {}; const dataEntries: [string, relationalStore.ValueType][] ...
AST#method_declaration#Left async update 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 data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Re...
async update(tableName: string, data: Record<string, relationalStore.ValueType>, whereClause?: string, whereArgs?: Array<string>): Promise<number> { try { this.checkInitialized(); const valueBucket: relationalStore.ValuesBucket = {}; const dataEntries: [string, relationalStore.ValueType][] ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/DatabaseService.ets#L234-L267
eca46075e7e8951f5df7598ebc130994e619c94f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/ai/AIAssistantService.ets
arkts
对话消息接口
export interface ChatMessage { id: string; content: string; type: MessageType; sender: MessageSender; timestamp: string; metadata?: Record<string, any>; attachments?: MessageAttachment[]; replyTo?: string; reactions?: MessageReaction[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChatMessage AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left ...
export interface ChatMessage { id: string; content: string; type: MessageType; sender: MessageSender; timestamp: string; metadata?: Record<string, any>; attachments?: MessageAttachment[]; replyTo?: string; reactions?: MessageReaction[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/ai/AIAssistantService.ets#L18-L28
981d0171deee8ecc0f6d8028c89bc445a61c178f
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/AgvMovementService.ets
arkts
AGV状态接口定义
export interface AgvStatusVO { sysTime: string; isRunning: boolean; currentPosition: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AgvStatusVO AST#object_type#Left { AST#type_member#Left sysTime : 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 isRunning : AST#type_annotatio...
export interface AgvStatusVO { sysTime: string; isRunning: boolean; currentPosition: number; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L5-L9
ac90463ef41391b167b4ba0132779146b25f94d1
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/SysUtil.ets
arkts
getResourceStr
获取按钮的字符串 @param resource @returns
static getResourceStr(resource: ResourceStr | ButtonOptions|ActionSheetItemOptions|ResourceStr | SheetInfo): string | null { try { if (typeof resource === 'string') { return resource; } else { return SysUtil.getString(resource as Resource); } } catch (e) { return null ...
AST#method_declaration#Left static getResourceStr AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left ButtonOptions AST#primary_type#Right | AST#primary_type#Left ActionSheetItemOptions AST#...
static getResourceStr(resource: ResourceStr | ButtonOptions|ActionSheetItemOptions|ResourceStr | SheetInfo): string | null { try { if (typeof resource === 'string') { return resource; } else { return SysUtil.getString(resource as Resource); } } catch (e) { return null ...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L46-L56
bd619fc059a13d63bd5446605389d554e411e15e
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
MemoryDetection/oh_modules/.ohpm/oh_modules/@ohos/hypium/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.0.21';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.0.21' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.0.21';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MemoryDetection/oh_modules/.ohpm/oh_modules/@ohos/hypium/BuildProfile.ets#L4-L4
fe6e9c0c8bf82cde9fcabd44c706f06f5d4f2348
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets
arkts
ListItemGroupView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct ListItemGroupView { @Link _offset: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private subassemblyWidth: number; private subassemblyHeight: number; private parentComponentKey: string; private referenceComponentKey: string; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _offset : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type...
@Component export struct ListItemGroupView { @Link _offset: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private subassemblyWidth: number; private subassemblyHeight: number; private parentComponentKey: string; private referenceComponentKey: string; ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets#L16-L88
735008dd986450b2666a6ee315803bf784632714
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets
arkts
enterVoiceCall
开启录音,切换mic 录音成绩
private enterVoiceCall() { Logger.info(TAG, `enterVoiceCall`); try { TimerUtil.getInstance().clearCount(); if (this.observer) { TimerUtil.getInstance().removeObserver(this.observer); } this.clearSound(); AudioManagerModel.setVoiceScene(true); } catch (err) { Log...
AST#method_declaration#Left private enterVoiceCall AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right ...
private enterVoiceCall() { Logger.info(TAG, `enterVoiceCall`); try { TimerUtil.getInstance().clearCount(); if (this.observer) { TimerUtil.getInstance().removeObserver(this.observer); } this.clearSound(); AudioManagerModel.setVoiceScene(true); } catch (err) { Log...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L184-L204
44006778631faa5feda7ddb207775c384590d413
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--下载失败 @since 2022-06-10
export class DownloadFailed extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.DOWNLOAD_FAILED; this.downloadStateText = $r('app.string.download_status_download_failed'); ...
AST#export_declaration#Left export AST#class_declaration#Left class DownloadFailed extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST...
export class DownloadFailed extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.DOWNLOAD_FAILED; this.downloadStateText = $r('app.string.download_status_download_failed'); ...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L412-L434
ce5af536ef2cd0ccd9534113783d367c41921cc2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/image/ImageUtil.ets
arkts
packingFromPixelMap
图片打包 @param {image.PixelMap} source 图像的PixelMap对象 @param {image.PackingOption} options 图像打包参数 @returns {Promise<ArrayBuffer>} ArrayBuffer 返回图像数据
static packingFromPixelMap(source: image.PixelMap, options: image.PackingOption): Promise<ArrayBuffer> { const imagePacker: image.ImagePacker = image.createImagePacker(); return imagePacker.packToData(source, options).finally(() => { imagePacker.release(); }); }
AST#method_declaration#Left static packingFromPixelMap AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ...
static packingFromPixelMap(source: image.PixelMap, options: image.PackingOption): Promise<ArrayBuffer> { const imagePacker: image.ImagePacker = image.createImagePacker(); return imagePacker.packToData(source, options).finally(() => { imagePacker.release(); }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L51-L56
b287d9e3b3e605b5360528185b875fec72d41807
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/utils/WindowUtil.ets
arkts
获取当前窗口 @param context @returns
export function getCurrentWindow(context: Context) { return window.getLastWindow(context); }
AST#export_declaration#Left export AST#function_declaration#Left function getCurrentWindow AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Lef...
export function getCurrentWindow(context: Context) { return window.getLastWindow(context); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/utils/WindowUtil.ets#L23-L25
e15ff5579abaf1bffa7c982ec0acc8ef3d339b25
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/AudioCapturerManager.ets
arkts
startRecord
静态异步方法,用于启动录音过程
static async startRecord(fileName: string) { await AudioCaptureManager.createAudioCapturer() // 记录开始录音的时间戳 AudioCaptureManager.startRecordTime = Date.now(); try { // 初始化缓冲区大小 let bufferSize: number = 0; // 定义一个内部类来设置写入文件时的选项 class Options { offset?: number; // 文件写入位置偏移量 ...
AST#method_declaration#Left static async startRecord AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_...
static async startRecord(fileName: string) { await AudioCaptureManager.createAudioCapturer() AudioCaptureManager.startRecordTime = Date.now(); try { let bufferSize: number = 0; class Options { offset?: number; length?: number; } let path ...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioCapturerManager.ets#L57-L102
97f47216c13a1a4a36b18ac8df6ec153da97c7a2
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/StopwatchPage.ets
arkts
StopwatchPage
秒表页面。
@Component export default struct StopwatchPage { // 创建 TextTimerController 对象,用于控制计时器 private textTimerController: TextTimerController = new TextTimerController(); // 状态变量 state 表示计时器状态,0 - 已重置 1 - 计时中 2 - 暂停中 @State @Watch('onStateChange') state: number = 0; private elapsedTime: number; // 状态变量 startOrPa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct StopwatchPage AST#component_body#Left { // 创建 TextTimerController 对象,用于控制计时器 AST#property_declaration#Left private textTimerController : AST#type_annotation#Left AST#primary_type#Left TextTimerController AST#p...
@Component export default struct StopwatchPage { private textTimerController: TextTimerController = new TextTimerController(); @State @Watch('onStateChange') state: number = 0; private elapsedTime: number; @State startOrPauseImage: Resource = $r('app.media.ic_play'); @State resetOrFlagImage: Resour...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/StopwatchPage.ets#L10-L50
d6b2feed74306f034060f7fbebeb41f45b069ed5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/MD5.ets
arkts
hmacSegment
消息认证码计算,分段,异步 @param data 传入的消息 @param symKey 共享对称密钥。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度
static async hmacSegment(data: string, symKey: cryptoFramework.SymKey = MD5.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { return CryptoUtil.hmacSegment(data, 'MD5', symKey, resultCoding, len); }
AST#method_declaration#Left static async hmacSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
static async hmacSegment(data: string, symKey: cryptoFramework.SymKey = MD5.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { return CryptoUtil.hmacSegment(data, 'MD5', symKey, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/MD5.ets#L105-L108
1ae77271b21ea558d6e95eced922ba5712aa7c80
gitee
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/HttpUtil.ets
arkts
post
@description: post请求函数 @param {string} url 请求地址 @param {Object} data 请求参数 @param {RequestConfig} OtherConfig request其他配置 @return {*}
public post<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url, { method: http.RequestMethod.POST, extraData: data }) }
AST#method_declaration#Left public post AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ...
public post<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url, { method: http.RequestMethod.POST, extraData: data }) }
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/HttpUtil.ets#L117-L119
f9862f5a0843f7534fbea8b846f31afce0d2623c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
代办事项接口
export interface Todo { id: string; title: string; description?: string; date: string; // YYYY-MM-DD格式 time?: string; // HH:mm格式(可选) type: TodoType; priority: TodoPriority; status: TodoStatus; tags?: string[]; isAllDay: boolean; // 是否全天 reminder?: boolean; // 是否提醒 rem...
AST#export_declaration#Left export AST#interface_declaration#Left interface Todo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#prima...
export interface Todo { id: string; title: string; description?: string; date: string; time?: string; type: TodoType; priority: TodoPriority; status: TodoStatus; tags?: string[]; isAllDay: boolean; reminder?: boolean; reminderTime?: string; completedAt?: strin...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L32-L48
093fc884bbd1b928fc473fb1aadb46a186d07ab0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets
arkts
setPrincipalAxis
设置主轴位置
setPrincipalAxis(event: GestureEvent) { // 获取主轴方向 let direction: "X" | "Y" = this.listDirection === Axis.Horizontal ? "X" : "Y"; // 获取主轴中对应的是 width 还是 height let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; // 获取手指在主轴移动偏移量 let offset = ev...
AST#method_declaration#Left setPrincipalAxis AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取主轴方向 AST#statement#Left AST#variab...
setPrincipalAxis(event: GestureEvent) { let direction: "X" | "Y" = this.listDirection === Axis.Horizontal ? "X" : "Y"; let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; let offset = event[`offset${direction}`]; let lastOffset =...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L273-L318
9f5f45073ba7d735b6f78962476630f9a378871a
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
radius
export const BORDER_RADIUS_PERCENT_50: string = '50%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BORDER_RADIUS_PERCENT_50 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '50%' AST#expression#Right AST#variable_declarator#Right ; AST#varia...
export const BORDER_RADIUS_PERCENT_50: string = '50%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L94-L94
5ab3948a828705c3907bb5cde485c06bf7bedca5
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/GetCurrentNetworkInfo.ets
arkts
GetCurrentNetworkInfoBuilder
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...
@Builder export function GetCurrentNetworkInfoBuilder() { GetCurrentNetworkInfo() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function GetCurrentNetworkInfoBuilder 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 GetCurrentNetworkIn...
@Builder export function GetCurrentNetworkInfoBuilder() { GetCurrentNetworkInfo() }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/GetCurrentNetworkInfo.ets#L16-L19
abdb0f339885e4a27925e0d9db8d12684218af82
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Telephony/SimManager/entry/src/main/ets/common/CallView.ets
arkts
CallView
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct CallView { build() { Column() { Row() { Text($r('app.string.data')) .fontSize(20) .fontColor(Color.Gray) Blank() Text($r('app.string.sim1_id')) .fontSize(20) .fontColor(Color.Gray) .textAlign(TextAlign.End) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CallView AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { ...
@Component export struct CallView { build() { Column() { Row() { Text($r('app.string.data')) .fontSize(20) .fontColor(Color.Gray) Blank() Text($r('app.string.sim1_id')) .fontSize(20) .fontColor(Color.Gray) .textAlign(TextAlign.End) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Telephony/SimManager/entry/src/main/ets/common/CallView.ets#L16-L79
1329b6a647ecf68e9edb54d579c5bd91020d754d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/NotificationConfig.ets
arkts
TODO 通知工具类,默认配置参数 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class NotificationConfig { notificationSlotType: notificationManager.SlotType = notificationManager.SlotType.SERVICE_INFORMATION; //通道类型,默认服务类型。 deliveryTime?: number; //通知发送时间。 tapDismissed: boolean = false; //通知是否自动清除。 autoDeletedTime?: number; //自动清除的时间(大于0,否者不显示角标)。 wantAgent?: WantAgent; //WantAge...
AST#export_declaration#Left export AST#class_declaration#Left class NotificationConfig AST#class_body#Left { AST#property_declaration#Left notificationSlotType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type...
export class NotificationConfig { notificationSlotType: notificationManager.SlotType = notificationManager.SlotType.SERVICE_INFORMATION; deliveryTime?: number; tapDismissed: boolean = false; autoDeletedTime?: number; wantAgent?: WantAgent; extraInfo?: Record<string, Object>; isAlertOnce: boolean = f...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationConfig.ets#L27-L55
9f87502156966a2d8645ff1c73c1bbd625cc17fb
gitee