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
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/MusicItem.ets
arkts
formatDuration
格式化时长 @returns 格式化后的时长字符串 (mm:ss)
formatDuration(): string { const minutes = Math.floor(this.duration / 60); const seconds = this.duration % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
AST#method_declaration#Left formatDuration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minutes ...
formatDuration(): string { const minutes = Math.floor(this.duration / 60); const seconds = this.duration % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/MusicItem.ets#L25-L29
7b97712162d60e245e4515374895f3285f33820e
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets
arkts
trainTimeDateChoose
**********************************选择日期*********************************************
@Builder trainTimeDateChoose(){ //日期选择 Row(){ Text(this.months[this.Month-1]+this.Years.toString()) .fontSize(24) .fontWeight(600) Image('/image/practice/rili.png') .width(24) .height(24) .margin({top:15}) .onClick(()=>{ DialogHelper.showDa...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right trainTimeDateChoose AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { //日期选择 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#a...
@Builder trainTimeDateChoose(){ Row(){ Text(this.months[this.Month-1]+this.Years.toString()) .fontSize(24) .fontWeight(600) Image('/image/practice/rili.png') .width(24) .height(24) .margin({top:15}) .onClick(()=>{ DialogHelper.showDatePick...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets#L39-L69
0746653134b9d5115d5491bb064370a40120fe7b
github
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/http/AxiosHttpRequest.ets
arkts
这里主要是高版本的axios中设置拦截器的时候里面的Config属性必须是InternalAxiosRequestConfig,但是InternalAxiosRequestConfig里面的headers是必传,所以在实现的子类设置成非必传会报错,加了个忽略注解
export interface HttpRequestConfig extends InternalAxiosRequestConfig { showLoading?: boolean; // 是否展示请求loading checkResultCode?: boolean; // 是否检验响应结果码 checkLoginState?: boolean // 校验用户登陆状态 needJumpToLogin?: boolean // 是否需要跳转到登陆页面 interceptorHooks?: InterceptorHooks; }
AST#export_declaration#Left export AST#interface_declaration#Left interface HttpRequestConfig AST#extends_clause#Left extends InternalAxiosRequestConfig AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left showLoading ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#...
export interface HttpRequestConfig extends InternalAxiosRequestConfig { showLoading?: boolean; checkResultCode?: boolean; checkLoginState?: boolean needJumpToLogin?: boolean interceptorHooks?: InterceptorHooks; }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/http/AxiosHttpRequest.ets#L30-L36
1acd4e4ea46cbb5f166fec5214dbf7d7bd76e1ac
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/patternlock/src/main/ets/components/PatternLockComponent.ets
arkts
startVibrator
触发设备振动
startVibrator(vibratorCount?: number) { try { vibrator.startVibration({ // 设置为'preset',可使用系统预置振动效果 type: 'preset', // 当前仅支持一种预置振动效果 effectId: 'haptic.clock.timer', // 振动次数,默认振动1次 count: vibratorCount && vibratorCount > 1 ? vibratorCount : 1 }, { //...
AST#method_declaration#Left startVibrator AST#parameter_list#Left ( AST#parameter#Left vibratorCount ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#L...
startVibrator(vibratorCount?: number) { try { vibrator.startVibration({ type: 'preset', effectId: 'haptic.clock.timer', count: vibratorCount && vibratorCount > 1 ? vibratorCount : 1 }, { usage: 'unknown' }, (error: BusinessError) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/patternlock/src/main/ets/components/PatternLockComponent.ets#L38-L61
048a4d6066335e717cc8529979213272549631da
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/groupavatar/src/main/ets/view/GroupAvatarAddPage.ets
arkts
GroupAvatarAddPage
功能描述:本示例介绍使用[组件截图](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-arkui-componentsnapshot-V5) 实现组件的截图并获取pixelMap对象。发起群聊页面,包含导航栏、搜索组件(包含群成员列表)、好友列表、底部自定义按钮。该场景多用于通信类应用。 推荐场景:通信类应用的群聊功能 核心组件: 1.ImageCombination - 图片拼接组件 实现步骤: 1.当前组件默认id为avatar_group,开发者也可以通过SnapShotModel的setComponentId函数...
@Component export struct GroupAvatarAddPage { // 已选择的联系人群组 @State selectPersonGroup: PersonData[] = []; // 是否加载完成 @State isLoading: boolean = false; // 组件截图属性类 @State snapShotModel: SnapShotModel = new SnapShotModel(); // 头像数组 @State imageArr: (ResourceStr | image.PixelMap)[] = []; // 会话数组 sessionGr...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GroupAvatarAddPage AST#component_body#Left { // 已选择的联系人群组 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectPersonGroup : AST#type_annotation#Left AST#primary_type#Left AST#array_type#...
@Component export struct GroupAvatarAddPage { @State selectPersonGroup: PersonData[] = []; @State isLoading: boolean = false; @State snapShotModel: SnapShotModel = new SnapShotModel(); @State imageArr: (ResourceStr | image.PixelMap)[] = []; sessionGroup: SessionData[] = AppStorage.get('sessionL...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/view/GroupAvatarAddPage.ets#L56-L215
f4d30eacb203f2aa14ead2431e9a5e7ce72eebce
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/theme/ThemeManager.ets
arkts
getColors
获取主题颜色
getColors(): ThemeColors { if (this.currentTheme === 'dark') { return this.darkColors; } return this.lightColors; }
AST#method_declaration#Left getColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeColors AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left...
getColors(): ThemeColors { if (this.currentTheme === 'dark') { return this.darkColors; } return this.lightColors; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/theme/ThemeManager.ets#L103-L108
bb6c166900525d4e6d4f503e4b84727fa8e7e314
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
createShareTemplate
创建自定义分享模板
async createShareTemplate(template: Omit<ShareTemplate, 'id' | 'usageCount' | 'rating' | 'createdAt' | 'updatedAt'>): Promise<string> { try { const newTemplate: ShareTemplate = { id: `template_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, usageCount: 0, rating: 0, ...
AST#method_declaration#Left async createShareTemplate AST#parameter_list#Left ( AST#parameter#Left template : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Omit AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ShareTemplate AST#primary_type#Right AST#type_annotation#Right ...
async createShareTemplate(template: Omit<ShareTemplate, 'id' | 'usageCount' | 'rating' | 'createdAt' | 'updatedAt'>): Promise<string> { try { const newTemplate: ShareTemplate = { id: `template_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, usageCount: 0, rating: 0, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L318-L339
a52ae4cd4bcffc6d926cb86211907a93a27a8372
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
signSegment
对数据进行分段签名,异步 @param data 待签名数据 @param priKey 私钥 @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。 @param len 自定义的数据拆分长度,此处取128 @returns
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3', len: number = 128): Promise<cryptoFramework.DataBlob> { return CryptoUtil.signSegment(data, priKey, algName, len); }
AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualifi...
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3', len: number = 128): Promise<cryptoFramework.DataBlob> { return CryptoUtil.signSegment(data, priKey, algName, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L263-L266
70a06ff7e60d7ff64e78e4acb83068ef20d39bf5
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/data/CombinedData.ets
arkts
calcMinMax
@Override
public calcMinMax() { if (this.mDataSets == null) { this.mDataSets = new JArrayList(); } this.mDataSets.clear(); this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; let allData: JArrayList<BarLineScatterCan...
AST#method_declaration#Left public calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDataS...
public calcMinMax() { if (this.mDataSets == null) { this.mDataSets = new JArrayList(); } this.mDataSets.clear(); this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; let allData: JArrayList<BarLineScatterCan...
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/CombinedData.ets#L74-L127
455226ff9b3b97c28418f268b9a8cdf8074ceeea
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
calculateUnlockDuration
计算联动解锁时长 @param {number} targetIndex - 目标索引 @returns {number} 解锁时长(毫秒)
private calculateUnlockDuration(targetIndex: number): number { const distance: number = Math.abs(targetIndex - this.lastSideBarIndex); this.lastSideBarIndex = targetIndex; return Math.min(1200, Math.max(240, distance * 120)); }
AST#method_declaration#Left private calculateUnlockDuration 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 nu...
private calculateUnlockDuration(targetIndex: number): number { const distance: number = Math.abs(targetIndex - this.lastSideBarIndex); this.lastSideBarIndex = targetIndex; return Math.min(1200, Math.max(240, distance * 120)); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L145-L149
3eab082d182a54e721494ffae0399bb4b8381b50
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
handleDateSelect
处理日期选择
handleDateSelect() { try { // 生成未来60天的日期选项 const dateOptions = this.generateDateOptions(); // 设置默认选中当前日期 this.dream.deadline = this.selectedDate.toString(); // 显示选择器 this.showDatePicker = true; } catch (error) { // 提取错误信息 let errorMessage = ''; ...
AST#method_declaration#Left handleDateSelect AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 生成未来60天的日期选项 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dateOptions = AST#expr...
handleDateSelect() { try { const dateOptions = this.generateDateOptions(); this.dream.deadline = this.selectedDate.toString(); this.showDatePicker = true; } catch (error) { let errorMessage = ''; if (error) { if (typeof error === 'o...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L581-L606
43e34e485a96c03c2ed2112a44cfe008d29018f2
github
jiwangyihao/FlameChase.git
446275e6972bd5f92a3c5b7eba354ca83d504594
entry/src/main/ets/pages/ChroniclePage.ets
arkts
increaseDate
【新增】增加一天日期的函数
private increaseDate(): void { this.displayDate.setDate(this.displayDate.getDate() + 1); // 更新日期后,重新格式化字符串以刷新UI this.currentDate = this.getFormattedDate(this.displayDate); }
AST#method_declaration#Left private increaseDate 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#exp...
private increaseDate(): void { this.displayDate.setDate(this.displayDate.getDate() + 1); this.currentDate = this.getFormattedDate(this.displayDate); }
https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/pages/ChroniclePage.ets#L574-L578
4a6e0b04c247602b3c1a3edb91c1f31f9133cba4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
searchLunarYears
搜索农历日期 @param keyword 关键词(支持干支、生肖等) @param startYear 开始年份 @param endYear 结束年份 @returns 匹配的年份列表
searchLunarYears(keyword: string, startYear: number = 1900, endYear: number = 2100): number[] { const matchedYears: number[] = []; for (let year = startYear; year <= endYear; year++) { const yearInfo = this.getYearInfo(year); if (yearInfo.yearName.includes(keyword) || yearInfo....
AST#method_declaration#Left searchLunarYears 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#Left startYear : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
searchLunarYears(keyword: string, startYear: number = 1900, endYear: number = 2100): number[] { const matchedYears: number[] = []; for (let year = startYear; year <= endYear; year++) { const yearInfo = this.getYearInfo(year); if (yearInfo.yearName.includes(keyword) || yearInfo....
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L583-L597
92b9aec237b0e9819f541ec4711691720e8aa484
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkView.ets
arkts
/默认Nav撕开
export function open(param: LinkViewConfig.Param, isOpenInBrowser: boolean = false){ NavTo(NavPathManager.shared.navPath, param, isOpenInBrowser) }
AST#export_declaration#Left export AST#function_declaration#Left function open AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left LinkViewConfig . Param AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ...
export function open(param: LinkViewConfig.Param, isOpenInBrowser: boolean = false){ NavTo(NavPathManager.shared.navPath, param, isOpenInBrowser) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkView.ets#L34-L36
d7ceaaec3af82a63a1624718c120831b563f8437
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets
arkts
Style constants that can be used by all modules
export default class CommonConstants { /** * Full width or height. */ static readonly FULL_LENGTH: string = '100%'; /** * Title height. */ static readonly TITLE_WIDTH: string = '80%'; /** * List default width. */ static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; /** * Opacity o...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full width or height. */ AST#property_declaration#Left static readonly FULL_LENGTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#...
export default class CommonConstants { static readonly FULL_LENGTH: string = '100%'; static readonly TITLE_WIDTH: string = '80%'; static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; static readonly OPACITY_DEFAULT: number = 1; static readonly OPACITY_COMPLETED: number = 0.4; static ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L19-L70
a6d53ca3af123ce64884aa806df37aaada683c76
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets
arkts
图片消息
export class ImageMessage extends MessageBody { toString(): string { return this.height + ' ' + this.width + ' ' + this.image; } constructor(height: number, width: number, image: string) { super(); this.height = height; this.width = width; this.image = image; } height: number width: ...
AST#export_declaration#Left export AST#class_declaration#Left class ImageMessage extends AST#type_annotation#Left AST#primary_type#Left MessageBody AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_...
export class ImageMessage extends MessageBody { toString(): string { return this.height + ' ' + this.width + ' ' + this.image; } constructor(height: number, width: number, image: string) { super(); this.height = height; this.width = width; this.image = image; } height: number width: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets#L92-L107
9ebfac17ccfc7ef35d087c8ed10b981bb2ab2dcf
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PCProject/entry/src/main/ets/pages/Index.ets
arkts
createFloatWindow
[End create_float_window_background]
async createFloatWindow() { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let floatWindowName = 'floatWindow'; let config: window.Configuration = { name: floatWindowName, windowType: window.WindowType.TYPE_FLOAT, ctx: context }; try { let floa...
AST#method_declaration#Left async createFloatWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expr...
async createFloatWindow() { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let floatWindowName = 'floatWindow'; let config: window.Configuration = { name: floatWindowName, windowType: window.WindowType.TYPE_FLOAT, ctx: context }; try { let floa...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PCProject/entry/src/main/ets/pages/Index.ets#L55-L80
8714562e30b9406a6478be53709516c9dbfeba5c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment.ets
arkts
aboutToAppear
[EndExclude Counter_example1]
aboutToAppear(): void { // Create a complex object task, if the task takes 1s to execute, the component will be rendered again after 1s this.createComplexVideoPlayer(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Create a complex object task, if the task takes 1s to execute, the component will be r...
aboutToAppear(): void { this.createComplexVideoPlayer(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment.ets#L39-L42
88e4c5e026d2282f1831349ac7c28ee97be926e4
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
系统检查全部结果接口
export interface SystemCheckAllResult { fs: CheckResult; db: CheckResult; agv: CheckResult; cam: CheckResult; allPassed: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SystemCheckAllResult AST#object_type#Left { AST#type_member#Left fs : AST#type_annotation#Left AST#primary_type#Left CheckResult AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left db : AST#type_annotat...
export interface SystemCheckAllResult { fs: CheckResult; db: CheckResult; agv: CheckResult; cam: CheckResult; allPassed: boolean; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L12-L18
e7f86a6969170e2ac2a0723296bc7b28d746f9aa
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CrashUtil.ets
arkts
enableAppRecovery
启用应用恢复功能,参数按顺序填入。该接口调用后,应用从启动器启动时第一个Ability支持恢复。 @param restart RestartFlag 应用重启标志。 ALWAYS_RESTART 0 总是重启应用。 RESTART_WHEN_JS_CRASH 0x0001 发生JS_CRASH时重启应用。 RESTART_WHEN_APP_FREEZE 0x0002 发生APP_FREEZE时重启应用。 NO_RESTART 0xFFFF 总是不重启应用。 @param saveOccasion SaveOccasionFlag 保存条件标志 SAVE_WHEN_ERROR 0x0001 当发生应用故障时保存。...
static enableAppRecovery(restart: appRecovery.RestartFlag = appRecovery.RestartFlag.ALWAYS_RESTART, saveOccasion: appRecovery.SaveOccasionFlag = appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, saveMode: appRecovery.SaveModeFlag.SAVE_WITH_FILE = appRecovery.SaveModeFlag.SAVE_WITH_FILE) { appRecovery.enableAppR...
AST#method_declaration#Left static enableAppRecovery AST#parameter_list#Left ( AST#parameter#Left restart : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left appRecovery . RestartFlag AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expressi...
static enableAppRecovery(restart: appRecovery.RestartFlag = appRecovery.RestartFlag.ALWAYS_RESTART, saveOccasion: appRecovery.SaveOccasionFlag = appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, saveMode: appRecovery.SaveModeFlag.SAVE_WITH_FILE = appRecovery.SaveModeFlag.SAVE_WITH_FILE) { appRecovery.enableAppR...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L166-L170
e5c9d6954cfbef8d0b7a96bb5799e075257ac4ac
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
updateUserInfo
更新用户信息,并保存到数据库 @param userinfo
private async updateUserInfo(userinfo?: IUserInfo) { await lock.acquire(); try { this.userInfo = userinfo; if (userinfo != null) { globalVM_WanDB.updateUserInfo(userinfo.userInfo.id, JSON.stringify(userinfo)); } } finally { lock.release(); } }
AST#method_declaration#Left private async updateUserInfo AST#parameter_list#Left ( AST#parameter#Left userinfo ? : AST#type_annotation#Left AST#primary_type#Left IUserInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#ex...
private async updateUserInfo(userinfo?: IUserInfo) { await lock.acquire(); try { this.userInfo = userinfo; if (userinfo != null) { globalVM_WanDB.updateUserInfo(userinfo.userInfo.id, JSON.stringify(userinfo)); } } finally { lock.release(); } }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L70-L80
580dd3ad9443b207fe2c476cfe526ff4016a5909
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIHealthyDiet/entry/src/main/ets/mock/MockData.ets
arkts
构造数据的mock数据
export let mockFoods: Array<FoodInfo> = [ { id: 0, letter: 'Kiwi', name: $r('app.string.food_name_kiwi'), image: $r('app.media.kiwi'), categoryId: CategoryId.Fruit, calories: 61, protein: 0.8, fat: 0.6, carbohydrates: 14.5, vitaminC: 62 }, { id: 1, letter: 'Walnut',...
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left mockFoods : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FoodInfo AST#primary_type#Right AST#type_annotation#Right > AS...
export let mockFoods: Array<FoodInfo> = [ { id: 0, letter: 'Kiwi', name: $r('app.string.food_name_kiwi'), image: $r('app.media.kiwi'), categoryId: CategoryId.Fruit, calories: 61, protein: 0.8, fat: 0.6, carbohydrates: 14.5, vitaminC: 62 }, { id: 1, letter: 'Walnut',...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIHealthyDiet/entry/src/main/ets/mock/MockData.ets#L4-L149
876d6e8a6a0f82ab7a1b378495c46bc87a9ee522
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/EmitterUtils.ets
arkts
registerEventBus
开启订阅事件 @param eventId 事件ID @param priority 事件优先级
static registerEventBus<T>(eventId: string, eventCallback: EventCallback<T>, priority: emitter.EventPriority = emitter.EventPriority.HIGH) { LogUtils.debug("EmitterUtils registerEventBus", `eventId=${eventId} priority=${priority} `) emitter.on(eventId, (result) => { if (eventCallback?.callback) { ...
AST#method_declaration#Left static registerEventBus AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#...
static registerEventBus<T>(eventId: string, eventCallback: EventCallback<T>, priority: emitter.EventPriority = emitter.EventPriority.HIGH) { LogUtils.debug("EmitterUtils registerEventBus", `eventId=${eventId} priority=${priority} `) emitter.on(eventId, (result) => { if (eventCallback?.callback) { ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/EmitterUtils.ets#L42-L53
b18ab75032803e3ad0ae76c9aa316a75d7dcfaa8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/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: ImageFitType = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; // 获取手指在主轴移动偏移量...
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: ImageFitType = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; let offset: number = event[`offset${direction}`...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L272-L319
3d122ce2d945278c6c9890afa43a229da97cd7be
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态基类 @since 2022-06-10
export class BaseState { /** * 状态对象 */ public otaStatus: OtaStatus; /** * 进度 */ public percent: number = 0; /** * 状态 */ public state: number = UpdateState.INIT; /** * 升级行为 */ public actionSet: Array<UpdateAction> = []; /** * 下载状态描述 */ public downloadStateText: strin...
AST#export_declaration#Left export AST#class_declaration#Left class BaseState AST#class_body#Left { /** * 状态对象 */ AST#property_declaration#Left public otaStatus : AST#type_annotation#Left AST#primary_type#Left OtaStatus AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 进度 ...
export class BaseState { public otaStatus: OtaStatus; public percent: number = 0; public state: number = UpdateState.INIT; public actionSet: Array<UpdateAction> = []; public downloadStateText: string | Resource = ''; public buttonText: string | Resource = $r('app.string.btn_download')...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L195-L253
7a2d1c49991962e99f73db26e569dc3a5598ef5e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets
arkts
getOsAccountInfo
获取帐号信息
async getOsAccountInfo() { let accountMgr: account_osAccount.AccountManager; try { accountMgr = account_osAccount.getAccountManager(); let user = await accountMgr.getCurrentOsAccount(); Logger.info(TAG, "accountLogin user:" + JSON.stringify(user)); } catch (err) { Logger.error(TAG, '...
AST#method_declaration#Left async getOsAccountInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left accountMgr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left account_osAccount . Acc...
async getOsAccountInfo() { let accountMgr: account_osAccount.AccountManager; try { accountMgr = account_osAccount.getAccountManager(); let user = await accountMgr.getCurrentOsAccount(); Logger.info(TAG, "accountLogin user:" + JSON.stringify(user)); } catch (err) { Logger.error(TAG, '...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L332-L341
efda1db631992fbf1b89a97f297c5b4bbd169210
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/Screenshot.ets
arkts
设置全屏展示 isFullScreen: boolean
export function setFullScreen(context: Context, isFullScreen: boolean) { getCurrentWindow(context) .then(res => { res.setFullScreen(isFullScreen, (err) => { if (err.code) { Logger.error('failed set full-screen mode cause: ' + JSON.stringify(err)) return } Logger.i...
AST#export_declaration#Left export AST#function_declaration#Left function setFullScreen AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isFullScreen : AST#type_annotati...
export function setFullScreen(context: Context, isFullScreen: boolean) { getCurrentWindow(context) .then(res => { res.setFullScreen(isFullScreen, (err) => { if (err.code) { Logger.error('failed set full-screen mode cause: ' + JSON.stringify(err)) return } Logger.i...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/Screenshot.ets#L26-L37
05695e667677b4d6e74e8da644f38093b26bfe73
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/dataList/FolderAndFileItem.ets
arkts
@author 惟草木之零落兮 @date 2024/5/22 20:21 网盘 本地目录 文件夹 文件信息
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/dataList/FolderAndFileItem.ets#L6-L6
b58062c8f69a03ee39c13ba8e652ddc6edc07667
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
sdkApiVersion
系统软件API版本
static sdkApiVersion(): string { return deviceInfo.sdkApiVersion + '' }
AST#method_declaration#Left static sdkApiVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_exp...
static sdkApiVersion(): string { return deviceInfo.sdkApiVersion + '' }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L168-L170
06d7f327b6936200ee8b025deff95a84e9b4c961
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/WordClickableText.ets
arkts
isWord
---------- 私有方法 ---------- 判断是否英文单词
private isWord(str: string): boolean { return /^[A-Za-z]+$/.test(str); }
AST#method_declaration#Left private isWord AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri...
private isWord(str: string): boolean { return /^[A-Za-z]+$/.test(str); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/WordClickableText.ets#L19-L21
b67923302d6b31dbcf1d92a1c9653b3dccc68223
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
toSettings
跳转到设置页 @returns {void} 无返回值
static toSettings(): void { navigateTo(CommonRoutes.Settings); }
AST#method_declaration#Left static toSettings 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_ex...
static toSettings(): void { navigateTo(CommonRoutes.Settings); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L22-L24
ba42aae0883f46e0c2ee6e016b79e5442378b4e9
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets
arkts
rgb
export const EXPENSE_BAR_HIGHLIGHT_COLOR: number = 0x94b982;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EXPENSE_BAR_HIGHLIGHT_COLOR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x94b982 AST#expression#Right AST#variable_declarator#Right ; AST...
export const EXPENSE_BAR_HIGHLIGHT_COLOR: number = 0x94b982;
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets#L18-L18
7dc7f478fd4ca2aec14091d91d282cae98f36438
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/DateHelper.ets
arkts
getResetDay
处理一些特殊情况下的日期
static getResetDay(yearStr: string, monthStr: string, dayStr: string): string { try { let year = parseInt(yearStr.replace('年', '')); let month = parseInt(monthStr.replace('月', '')); let day = DateHelper.getDays(year, month); let selectDay = parseInt(dayStr.replace('日', '')); if (isNaN(...
AST#method_declaration#Left static getResetDay AST#parameter_list#Left ( AST#parameter#Left yearStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left monthStr : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static getResetDay(yearStr: string, monthStr: string, dayStr: string): string { try { let year = parseInt(yearStr.replace('年', '')); let month = parseInt(monthStr.replace('月', '')); let day = DateHelper.getDays(year, month); let selectDay = parseInt(dayStr.replace('日', '')); if (isNaN(...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L249-L266
8f0bcaae4cf275f1b61738aecbb6a45b84ffedd3
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets
arkts
removeImage
删除图片 @param index 图片在当前列表中的索引
removeImage(index: number) { // 获取要删除的图片URL const imageToRemove = this.currentImageUrls[index]; // 检查是否为原始图片 const originalIndex = this.originalImageUrls.indexOf(imageToRemove); if (originalIndex !== -1) { // 添加到已移除的原始图片列表 this.removedImageUrls.push(imageToRemove); } else { ...
AST#method_declaration#Left removeImage AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取要删除的图片URL AST#statement#Left AST#variable_dec...
removeImage(index: number) { const imageToRemove = this.currentImageUrls[index]; const originalIndex = this.originalImageUrls.indexOf(imageToRemove); if (originalIndex !== -1) { this.removedImageUrls.push(imageToRemove); } else { const newIndex = this.selectedIma...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L309-L334
e56207d1488f8fd4d93e172a8a6c85ce0685a219
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard4x4.ets
arkts
buildTodayBirthdays
构建今日生日
@Builder buildTodayBirthdays() { const todayBirthdays = this.widgetData.birthdayList.filter((item: any) => item.isToday); if (todayBirthdays.length > 0) { Column({ space: 8 }) { Row() { Image($r('app.media.ic_cake')) .width('16vp') .height('16vp') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTodayBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todayBirthdays = AST#expression#Left AST#call_expression#Le...
@Builder buildTodayBirthdays() { const todayBirthdays = this.widgetData.birthdayList.filter((item: any) => item.isToday); if (todayBirthdays.length > 0) { Column({ space: 8 }) { Row() { Image($r('app.media.ic_cake')) .width('16vp') .height('16vp') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard4x4.ets#L78-L105
dddc31b3a563089f65503cd3c836bd3f0910a706
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets
arkts
getListView
[Start get_list_view_error]
@Builder private getListView() { List({ space: 12, scroller: this.scroller }) { // Render data using lazy loading components ForEach(this.newsData, (item: NewsData) => { ListItem() { newsItem({ newsTitle: item.newsTitle, newsContent: item.newsC...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private getListView 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 List ( AST#component_parameters#Left { AST#component_p...
@Builder private getListView() { List({ space: 12, scroller: this.scroller }) { ForEach(this.newsData, (item: NewsData) => { ListItem() { newsItem({ newsTitle: item.newsTitle, newsContent: item.newsContent, newsTime: item.newsTime,...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets#L215-L244
c7da4f0543fcce1ecd94a9a71f9137e3eedc522b
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_user_agents.ets
arkts
update_last_accessed
Update last accessed time. This would trigger some refresh on UI layer.
static update_last_accessed() { AppStorage.setOrCreate('bunch_of_user_agents_update', Date.now()); }
AST#method_declaration#Left static update_last_accessed 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 AppStorage AST#expression#Right . se...
static update_last_accessed() { AppStorage.setOrCreate('bunch_of_user_agents_update', Date.now()); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_user_agents.ets#L9-L11
fd8dbe106d77c2530b47fc9bbd814c05d116e953
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets
arkts
replace
将指定路由栈的栈顶页面退出,将info指定的NavDestination页面信息入栈
public static replace(info: NavRouterInfo) { try { RouterModule._stack.replacePathByName(info.url, info.param); } catch (err) { Logger.error(TAG, 'navigation stack replace failed::' + JSON.stringify(err)); } }
AST#method_declaration#Left public static replace AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavRouterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_stateme...
public static replace(info: NavRouterInfo) { try { RouterModule._stack.replacePathByName(info.url, info.param); } catch (err) { Logger.error(TAG, 'navigation stack replace 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#L27-L33
1c95d4b9ae2b95e2f59cfe63759883bc37684ebf
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
A class holding a timestamp and an index_key. @param timestamp A number, usually the creation of the tab. @param index_key A number, indicating the index of this tab in the tabs list.
constructor(timestamp: number, index: number) { this.index_key = index; this.timestamp = timestamp; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
constructor(timestamp: number, index: number) { this.index_key = index; this.timestamp = timestamp; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L743-L746
0bc9bbe91c197283e7cedec51a980edfb8155d67
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
updateSelection
控制支付弹窗显示 更新选中状态的方法
updateSelection() { this.isSelectedAll = this.datas.every(item => item.selected); }
AST#method_declaration#Left updateSelection 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 . isSelectedAll AST#member_expressio...
updateSelection() { this.isSelectedAll = this.datas.every(item => item.selected); }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L89-L91
95c754ef8f6710cee7f8769f2b6735c6a85ea94d
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getCurrentNavStack
获取当前路由栈 @returns
public static getCurrentNavStack(): NavPathStack { return ZRouter.getNavStackByName(ZRouter.getCurrentStackName()) }
AST#method_declaration#Left public static getCurrentNavStack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#L...
public static getCurrentNavStack(): NavPathStack { return ZRouter.getNavStackByName(ZRouter.getCurrentStackName()) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L261-L263
0f044e3d6d96387de4532c864cdf8d38dfbaca9c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
数据版本管理
export interface DataVersion { dataType: DataType; version: number; lastModified: string; checksum: string; itemCount: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DataVersion AST#object_type#Left { AST#type_member#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left version : AST#type_annotati...
export interface DataVersion { dataType: DataType; version: number; lastModified: string; checksum: string; itemCount: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L249-L255
3be7554f508bc8cdef6f56d4487420bc800cf672
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
setBitsByRange
Sets a range of bits in a bit vector to a particular element. @param { number } element - Element to be set (0 means 0, else means 1). @param { number } fromIndex - The starting position of the index, containing the value at that index position. @param { number } toIndex - The end of the index, excluding the value at ...
setBitsByRange(element: number, fromIndex: number, toIndex: number): void;
AST#method_declaration#Left setBitsByRange AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
setBitsByRange(element: number, fromIndex: number, toIndex: number): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12228-L12228
10a1c88f9012bbeecb44fa254505a8f55e3f2362
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/ArticleContentApi.type.ets
arkts
文章内容数据
export interface ArticleContentData extends BaseTime { /** * 文章id */ id: number /** * 用户头像 */ avatarUri: string /** * 用户昵称 */ nickname: string /** * 文章标题 */ title: string /** * 文章内容 */ content: string /** * 阅读数 */ readCount: number /** * 点赞数 */ likeC...
AST#export_declaration#Left export AST#interface_declaration#Left interface ArticleContentData AST#extends_clause#Left extends BaseTime AST#extends_clause#Right AST#object_type#Left { /** * 文章id */ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_anno...
export interface ArticleContentData extends BaseTime { id: number avatarUri: string nickname: string title: string content: string readCount: number likeCount: number collectCount: number coverUrl: string contentCategory: string platformCategory: string diffic...
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/ArticleContentApi.type.ets#L87-L148
24f89422e13c79d9dca9d1e3569e4ffd058d71af
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/MD5.ets
arkts
TODO MD5工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class MD5 { private static symKey = CryptoUtil.generateSymKeySync('AES256'); //对称密钥SymKey /** * MD5摘要,同步 * @param data 待摘要的数据 * @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 * @returns */ static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return Cryp...
AST#export_declaration#Left export AST#class_declaration#Left class MD5 AST#class_body#Left { AST#property_declaration#Left private static symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKeySync AST#mem...
export class MD5 { private static symKey = CryptoUtil.generateSymKeySync('AES256'); static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, 'MD5', resultCoding); } static digestSync(data: string, resultCoding: crypto.BhCoding = 'hex'): st...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/MD5.ets#L26-L123
c4de4138fec212d9de88a809a8c5a352ccbfd225
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
notifyDataChange
通知控制器数据变化 @param index 数组索引
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L63-L67
96c25fcda2a3feab4647585f7abfca0a8b23bc7c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/cache/CacheUtil.ets
arkts
取值 @param key 存入的key @returns
export function get<T>(key: string): T { return cache[key] as T; }
AST#export_declaration#Left export AST#function_declaration#Left function get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
export function get<T>(key: string): T { return cache[key] as T; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/CacheUtil.ets#L45-L47
f500c59477ef4c973301a7c9e56b250316b8fab9
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
聊天消息的缓存数据管理提供者(集中管理所有的聊天消息和指令,消息来源为网络层通信数据包和本地发出的包 ,消息显示方式通过MessagesDataSource与UI界面进行解偶显示)。 代码参考自IM产品RainbowChat:http://www.52im.net/thread-19-1-1.html @author Jack Jiang(http://www.52im.net/thread-2792-1-1.html)
export default class MessagesProvider { /** 聊天界面中,消息的显示时间间隔(单位:毫秒):默认是2分钟内的消息只在第一条消息上显示时间,否则会再次显示时间 */ // 参考资料:http://www.52im.net/thread-3008-1-1.html#40 private static readonly CHATTING_MESSAGE_SHOW_TIME_INTERVAL: number = 2 * 60 * 1000; /** 真正的聊天软件中,此处应改造为<key=uid, value=Array<Message> >这样的Map集合,用于按uid分别存储...
AST#export_declaration#Left export default AST#class_declaration#Left class MessagesProvider AST#class_body#Left { /** 聊天界面中,消息的显示时间间隔(单位:毫秒):默认是2分钟内的消息只在第一条消息上显示时间,否则会再次显示时间 */ // 参考资料:http://www.52im.net/thread-3008-1-1.html#40 AST#property_declaration#Left private static readonly CHATTING_MESSAGE_SHOW_TIME_INTERVAL ...
export default class MessagesProvider { private static readonly CHATTING_MESSAGE_SHOW_TIME_INTERVAL: number = 2 * 60 * 1000; private messages: Array<Message> = []; putMessage(m: Message): void { let previousMessage: Message | undefined = undefined; let messagesSize: number = this.messa...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L25-L154
980799e43f48e595bf201f8a6723e394a937e076
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets
arkts
handleLike
处理点赞
async handleLike(): Promise<void> { if (!this.post) return; try { if (this.post.isLiked) { await ApiService.unlikePost(this.post.id); this.post.likeCount = Math.max(0, this.post.likeCount - 1); } else { await ApiService.likePost(this.post.id); this.post.likeCount...
AST#method_declaration#Left async handleLike AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async handleLike(): Promise<void> { if (!this.post) return; try { if (this.post.isLiked) { await ApiService.unlikePost(this.post.id); this.post.likeCount = Math.max(0, this.post.likeCount - 1); } else { await ApiService.likePost(this.post.id); this.post.likeCount...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets#L294-L312
e61adf4816ba2c9a8a572e75de729c26c3c230ef
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
@file 全局断点状态,用于窗口尺寸响应式适配 @author Joker.X AppStorageV2 键名
export const BREAKPOINT_STATE_KEY: string = "breakpoint_state";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BREAKPOINT_STATE_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "breakpoint_state" AST#expression#Right AST#variable_declarator#Right ; ...
export const BREAKPOINT_STATE_KEY: string = "breakpoint_state";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L12-L12
6a63f033e7b834a0f346b38cdaf35e483c32ecd7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
mime_types/src/main/ets/Mime.ets
arkts
extension
根据MIME类型获取文件扩展名 @param mimeType MIME类型名称 'text/css' @returns 输出:css
static extension(mimeType: string): string { const typeDescriptor = Mime.getTypeDescriptorByMIMEType(mimeType) const filenameExtensions = typeDescriptor.filenameExtensions; if (filenameExtensions && filenameExtensions.length > 0) { return filenameExtensions[0]; } else { return ''; } }
AST#method_declaration#Left static extension AST#parameter_list#Left ( AST#parameter#Left mimeType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static extension(mimeType: string): string { const typeDescriptor = Mime.getTypeDescriptorByMIMEType(mimeType) const filenameExtensions = typeDescriptor.filenameExtensions; if (filenameExtensions && filenameExtensions.length > 0) { return filenameExtensions[0]; } else { return ''; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L55-L63
719e91e012ba1a6f468aa70121b45a469074552b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toSmsLogin
跳转到短信验证码登录 @returns {void} 无返回值
static toSmsLogin(): void { navigateTo(AuthRoutes.SmsLogin); }
AST#method_declaration#Left static toSmsLogin 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_ex...
static toSmsLogin(): void { navigateTo(AuthRoutes.SmsLogin); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L29-L31
59cd5fa97f912f9795869ee937803bcdc4f2dfed
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/ValidationUtils.ets
arkts
validateEmail
验证邮箱地址 @param email 邮箱地址 @returns 是否有效
static validateEmail(email: string): boolean { if (!email || email.trim() === '') { return false; } return RegexConstants.EMAIL_REGEX.test(email.trim()); }
AST#method_declaration#Left static validateEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
static validateEmail(email: string): boolean { if (!email || email.trim() === '') { return false; } return RegexConstants.EMAIL_REGEX.test(email.trim()); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/ValidationUtils.ets#L29-L35
60e8fa087bd3ab2b280121733dda662a3be1c4f3
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/interface/CustomDrawCallback.ets
arkts
Function signature for custom drawing on the time bar canvas. @param ctx 2D canvas rendering context. @param component TimeBarView component instance.
export type CustomDrawCallback = ( ctx: CanvasRenderingContext2D, component: TimeBarView ) => void;
AST#export_declaration#Left export AST#type_declaration#Left type CustomDrawCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter...
export type CustomDrawCallback = ( ctx: CanvasRenderingContext2D, component: TimeBarView ) => void;
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/interface/CustomDrawCallback.ets#L22-L25
2e9c653f5f6f9ce4b0b4e4acfca2e5262038cc10
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
clear
清空所有数据
static async clear(): Promise<void> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { return; } try { await instance.dataPreferences.clear(); await instance.dataPreferences.flush(); } catch (e) { Logger.error('StorageManager', `Failed to clear:...
AST#method_declaration#Left static async clear 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_arg...
static async clear(): Promise<void> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { return; } try { await instance.dataPreferences.clear(); await instance.dataPreferences.flush(); } catch (e) { Logger.error('StorageManager', `Failed to clear:...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L176-L187
eecfe9f03aa87e32daf45c82b86b4f840a74eefc
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
@file Demo 模块导航封装 @author Joker.X
export class DemoNavigator { /** * 跳转到 Network Demo 示例页 * @returns {void} 无返回值 */ static toNetworkDemo(): void { navigateTo(DemoRoutes.NetworkDemo); } /** * 跳转到 Network List Demo 示例页 * @returns {void} 无返回值 */ static toNetworkListDemo(): void { navigateTo(DemoRoutes.NetworkListDemo);...
AST#export_declaration#Left export AST#class_declaration#Left class DemoNavigator AST#class_body#Left { /** * 跳转到 Network Demo 示例页 * @returns {void} 无返回值 */ AST#method_declaration#Left static toNetworkDemo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi...
export class DemoNavigator { static toNetworkDemo(): void { navigateTo(DemoRoutes.NetworkDemo); } static toNetworkListDemo(): void { navigateTo(DemoRoutes.NetworkListDemo); } static toDatabase(): void { navigateTo(DemoRoutes.Database); } static toLocalStorage(): void { navig...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L10-L93
7afe5073a5f05471aba67a1d6e073dc140832c07
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinO.ets
arkts
SpinO
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinO { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.14 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinO AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinO { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.14 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinO.ets#L21-L354
ead05b48aa7dbe05c8a91898f1941f4a0c0a753e
gitee
texiwustion/chinese-herbal-shopping--arkts.git
3f71338f3c6d88bc74342e0322867f3a0c2c17d1
entry/src/main/ets/database/UserTable.ets
arkts
insertData
插入数据的方法,接收单个用户数据对象,和回调函数
insertData(user: IUserModel, callback: Function) { // 首先查询是否已经存在具有同名的用户 this.query(user.username, (result) => { if (result.length > 0) { // 如果存在同名的用户,调用回调函数,并传入错误信息 callback(new Error('Username already exists')); } else { // 通过工具函数,将用户数据,转化为存储键值对 const valueBucket = t...
AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left IUserModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_ty...
insertData(user: IUserModel, callback: Function) { this.query(user.username, (result) => { if (result.length > 0) { callback(new Error('Username already exists')); } else { const valueBucket = this.generateBucket(user); this.userTable.insertData(va...
https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/UserTable.ets#L47-L61
83d4e767046e4ad84b475b3a362d8f1c4c48995e
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowStartCenter
横向起始 + 垂直居中
@ComponentV2 export struct RowStartCenter { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param si...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowStartCenter AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#L...
@ComponentV2 export struct RowStartCenter { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | Leng...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L225-L300
50b181009e067d0d187b9ca5b861a87060a83c1e
github
azhuge233/Wake-HarmonyOS.git
68c4e961f9cf5fab8699af99313dd5854ea313a1
entry/src/main/ets/pages/Index.ets
arkts
loadDevices
加载设备列表
private async loadDevices() { this.isLoading = true; await this.deviceList.loadDevices(); this.isLoading = false; }
AST#method_declaration#Left private async loadDevices 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 . isLoading AST#member_exp...
private async loadDevices() { this.isLoading = true; await this.deviceList.loadDevices(); this.isLoading = false; }
https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/pages/Index.ets#L61-L65
4ba63abca1d56b12eca106af2dc5809856454c48
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
calculateOriginalPrice
计算商品原价 @returns {void} 无返回值
private calculateOriginalPrice(): void { let price = 0; for (const cart of this.cartList) { for (const spec of cart.spec) { price += spec.price * spec.count; } } this.originalPrice = price; this.calculatePrices(); }
AST#method_declaration#Left private calculateOriginalPrice AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#L...
private calculateOriginalPrice(): void { let price = 0; for (const cart of this.cartList) { for (const spec of cart.spec) { price += spec.price * spec.count; } } this.originalPrice = price; this.calculatePrices(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L240-L249
dfe542e7589af5b20c9df548d0289a6f2c3a4848
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/BasicDataSource.ets
arkts
totalCount
// 获取数组长度
public totalCount(): number { return this.articleData.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.articleData.length; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/BasicDataSource.ets#L84-L86
a89857ffa4c2fd46eefbfa6428c87916159cdb95
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getTopPathName
@deprecated @see {ZRouter.getInstance().getTopPathName} @returns
public static getTopPathName(): string | null { return ZRouter.getRouterMgr().getTopPathName() }
AST#method_declaration#Left public static getTopPathName AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_st...
public static getTopPathName(): string | null { return ZRouter.getRouterMgr().getTopPathName() }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L514-L516
1b987963c5417bd0705249492e9157a182fb5618
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/ButtonPopup.ets
arkts
ButtonPopupExample
[Start button_popup]
@Entry @Component export struct ButtonPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions').margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePopup; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ButtonPopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#prima...
@Entry @Component export struct ButtonPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions').margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePopup; ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/ButtonPopup.ets#L17-L62
0a9abc17c7ad4cd1c6447173279de0c58046e2fc
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decodeheifimage/src/main/ets/model/WaterFlowData.ets
arkts
图片信息类
export class ImageInfo { data: image.PixelMap | null = null; width: number = 0; height: number = 0; description: string | undefined = undefined; constructor(data: image.PixelMap | null, width: number, height: number, description?: string) { this.data = data; this.width = width; this.height = heig...
AST#export_declaration#Left export AST#class_declaration#Left class ImageInfo AST#class_body#Left { AST#property_declaration#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left nul...
export class ImageInfo { data: image.PixelMap | null = null; width: number = 0; height: number = 0; description: string | undefined = undefined; constructor(data: image.PixelMap | null, width: number, height: number, description?: string) { this.data = data; this.width = width; this.height = heig...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decodeheifimage/src/main/ets/model/WaterFlowData.ets#L21-L33
5fce784816c7d38c7d9577eca8fb028006ba7eba
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets
arkts
handleSearch
防抖搜索处理
handleSearch(keyword: string) { this.searchText = keyword; // 清除之前的定时器 if (this.searchTimerId !== -1) { clearTimeout(this.searchTimerId); } // 设置新的定时器 if (keyword.trim().length > 0) { this.searchTimerId = setTimeout(() => { this.isSearchMode = true; this.sea...
AST#method_declaration#Left handleSearch 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#block_statement#Left { AST#statement#Left AST#expression_statement#Lef...
handleSearch(keyword: string) { this.searchText = keyword; if (this.searchTimerId !== -1) { clearTimeout(this.searchTimerId); } if (keyword.trim().length > 0) { this.searchTimerId = setTimeout(() => { this.isSearchMode = true; this.searchDreams(keyword); ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets#L35-L53
cc1ead995fb923858fdf1b286a7d05d41e42007c
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPPermissionUtils.ets
arkts
checkPasteBoardPermissions
检查粘贴板权限
static async checkPasteBoardPermissions(context: common.UIAbilityContext, onResult: (granted: boolean) => void): Promise<void> { let permissions: Array<Permissions> = ['ohos.permission.READ_PASTEBOARD']; let grantStatus: abilityAccessCtrl.GrantStatus = await DMPPermissionUtils.checkPermissionGrant(permissions[0...
AST#method_declaration#Left static async checkPasteBoardPermissions AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#...
static async checkPasteBoardPermissions(context: common.UIAbilityContext, onResult: (granted: boolean) => void): Promise<void> { let permissions: Array<Permissions> = ['ohos.permission.READ_PASTEBOARD']; let grantStatus: abilityAccessCtrl.GrantStatus = await DMPPermissionUtils.checkPermissionGrant(permissions[0...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPPermissionUtils.ets#L6-L16
fb2cf98522328d6e991648acb6e563e781d697fe
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/utlis/LogUtil.ets
arkts
@deprecated
export default class LogUtil { static config : InitConfig static log(msg: string, ...args: ObjectOrNull[]) { if (LogUtil.hide()) return console.log("ZRouter -> " + msg, ...args) } static error(msg: string, ...args: ObjectOrNull[]) { if (LogUtil.hide()) return console.error("ZRouter -> " + msg,...
AST#export_declaration#Left export default AST#class_declaration#Left class LogUtil AST#class_body#Left { AST#property_declaration#Left static config : AST#type_annotation#Left AST#primary_type#Left InitConfig AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#method_declaration#Left s...
export default class LogUtil { static config : InitConfig static log(msg: string, ...args: ObjectOrNull[]) { if (LogUtil.hide()) return console.log("ZRouter -> " + msg, ...args) } static error(msg: string, ...args: ObjectOrNull[]) { if (LogUtil.hide()) return console.error("ZRouter -> " + msg,...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/utlis/LogUtil.ets#L12-L28
5ef919a5134d729124eb0c9efdbdb3df0de432c4
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/model/CollectInfo.ets
arkts
是否收藏过当前诗句 服务端响应字段
export class IsCollectedResp{ collectFlag:boolean constructor
AST#export_declaration#Left export AST#ERROR#Left class IsCollectedResp { collectFlag : boolean AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class IsCollectedResp{ collectFlag:boolean constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/model/CollectInfo.ets#L2-L5
40a798a99e1beb660e048dd14aec79eb9b21ba36
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionAsync.ets
arkts
genKeyPairByData
生成SM2密钥对
async function genKeyPairByData(pubKeyData: Uint8Array, priKeyData: Uint8Array) { let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKeyData }; let priKeyBlob: cryptoFramework.DataBlob = { data: priKeyData }; let sm2Generator = cryptoFramework.createAsyKeyGenerator('SM2_256'); let keyPair = await sm2Generato...
AST#function_declaration#Left async function genKeyPairByData AST#parameter_list#Left ( AST#parameter#Left pubKeyData : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKeyData : AST#type_annotation#Left AST#primary_ty...
async function genKeyPairByData(pubKeyData: Uint8Array, priKeyData: Uint8Array) { let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKeyData }; let priKeyBlob: cryptoFramework.DataBlob = { data: priKeyData }; let sm2Generator = cryptoFramework.createAsyKeyGenerator('SM2_256'); let keyPair = await sm2Generato...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionAsync.ets#L36-L43
80972edf9cd02190df53b71bd9ebcd661bd809ea
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/FileTypeUtil.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class FileTypeUtil { private fileSignatureMap: Record<string, Array<Uint8Array>> = { // 添加文件类型和对应的文件头部特征 'jpg': [new Uint8Array([0xFF, 0xD8])], 'png': [new Uint8Array([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])], 'gif': [new Uint8Array([0x47, 0x49, 0x46, 0x38, 0x39, 0x61]),new Uint8Array(...
AST#export_declaration#Left export AST#class_declaration#Left class FileTypeUtil AST#class_body#Left { AST#property_declaration#Left private fileSignatureMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#...
export class FileTypeUtil { private fileSignatureMap: Record<string, Array<Uint8Array>> = { 'jpg': [new Uint8Array([0xFF, 0xD8])], 'png': [new Uint8Array([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])], 'gif': [new Uint8Array([0x47, 0x49, 0x46, 0x38, 0x39, 0x61]),new Uint8Array([0x47, 0x49, 0x46, ...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileTypeUtil.ets#L17-L92
f9df97571c1e1ad401f4c7726dbb0839d42f7880
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
delete1stItem
Delete the first element
public delete1stItem(): void { this.dataArray.splice(0, 1); this.notifyDataDelete(0); }
AST#method_declaration#Left public delete1stItem 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#exp...
public delete1stItem(): void { this.dataArray.splice(0, 1); this.notifyDataDelete(0); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L112-L115
3c03e7e1f6a4b8d77a35b183f307d066136633b6
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets
arkts
customContent
自定义内容 @param customContent @returns
customContent<T extends Object>(customContent: VoidCallback | WrappedBuilder<[param: T]>, customParam?: T) { this.builderOptions.contentBuilder = customContent as VoidCallback | WrappedBuilder<[object]>; this.builderOptions.contentParam = customParam; return this; }
AST#method_declaration#Left customContent AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left customContent : ...
customContent<T extends Object>(customContent: VoidCallback | WrappedBuilder<[param: T]>, customParam?: T) { this.builderOptions.contentBuilder = customContent as VoidCallback | WrappedBuilder<[object]>; this.builderOptions.contentParam = customParam; return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets#L58-L62
3fd1fc2ed5909c3e8c45a6711ed1c3dbc7f236a3
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
OrderNumberValue
订单号展示区域 @returns {void} 无返回值
@Builder private OrderNumberValue(order: Order) { RowStartCenter() { Text(order.orderNum) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_secondary")); SpaceHorizontalSmall(); Text($r("app.string.copy")) .fontSize($r("app.float.body_medium")) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderNumberValue AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_func...
@Builder private OrderNumberValue(order: Order) { RowStartCenter() { Text(order.orderNum) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.text_secondary")); SpaceHorizontalSmall(); Text($r("app.string.copy")) .fontSize($r("app.float.body_medium")) ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L346-L361
5a3c6113215f443b2579ab629163a5ff27f1a573
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
SwipeCellActions
构建滑动单元格操作区 @param {DemoEntity} item - 记录数据 @returns {void} 无返回值
@Builder private SwipeCellActions(item: DemoEntity): void { Row() { IBestIcon({ name: "delete-o", iconSize: 20, onIconClick: (): void => { if (this.vm.loading) { return; } void this.vm.delete(item.id ?? 0); } }); } .padd...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SwipeCellActions AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DemoEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a...
@Builder private SwipeCellActions(item: DemoEntity): void { Row() { IBestIcon({ name: "delete-o", iconSize: 20, onIconClick: (): void => { if (this.vm.loading) { return; } void this.vm.delete(item.id ?? 0); } }); } .padd...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L166-L184
aadf250f71fc01e548d5b49fa1f5e16f27554513
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customtabbar/src/main/ets/util/CustomTabBar.ets
arkts
CustomTabBar
功能描述: 1. 将Image组件外层包裹一层容器组件,通过设置borderRadius以及margin的top值实现圆弧外轮廓效果 2. 通过当前被选中的tabBar下标值和tabBar自己的下标值进行判断来达到点击之后改变图标显示的效果 实现原理: 场景1:TabBar中间页面如何实现有一圈圆弧外轮廓 可以将Image外层包括一层容器组件,通过设置borderRadius以及margin的top值实现圆弧外轮廓效果。 这里borderRadius的值设置为容器组件宽度的一半,margin的top值根据开发者的ux效果设置合适的值即可。 场景2:TabBar页签点击之后会改变图标显示,并有一小段动画效果 改变图标显示可以声明一个...
@Component export struct CustomTabBar { // ----------------对外暴露变量---------------- // 配置起始的页签索引(必传) @Link selectedIndex: number; // tabBar数据 tabsInfo: TabBarInfo[] = []; // ------------------私有属性----------------- // 初始化tabBar图片的偏移量 @State iconOffset: number = 0; @StorageLink('avoidAreaBottomToModule') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { // ----------------对外暴露变量---------------- // 配置起始的页签索引(必传) AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right selectedIndex : AST#type_annotation#Left AS...
@Component export struct CustomTabBar { @Link selectedIndex: number; tabsInfo: TabBarInfo[] = []; @State iconOffset: number = 0; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customtabbar/src/main/ets/util/CustomTabBar.ets#L41-L160
609f4bfeb2d3b26ef77f274a1f98a44ca985114e
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/Utils/FormIdStore.ets
arkts
getAllFormIds
3. 获取所有 formId (用于批量更新)
static async getAllFormIds(context: common.Context): Promise<string[]> { try { const store = await FormIdStore.getStore(context); const currentStr = await store.get(KEY_FORM_IDS, '[]') as string; return JSON.parse(currentStr); } catch (err) { console.error(`[FormIdStore] Failed to get fo...
AST#method_declaration#Left static async getAllFormIds AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right :...
static async getAllFormIds(context: common.Context): Promise<string[]> { try { const store = await FormIdStore.getStore(context); const currentStr = await store.get(KEY_FORM_IDS, '[]') as string; return JSON.parse(currentStr); } catch (err) { console.error(`[FormIdStore] Failed to get fo...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/Utils/FormIdStore.ets#L52-L61
39bc4d910966fcc847fd13688e3aaec0d3e448f2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
markNotificationAsRead
标记通知为已读
async markNotificationAsRead(notificationId: string): Promise<boolean> { try { // TODO: 标记通知为已读 hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Notification marked as read: ${notificationId}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TA...
AST#method_declaration#Left async markNotificationAsRead AST#parameter_list#Left ( AST#parameter#Left notificationId : 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 AS...
async markNotificationAsRead(notificationId: string): Promise<boolean> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Notification marked as read: ${notificationId}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L593-L603
ca08ca90f1b8662f0dce420fcc5e130af8e5df08
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
documentViewPickerSelect
注意:仅供UI展示使用 封装后的documentViewPicker的Select方法,需要被注册到native侧 @param uiContext:调用本方法的UIContext @param options:拉起picker时的options参数 @param thenWrapper:开发者自定义的then回调 @param catchWrapper:开发者自定义的catch回调
function documentViewPickerSelect(uiContext: UIContext, options: picker.DocumentSelectOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { // TODO:知识点:使用对应UIAbility的UIContext.runScopedTask来执行方法,确保多实例情况下,事件在正确的窗口/UIAbility内发生 uiContext.runScopedTask(() => { logger.debug("enter ets ...
AST#function_declaration#Left function documentViewPickerSelect AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#...
function documentViewPickerSelect(uiContext: UIContext, options: picker.DocumentSelectOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { uiContext.runScopedTask(() => { logger.debug("enter ets select"); logger.debug(JSON.stringify(uiContext)); const documentViewPicker: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L47-L73
168556e9f7eff165374338927a3396961091ebd9
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
API响应结构
export interface ApiResponse<T> { code: number; message: string; data: T; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ApiResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ...
export interface ApiResponse<T> { code: number; message: string; data: T; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L185-L189
1f2d3e567058e38a9f769b8239b8187114490705
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LogUtil.ets
arkts
info
打印INFO级别日志 @param args
static info(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.INFO); }
AST#method_declaration#Left static info AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#pr...
static info(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.INFO); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L94-L96
e62977287c314a9aad72031b2400f579b7da08b9
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/function_override/constructor_extends_001_T.ets
arkts
Introduction 函数重载-构造函数-super Level 2
export function constructor_extends_001_T(taint_src : string) { let derived = new DerivedClass(taint_src) derived.process() }
AST#export_declaration#Left export AST#function_declaration#Left function constructor_extends_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_sta...
export function constructor_extends_001_T(taint_src : string) { let derived = new DerivedClass(taint_src) derived.process() }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_override/constructor_extends_001_T.ets#L7-L11
04aec7174ee43f53af5af3e27a019db967086f99
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/cs/src/main/ets/view/ChatPage.ets
arkts
构建客服聊天页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "客服聊天", viewModel: this.vm }) { this.ChatContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "客服聊天" AST#expression#Right AST#component_parameter#Right , AST#component_...
build() { AppNavDestination({ title: "客服聊天", viewModel: this.vm }) { this.ChatContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/cs/src/main/ets/view/ChatPage.ets#L20-L27
be1a3ca389c650bed7b58e203e4729d8e0109333
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets
arkts
ProgressButton
@file @kit ArkUI Declare Component ProgressButton @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare Component ProgressButton @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Component export declare struct ProgressButton { /** * Sets the ProgressButton progress. * @type { number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the ProgressButton progress. * @type { number }. * @syscap SystemCapability.ArkUI.ArkUI.Full...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ProgressButton AST#component_body#Left { /** * Sets the ProgressButton progress. * @type { number }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 ...
@Component export declare struct ProgressButton { @Prop progress: number; @Prop content: string; progressButtonWidth?: Length; clickCallback: () => void; @Prop enable: boolean; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets#L30-L105
6e51dcfefcab03fd1d1bbcbbdca48fe3765c70ef
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/CameraService.ets
arkts
testConnection
测试摄像头服务连接 @returns Promise<boolean> 连接测试结果
static async testConnection(): Promise<boolean> { try { console.info('[CameraService] 🔍 测试摄像头服务连接'); const devices = await CameraService.getCameraDevices(); const isConnected = devices.length >= 0; // 即使没有设备,能正常响应也算连接成功 const logInfo: ConnectionLogInfo = { isConnected:...
AST#method_declaration#Left static async testConnection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > ...
static async testConnection(): Promise<boolean> { try { console.info('[CameraService] 🔍 测试摄像头服务连接'); const devices = await CameraService.getCameraDevices(); const isConnected = devices.length >= 0; const logInfo: ConnectionLogInfo = { isConnected: isConnected, ...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L241-L259
828dc2e72e42fd30847bc7b8c9bfb1c722d11d6a
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
animation/entry/src/main/ets/pages/ExplicitAnimateTo.ets
arkts
ExplicitAnimateTo
[Start explicit_animate_to]
@Component export struct ExplicitAnimateTo { @State widthSize: number = 80; @State heightSize: number = 40; @State flag: boolean = true; build() { Column() { Column() { Row() { Button() .width(this.widthSize) .height(this.heightSize) .margin(20) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ExplicitAnimateTo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right widthSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#typ...
@Component export struct ExplicitAnimateTo { @State widthSize: number = 80; @State heightSize: number = 40; @State flag: boolean = true; build() { Column() { Column() { Row() { Button() .width(this.widthSize) .height(this.heightSize) .margin(20) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/animation/entry/src/main/ets/pages/ExplicitAnimateTo.ets#L17-L180
1f7fd2b5182ac951b36388875d75e7b982db1b04
gitee
DEMON-coding/HarmonyOs-Clock-Demo.git
f3c71a3d5ac478d463dfed068b89582104d2f9f6
entry/src/main/ets/common/utils/FlipNumber.ets
arkts
FlipNumber
FlipNumber.ets
@Component export struct FlipNumber { @Prop value: string @State displayValue: string = '' aboutToAppear() { this.displayValue = this.value }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlipNumber AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation...
@Component export struct FlipNumber { @Prop value: string @State displayValue: string = '' aboutToAppear() { this.displayValue = this.value }
https://github.com/DEMON-coding/HarmonyOs-Clock-Demo.git/blob/f3c71a3d5ac478d463dfed068b89582104d2f9f6/entry/src/main/ets/common/utils/FlipNumber.ets#L2-L9
db0b9b084709969621ac485fe64e9898339a6043
github
Classaspen/ArkTS_PasswordManagement.git
66aea6e4f8ee3a78e5029c63186dba70707ca2d9
entry/src/main/ets/components/database/Database.ets
arkts
getLocalDeviceNetworkId
Get local device ID.
getLocalDeviceNetworkId() { try { // create deviceManager. const deviceManager = distributedDeviceManager.createDeviceManager('com.example.crossDeviceDataSynchronization'); // DeviceIds is obtained by calling the getAvailableDeviceListSync method by the DeviceManager. if (deviceManager != nu...
AST#method_declaration#Left getLocalDeviceNetworkId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // create deviceManager. AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left device...
getLocalDeviceNetworkId() { try { const deviceManager = distributedDeviceManager.createDeviceManager('com.example.crossDeviceDataSynchronization'); if (deviceManager != null) { this.localDeviceNetworkId = deviceManager.getLocalDeviceNetworkId(); hilog.info(0x0000, 'hilog', ...
https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/database/Database.ets#L171-L185
1f6e99204597218eae2fa97f0f88b083110e905b
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Describes a region, which is used to describe the region where the shape can be drawn. @syscap SystemCapability.Graphics.Drawing @since 12
export class Region { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
AST#export_declaration#Left export AST#class_declaration#Left class Region AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_list#...
export class Region { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L1200-L1201
6c4b247eb1af2423b5de356d238cf704325bc9ec
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/ToastUtil.ets
arkts
TODO 土司工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ToastUtil { private static defaultConfig: ToastConfig = new ToastConfig(); //默认样式 /** * 设置默认统一样式 * @param configs */ static setDefaultConfig(configs: (config: ToastConfig) => void): void { configs(ToastUtil.defaultConfig); } /** * 弹出土司,默认时长为2s,距离底部默认为80vp * @param message ...
AST#export_declaration#Left export AST#class_declaration#Left class ToastUtil AST#class_body#Left { AST#property_declaration#Left private static defaultConfig : AST#type_annotation#Left AST#primary_type#Left ToastConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#...
export class ToastUtil { private static defaultConfig: ToastConfig = new ToastConfig(); static setDefaultConfig(configs: (config: ToastConfig) => void): void { configs(ToastUtil.defaultConfig); } static showToast(message: string | Resource, options?: ToastOptions) { if (message || (typeof me...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L27-L138
e7c90384d0fbc059615c0c2c1c5041284216d2c0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getAppProvisionType
获取应用程序签名证书文件的类型,分为debug和release两种类型。 @returns
static getAppProvisionType(): string { return AppUtil.getAppInfoSync().appProvisionType; }
AST#method_declaration#Left static getAppProvisionType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#memb...
static getAppProvisionType(): string { return AppUtil.getAppInfoSync().appProvisionType; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L552-L554
7c2e3cc13a9017a556ee731f6ad87817cba46235
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getCurrentDateTime
获取当前日期时间字符串 @param format 格式 @returns 格式化的当前日期时间
static getCurrentDateTime(format: string = DateFormatConstants.DATETIME_FORMAT): string { return DateUtils.formatDate(new Date(), format); }
AST#method_declaration#Left static getCurrentDateTime AST#parameter_list#Left ( AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DateFormatConstants AST#expression#Right...
static getCurrentDateTime(format: string = DateFormatConstants.DATETIME_FORMAT): string { return DateUtils.formatDate(new Date(), format); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L127-L129
9acc0290bb1affd5cfdf34448d3e7ba42244e81f
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Modifies the zone's name, renaming the folder on disk. @param original Original name. @param after New name.
export function modify_zone_name(original: string, after: string) { sandbox_rename_sync('zones/' + original, 'zones/' + after); refresh_AppStorage_zones(); }
AST#export_declaration#Left export AST#function_declaration#Left function modify_zone_name AST#parameter_list#Left ( AST#parameter#Left original : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left after : AST#type_annotation#L...
export function modify_zone_name(original: string, after: string) { sandbox_rename_sync('zones/' + original, 'zones/' + after); refresh_AppStorage_zones(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L43-L46
2bb8c039d8eda5f60823e7beb539648aae68368e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowSpaceEvenlyCenter
横向均分 + 垂直居中
@ComponentV2 export struct RowSpaceEvenlyCenter { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Para...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceEvenlyCenter AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_...
@ComponentV2 export struct RowSpaceEvenlyCenter { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L545-L620
80710d624c8f507c4e9856770127873cc7d4dd2e
github
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
entry/src/main/ets/bridge/JsBridge2.ets
arkts
@author: HZWei @date: 2024/7/6 @desc: 测试DSBridge2.0脚本
export class JsBridge2 { @JavaScriptInterface(false) testComponentSync(args: string): Object { const jsParam = JSON.parse(args) as JsParam LogUtils.d(jsParam.msg ?? '') // return `组件中的同步方法: ${jsParam.msg}` return `${jsParam.msg}` } @JavaScriptInterface(false) testNoArgSync(): number { re...
AST#export_declaration#Left export AST#class_declaration#Left class JsBridge2 AST#class_body#Left { AST#method_declaration#Left AST#decorator#Left @ JavaScriptInterface ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#decorator#Right testComponentSync AST#paramet...
export class JsBridge2 { @JavaScriptInterface(false) testComponentSync(args: string): Object { const jsParam = JSON.parse(args) as JsParam LogUtils.d(jsParam.msg ?? '') return `${jsParam.msg}` } @JavaScriptInterface(false) testNoArgSync(): number { return 1 + 2 } @JavaScriptInterfa...
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/entry/src/main/ets/bridge/JsBridge2.ets#L11-L63
ed353fddc9a761529b9eff1b897b316d14adb6aa
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/partView/ActionSheetItemBuilder.ets
arkts
ActionSheetItemBuilder
列表Item
@Builder export function ActionSheetItemBuilder(click: (i:number)=>void, style: IBottomActionSheetDialogStyle|undefined, sheet: ActionSheetItemOptions, length: number, index: number) { Column() { Text(sheet.value) .fontSize(sheet.fontSize ?? 16) .fontColor(sheet.fontColor ?? $r('app.color.harmony_di...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ActionSheetItemBuilder AST#parameter_list#Left ( AST#parameter#Left click : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Le...
@Builder export function ActionSheetItemBuilder(click: (i:number)=>void, style: IBottomActionSheetDialogStyle|undefined, sheet: ActionSheetItemOptions, length: number, index: number) { Column() { Text(sheet.value) .fontSize(sheet.fontSize ?? 16) .fontColor(sheet.fontColor ?? $r('app.color.harmony_di...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/partView/ActionSheetItemBuilder.ets#L5-L37
3e90a947788314ef77ef0c8cc2160eac6cd726bb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets
arkts
setVideoStabilizationMode
设置视频防抖。
function setVideoStabilizationMode(session: camera.VideoSession): boolean { let mode: camera.VideoStabilizationMode = camera.VideoStabilizationMode.AUTO; // 查询是否支持视频防抖 let isSupported: boolean = isVideoStabilizationModeSupported(session, mode); if (isSupported) { Logger.info(TAG, `setVideoStabilizationMode:...
AST#function_declaration#Left function setVideoStabilizationMode AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet...
function setVideoStabilizationMode(session: camera.VideoSession): boolean { let mode: camera.VideoStabilizationMode = camera.VideoStabilizationMode.AUTO; let isSupported: boolean = isVideoStabilizationModeSupported(session, mode); if (isSupported) { Logger.info(TAG, `setVideoStabilizationMode: ${mode}`); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets#L87-L101
a506d817902fe767910027d55544174759a4d073
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FoldableGuilde/entry/src/main/ets/utils/source_add1.ets
arkts
ScrollTest
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component // [Start ScrollTest] export struct ScrollTest { // Height of fixed area @State barHeight: number = 56; // Transparency of fixed area @State barOpacity: number = 1; // Current y-axis sliding offset @State currentYOffset: number = 0; build() { List() { // [StartExclude ScrollTest] ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right // [Start ScrollTest] export struct ScrollTest AST#component_body#Left { // Height of fixed area AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right barHeight : AST#type_annotation#Left AST#primary_type#Lef...
@Component export struct ScrollTest { @State barHeight: number = 56; @State barOpacity: number = 1; @State currentYOffset: number = 0; build() { List() { ForEach(new Array(100).fill(''), () => { ListItem() { Text('北京') .fontSize(24) } }, (i...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/utils/source_add1.ets#L16-L67
5a7f5db020a54798d7e94a99e6ece7418ccb45e0
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/DateUtils.ets
arkts
isToday
判断是否为今天
static isToday(date: Date): boolean { const today = new Date(); return date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate(); }
AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
static isToday(date: Date): boolean { const today = new Date(); return date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate(); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L82-L87
be49726fca88e943a6b1b2276b5400b6f883a29e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets
arkts
onDisconnectService
断开连接
async onDisconnectService() { if (this.connectedAbility == null) { return; } await featureAbility.disconnectAbility(this.connectedAbility); this.connectedAbility = null; prompt.showToast({ message: "onDisconnectService disconnect done" }); }
AST#method_declaration#Left async onDisconnectService AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right ...
async onDisconnectService() { if (this.connectedAbility == null) { return; } await featureAbility.disconnectAbility(this.connectedAbility); this.connectedAbility = null; prompt.showToast({ message: "onDisconnectService disconnect done" }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets#L90-L99
102dabab84b5db3d6fb6845c84817db260f12a14
gitee