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
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets
arkts
Install the application package in the specified path. @param filePath An array of paths to hold the installation package. @permission ohos.permission.INSTALL_BUNDLE
export async function installBundle(filePath: Array<string>): Promise<void> { try { let bundleInstall = await bundle.getBundleInstaller(); let userId = await account.getAccountManager().getOsAccountLocalIdFromProcess(); bundleInstall.install(filePath, { userId: userId, installFlag:...
AST#export_declaration#Left export AST#function_declaration#Left async function installBundle AST#parameter_list#Left ( AST#parameter#Left filePath : 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 string AST#primary_typ...
export async function installBundle(filePath: Array<string>): Promise<void> { try { let bundleInstall = await bundle.getBundleInstaller(); let userId = await account.getAccountManager().getOsAccountLocalIdFromProcess(); bundleInstall.install(filePath, { userId: userId, installFlag:...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets#L93-L108
1b541cb6d56dfa7164c2a984a61c757d715777ce
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderRefundPage.ets
arkts
PageContent
页面内容 @returns {void} 无返回值
@Builder private PageContent(): void { ColumnStart({ fillMaxSize: true }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderRefundContent() }) .layoutWeight(1); if (this.vm.uiState === BaseNe...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private PageContent(): void { ColumnStart({ fillMaxSize: true }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderRefundContent() }) .layoutWeight(1); if (this.vm.uiState === BaseNe...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L60-L89
308d138670baa4f676b3b9ae56b37a89e1cf5399
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
openNotificationSettings
拉起应用的通知设置界面,该页面以半模态形式呈现,可用于设置通知开关、通知提醒方式等。使用Promise异步回调。 @param context @returns
static async openNotificationSettings(context: common.UIAbilityContext = ArkWebHelper.getContext()): Promise<void> { if (Tools.isApiSupported(13)) { return await notificationManager.openNotificationSettings(context); } else { //兜底 return await Tools.toNotificationSetting(); } }
AST#method_declaration#Left static async openNotificationSettings 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#expression#Left AST#ca...
static async openNotificationSettings(context: common.UIAbilityContext = ArkWebHelper.getContext()): Promise<void> { if (Tools.isApiSupported(13)) { return await notificationManager.openNotificationSettings(context); } else { return await Tools.toNotificationSetting(); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L82-L88
29c4216a34dcef02dd30164a515e694b9a57c5a9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/vibrateeffect/Index.ets
arkts
VibrateEffectViewComponent
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 { VibrateEffectViewComponent } from './src/main/ets/VibrateEffect';
AST#export_declaration#Left export { VibrateEffectViewComponent } from './src/main/ets/VibrateEffect' ; AST#export_declaration#Right
export { VibrateEffectViewComponent } from './src/main/ets/VibrateEffect';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/Index.ets#L16-L16
161a0f9c7e15ec2565e94c9e973aa02815e11742
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/LearnClockApi.type.ets
arkts
学习打卡入参
export interface LearnClockParam { /** * 打卡地点 */ location: string /** * 打卡内容 */ content: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface LearnClockParam AST#object_type#Left { /** * 打卡地点 */ AST#type_member#Left location : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * 打卡内容 */ AST#type...
export interface LearnClockParam { location: string content: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/LearnClockApi.type.ets#L4-L13
f7a0972d569e35ee1d87b9b9ef75035124046f6e
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/LikeComponent.ets
arkts
getLikeIndex
@description: 获取点赞是否点过赞,-1为没有点过赞 @date: 2024-03-12 22:09 @author wuwenqiang
getLikeIndex():number{ return this.mLikeList.findIndex((item:LikeInterface) => item.userId === this.userData.userAccount); }
AST#method_declaration#Left getLikeIndex 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#call_expression#Le...
getLikeIndex():number{ return this.mLikeList.findIndex((item:LikeInterface) => item.userId === this.userData.userAccount); }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/LikeComponent.ets#L34-L36
fe7b19bdc0f09d0f1d758e08da204fab0ebf2fd1
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
formatDateDisplay
格式化日期显示 (YYYY-MM-DD -> MM月DD日 星期X)
formatDateDisplay(dateStr: string): string { const date = new Date(dateStr); const month = date.getMonth() + 1; const day = date.getDate(); const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; const weekDay = weekDays[date.getDay()]; return `${month}月${day}日 ${weekDay}`; }
AST#method_declaration#Left formatDateDisplay AST#parameter_list#Left ( AST#parameter#Left dateStr : 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...
formatDateDisplay(dateStr: string): string { const date = new Date(dateStr); const month = date.getMonth() + 1; const day = date.getDate(); const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; const weekDay = weekDays[date.getDay()]; return `${month}月${day}日 ${weekDay}`; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L211-L218
441f588046c5e5d664fb4ecc5bd863adde11b399
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/Index.ets
arkts
PromptActionClass
不依赖UI组件的全局自定义弹出框 (openCustomDialog)
export { PromptActionClass } from './src/main/ets/utils/PromptActionClass'
AST#export_declaration#Left export { PromptActionClass } from './src/main/ets/utils/PromptActionClass' AST#export_declaration#Right
export { PromptActionClass } from './src/main/ets/utils/PromptActionClass'
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/Index.ets#L27-L27
ffb4160e7065c22a0efd13ad3b07b1beac848e36
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/action/ToastUtil.ets
arkts
showLong
弹出土司,时长为:10s,距离底部默认为80vp @param message 提示消息 @param options (距离屏幕底部的位置、是否显示在应用之上)
static showLong(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 2); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options.u...
AST#method_declaration#Left static showLong AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ,...
static showLong(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 2); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options.u...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L76-L83
fbc185a6bf2f1df932853e8e66a26280a23da86c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
touchInLeftThumb
判断左边滑块滑动
touchInLeftThumb(event?: GestureEvent): boolean { logger.info(TAG, ' touchInLeftThumb'); let pointX: number = this.clearUndefined(event?.fingerList[0].localX); let pointY: number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
AST#method_declaration#Left touchInLeftThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri...
touchInLeftThumb(event?: GestureEvent): boolean { logger.info(TAG, ' touchInLeftThumb'); let pointX: number = this.clearUndefined(event?.fingerList[0].localX); let pointY: number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L441-L447
0681e7a36785060340371457787849ef7adc01e1
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
init
@Override
protected init(): void { super.init(); this.mRenderer = new BarChartRenderer(this, this.mAnimator!, this.mViewPortHandler); this.setHighlighter(new BarHighlighter(this)); let xAxis: XAxis | null = this.getXAxis(); if (xAxis) { xAxis.setSpaceMin(0.5); xAxis.setSpaceMax(0.5); } }
AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left ...
protected init(): void { super.init(); this.mRenderer = new BarChartRenderer(this, this.mAnimator!, this.mViewPortHandler); this.setHighlighter(new BarHighlighter(this)); let xAxis: XAxis | null = this.getXAxis(); if (xAxis) { xAxis.setSpaceMin(0.5); xAxis.setSpaceMax(0.5); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L78-L90
5afd6af1ad913450e76abc7999ce1c156906d6fb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets
arkts
socketConnTask
socket连接任务 1、未连接则尝试连接 2、已连接,socket状态正常,wifi状态正常,则任务执行完毕 3、已连接,socket状态不正常或wifi状态不正常,则回调连接已断开 这些逻辑是为了解决 网络断开后 socket onError或onClose 方法无回调或getState状态错误的问题
private async socketConnTask(): Promise<void> { if (this.mSocketImpl == null) { this.mSocketImpl = new SocketImpl(); } let wifiState: boolean = await this.checkWifiState(); let socketConnected: boolean = await this.isConnected(); Logger.log(TAG, `socketConnTask wifiState = ${wifiState} socket...
AST#method_declaration#Left private async socketConnTask 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 > AS...
private async socketConnTask(): Promise<void> { if (this.mSocketImpl == null) { this.mSocketImpl = new SocketImpl(); } let wifiState: boolean = await this.checkWifiState(); let socketConnected: boolean = await this.isConnected(); Logger.log(TAG, `socketConnTask wifiState = ${wifiState} socket...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets#L148-L177
c36b54d95d62408e17180f278eca76f03c40b925
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/customView/MpSelect.ets
arkts
MpSelect
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@ComponentV2 export default struct MpSelect { @Require @Param name: string | Resource @Require @Param selectItem: Object @Event $selectItem: (selectItem: Object) => void = (selectItem: Object) => {}; @Require @Param itemsList: Array<Object> @Require @Param valuesList: Array<ValueObject> build() { Row()...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export default struct MpSelect AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right name : AST#type_annotation#Left AST#union_type...
@ComponentV2 export default struct MpSelect { @Require @Param name: string | Resource @Require @Param selectItem: Object @Event $selectItem: (selectItem: Object) => void = (selectItem: Object) => {}; @Require @Param itemsList: Array<Object> @Require @Param valuesList: Array<ValueObject> build() { Row()...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/customView/MpSelect.ets#L16-L36
93f8a905e7c0f89d04ad3fa8107635bdc09d5a2b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
removeNode
Delete a node. Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Delete a node. Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. @sysca...
removeNode(): void;
AST#method_declaration#Left removeNode 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#method_declaration#Right
removeNode(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L513-L513
889977b1c456feae90d2491f54096279e23a7b0f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
write
将数据写入文件,使用Promise异步回调。 @param fd number 已打开的文件描述符。 @param buffer ArrayBuffer|string 待写入文件的数据,可来自缓冲区或字符串。 @param options 支持如下选项: offset,number类型,表示期望写入文件的位置。可选,默认从当前位置开始写。 length,number类型,表示期望写入数据的长度。可选,默认缓冲区长度。 encoding,string类型,当数据是string类型时有效,表示数据的编码方式,默认 'utf-8'。当前仅支持 'utf-8'。 @returns Promise对象。返回实际写入的数据长度,单位字节。
static write(fd: number, buffer: ArrayBuffer | string, options?: WriteOptions): Promise<number> { return fs.write(fd, buffer, options) }
AST#method_declaration#Left static write AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ArrayBuff...
static write(fd: number, buffer: ArrayBuffer | string, options?: WriteOptions): Promise<number> { return fs.write(fd, buffer, options) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L479-L481
6375ec9b7887fc8f2a218350eae6e61316f751e8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/MultiDeviceAppDev/AppMarket/entry/src/main/ets/MainAbility/app.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default { onCreate() { console.info('[Sample_appMarket] Application onCreate') }, onDestroy() { console.info('[Sample_appMarket] Application onDestroy') }, }
AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCreate AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le...
export default { onCreate() { console.info('[Sample_appMarket] Application onCreate') }, onDestroy() { console.info('[Sample_appMarket] Application onDestroy') }, }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/AppMarket/entry/src/main/ets/MainAbility/app.ets#L16-L23
ecde3ef4328acd1d07d1137068851b9a93888ba0
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/TaskModel.ets
arkts
loadCompletedTasks
加载已完成任务
static async loadCompletedTasks(): Promise<TaskItem[]> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return []; } try { const tasksStr = await DataStorage.prefsInstance.get(DataStorage.KEY_COMPLETED_TASKS, '[]') as string; const tasks = JSON.parse(...
AST#method_declaration#Left static async loadCompletedTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right A...
static async loadCompletedTasks(): Promise<TaskItem[]> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return []; } try { const tasksStr = await DataStorage.prefsInstance.get(DataStorage.KEY_COMPLETED_TASKS, '[]') as string; const tasks = JSON.parse(...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L85-L99
9cc6274302cc2ee7ed2da2546c0fbb23d1a67799
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setEntryLabelColor
Sets the color the entry labels are drawn with. @param color
public setEntryLabelColor(color: number): void { ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintEntryLabels().setColor(color); }
AST#method_declaration#Left public setEntryLabelColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima...
public setEntryLabelColor(color: number): void { ( this.mRenderer as PieChartRenderer).getPaintEntryLabels().setColor(color); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L719-L722
f14a96cc494e57e4b7dce514ac44b244f5c9020e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnCenter
纵向居中 + 水平居中
@ComponentV2 export struct ColumnCenter { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Par...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnCenter AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#...
@ComponentV2 export struct ColumnCenter { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @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/Column.ets#L145-L220
432d1b727f69882430d66938c5b421421381def0
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
getCityData
获取城市数据 @param prevCode 省code @returns
private getCityData(prevCode: string): Array<City> { return (this.provinceList.filter((pro: City) => pro.code == prevCode).pop() as City).children; }
AST#method_declaration#Left private getCityData AST#parameter_list#Left ( AST#parameter#Left prevCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
private getCityData(prevCode: string): Array<City> { return (this.provinceList.filter((pro: City) => pro.code == prevCode).pop() as City).children; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L116-L118
016154a1b0c423c88a0cb706213b29065d13bf06
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderConfirmPage.ets
arkts
RemarkTitle
订单备注标题 @returns {void} 无返回值
@Builder private RemarkTitle() { TitleWithLine({ text: $r("app.string.order_remark_title") }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RemarkTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression...
@Builder private RemarkTitle() { TitleWithLine({ text: $r("app.string.order_remark_title") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L263-L268
c0e8e2c4390ee633e67b5f2ac25ba331910e82fc
github
zeroone001/harmonyAPP.git
49c8fa1b56de89cb7513b25f3b1b753ba857968a
features/quickstart/src/main/ets/pages/QuickStartPage.ets
arkts
QuickStartPage
@Entry
@Component export struct QuickStartPage { @State message: string = '快速入门111'; // 在这里定义 new NavPathStack(); @Provide('articlePathStack') articlePathStack: NavPathStack = new NavPathStack(); @Builder quickStartRouter(name: string, param?: ArticleClass | BannerClass) { if (name === 'articleDetail') { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct QuickStartPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
@Component export struct QuickStartPage { @State message: string = '快速入门111'; @Provide('articlePathStack') articlePathStack: NavPathStack = new NavPathStack(); @Builder quickStartRouter(name: string, param?: ArticleClass | BannerClass) { if (name === 'articleDetail') { ArticleDetailPage() } el...
https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/features/quickstart/src/main/ets/pages/QuickStartPage.ets#L15-L52
00c9dd89955a6ab61cdee9351a85701e876f3333
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
notifyDataDelete
Notify the controller of the deletion of data
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); }
AST#method_declaration#Left notifyDataDelete 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...
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L53-L57
9ef32907eda0d4a1c19f881e01f0f6e22de1c29d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
arkts
getColor
获取公历日期字体颜色(仅用于月视图和周视图) @param day 日期信息 @param month 月份 @param currentSelectDay 当前选择的日期 @param calendarViewType 日历视图类型 @param CalendarStyle 自定义日历样式 @returns 返回颜色
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && c...
AST#method_declaration#Left static getColor AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left Day AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && c...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L33-L51
b08be0a8c1ec05072cdd8018e81e051611f5301a
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/common/utils/Logger.ets
arkts
warn
Outputs warning-level logs. @param args Indicates the log parameters.
warn(...args: string[]) { hilog.warn(this.domain, this.prefix, this.format, args); }
AST#method_declaration#Left warn AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST...
warn(...args: string[]) { hilog.warn(this.domain, this.prefix, this.format, args); }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/common/utils/Logger.ets#L56-L58
fad45d11def2af24538d51c6ded49b521a0cfbea
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/HomePage.ets
arkts
HomePage
@file 首页视图 @author Joker.X
@ComponentV2 export struct HomePage { /** * 首页 ViewModel */ @Local private vm: HomeViewModel = new HomeViewModel(); /** * 列表滚动控制器,用于刷新同步 */ private listScroller: Scroller = new Scroller(); /** * 构建首页 * @returns {void} 无返回值 */ build() { AppNavDestination({ viewModel: this.vm...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomePage AST#component_body#Left { /** * 首页 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left HomeViewModel A...
@ComponentV2 export struct HomePage { @Local private vm: HomeViewModel = new HomeViewModel(); private listScroller: Scroller = new Scroller(); build() { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, }) { HomeTopBar(); BaseNetWorkListView({ uiState:...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/HomePage.ets#L17-L134
e1e3a4bc6a89c4b9d4dc849b9af0a2a5638968ef
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/forEach.d.ets
arkts
declare ForEachAttribute @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @form @atomicservice @since 20
export interface ForEachAttribute {}
AST#export_declaration#Left export AST#interface_declaration#Left interface ForEachAttribute AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ForEachAttribute {}
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/forEach.d.ets#L36-L36
e004759edf78c9ca3072e14cf280bcea345b0431
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets
arkts
content
弹窗内容 @param content @returns
content(content: ResourceStr) { this.builderOptions.content = content return this; }
AST#method_declaration#Left content AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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...
content(content: ResourceStr) { this.builderOptions.content = content return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets#L39-L42
a20f60582fcabe3e3af9dda409eeea67d507fa02
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDateGrid
日期网格
@Builder buildDateGrid() { Column({ space: 4 }) { // 创建6行日期网格 ForEach(this.getWeekArray(), (week: number) => { Row() { ForEach(this.getDayArray(), (dayOfWeek: number) => { this.buildDateCell(week, dayOfWeek) }, (dayOfWeek: number) => `day_${week}_${dayOfWeek}`) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDateGrid AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_param...
@Builder buildDateGrid() { Column({ space: 4 }) { ForEach(this.getWeekArray(), (week: number) => { Row() { ForEach(this.getDayArray(), (dayOfWeek: number) => { this.buildDateCell(week, dayOfWeek) }, (dayOfWeek: number) => `day_${week}_${dayOfWeek}`) } ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2609-L2623
ef9b2a37c8df84dc40e9253c8d9d1778cd7cf186
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/constants/AppConstants.ets
arkts
应用信息(兼容性)
export class AppInfo { static readonly NAME: string = AppConstants.APP_NAME; static readonly VERSION: string = AppConstants.APP_VERSION; static readonly APP_VERSION: string = AppConstants.APP_VERSION; static readonly BUILD: string = AppConstants.APP_BUILD; }
AST#export_declaration#Left export AST#class_declaration#Left class AppInfo AST#class_body#Left { AST#property_declaration#Left static readonly NAME : 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#Le...
export class AppInfo { static readonly NAME: string = AppConstants.APP_NAME; static readonly VERSION: string = AppConstants.APP_VERSION; static readonly APP_VERSION: string = AppConstants.APP_VERSION; static readonly BUILD: string = AppConstants.APP_BUILD; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L152-L157
ede00f9135e250c23b86a46a9a3d20aeb7fdb84e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets
arkts
onComponentShow
组件出现时执行,包括前后台切换
async onComponentShow() { // TODO:知识点:检测应用是否已被用户允许使用相机权限,未授权向申请授权 const isGranted = await this.customScanVM.reqCameraPermission(); if (!isGranted && !this.isDialogShow) { // 用户未授权,给出提示 this.dialogController.open(); this.isDialogShow = true; } this.isGranted = isGranted; }
AST#method_declaration#Left async onComponentShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO:知识点:检测应用是否已被用户允许使用相机权限,未授权向申请授权 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isGranted = AST#expression#Left AST#call_expression#Left AST#expre...
async onComponentShow() { const isGranted = await this.customScanVM.reqCameraPermission(); if (!isGranted && !this.isDialogShow) { this.dialogController.open(); this.isDialogShow = true; } this.isGranted = isGranted; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets#L84-L93
2e874f3724ed596094038cae9989e790cae0b04f
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/LoginPage.ets
arkts
aboutToAppear
生命周期中只被调用一次,类似于iOS中的viewDidLoad、Android中的onCreate.
aboutToAppear() { this.onLoginSucessObserver = (code: number) => { // * 已收到服务端登陆反馈则当然应立即取消显示登陆进度提示等 this.isLogining = false; // 服务端返回的登陆结果值:登陆成功 if(code == ErrorCode.COMMON_CODE_OK) { // TODO: -> 友情提示:登陆MobileIMSDK服务器成功后的事情在此实现即可! // 进入主界面 router.replaceUrl({ url: ...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onLoginSucessObserver AST#member_exp...
aboutToAppear() { this.onLoginSucessObserver = (code: number) => { this.isLogining = false; if(code == ErrorCode.COMMON_CODE_OK) { router.replaceUrl({ url: 'pages/ChatPage'}); } else { ToolKits.showAlertDialog('Sorry,登录失败,错误码...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L53-L72
dcfd2c8d96b39f7d8d63674469c33934949d48c8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM3.ets
arkts
digest
SM3摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digest(str: string): Promise<string> { return CryptoUtil.digest(str, 'SM3'); }
AST#method_declaration#Left static async digest 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 AST#generic_type#Left ...
static async digest(str: string): Promise<string> { return CryptoUtil.digest(str, 'SM3'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM3.ets#L34-L36
ce3cf251a46a505595ffc2a7fa72a03626afea24
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/DateSelectComponent.ets
arkts
DateSelectDialog
定义日期选择对话框
@CustomDialog export struct DateSelectDialog { @Prop beginDate: number; @Prop endDate: number; @Prop selectedIndex: number; private controller: CustomDialogController; private onConfirm: (beginDate: number, endDate: number, selectedIndex: number) => void; build() { Column({ space: CommonConstants.SPACE...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct DateSelectDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right beginDate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty...
@CustomDialog export struct DateSelectDialog { @Prop beginDate: number; @Prop endDate: number; @Prop selectedIndex: number; private controller: CustomDialogController; private onConfirm: (beginDate: number, endDate: number, selectedIndex: number) => void; build() { Column({ space: CommonConstants.SPACE...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/DateSelectComponent.ets#L159-L258
69de7d7fad568914ca57bfd9835ea590ddd18839
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
getPosition
returns the position of the x-labels
public getPosition(): XAxisPosition { return this.mPosition; }
AST#method_declaration#Left public getPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left XAxisPosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#membe...
public getPosition(): XAxisPosition { return this.mPosition; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L77-L79
d8721f2803c49d1d70339f7fe10431fccf526a57
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initializeServicesAndSetupWindow
初始化服务和设置窗口(不阻塞UI)
private async initializeServicesAndSetupWindow(): Promise<void> { try { // 设置窗口属性 if (this.windowStage) { await this.setupWindow(this.windowStage); } // 初始化设置服务 await SettingsService.getInstance().initialize(); // 初始化数据库服务 await DatabaseService.getInstance().initi...
AST#method_declaration#Left private async initializeServicesAndSetupWindow 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_ann...
private async initializeServicesAndSetupWindow(): Promise<void> { try { if (this.windowStage) { await this.setupWindow(this.windowStage); } await SettingsService.getInstance().initialize(); await DatabaseService.getInstance().initializeDatabase(this.context); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L185-L207
d3e7f271d7d15cd0551cbb6636fbe4ca4f66de67
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/buttons/IconButton.ets
arkts
IconButton
/////////////////////////////////// / svg图片使用的,可以着色的图标按钮 ///////////////////////////////////
@ComponentV2 export struct IconButton { // 必需属性(通过@Param从外部传入) @Param icon : Resource | null = null @Event onClickCallBack : () => void = () => {} // 可选样式属性(通过@Param支持外部修改) @Param iconSize : number | string = 22 @Param iconColor : ResourceColor = $r('app.color.colorPr...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct IconButton AST#component_body#Left { // 必需属性(通过@Param从外部传入) AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right icon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Reso...
@ComponentV2 export struct IconButton { @Param icon : Resource | null = null @Event onClickCallBack : () => void = () => {} @Param iconSize : number | string = 22 @Param iconColor : ResourceColor = $r('app.color.colorPrimary') @Param iconColorSelected : ResourceCo...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/buttons/IconButton.ets#L7-L51
b3ac7a10ebe7cee9ac7150ad1d5b5a1b77651b0b
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
formatDate
核心日期格式化方法(静态方法) @param date 要格式化的日期对象 @param format 格式字符串(支持YYYY/YY/MM/M/DD/D/HH/H/mm/m/ss/s/SSS占位符) @returns 格式化后的日期字符串
static formatDate(date: Date, format: string): string { // 创建类型安全的日期值映射对象 const dateValues: IDateValues = { year: date.getFullYear(), month: date.getMonth() + 1, // 月份从0开始,需+1 day: date.getDate(), hours: date.getHours(), minutes: date.getMinutes(), seconds: date.getSeconds()...
AST#method_declaration#Left static formatDate 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#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static formatDate(date: Date, format: string): string { const dateValues: IDateValues = { year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate(), hours: date.getHours(), minutes: date.getMinutes(), seconds: date.getSeconds(), milliseconds: date.get...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L168-L199
b8a8956f66f9f71d89799932f2fc142c29851a00
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FramedRendering/entry/src/main/ets/common/CommonConstants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class CommonConstants { /** * WaterFlow component vertical spacing. */ public static readonly COLUMNS_GAP: number = 7; /** * Horizontal spacing between WaterFlow components. */ public static readonly ROWS_GAP: number = 12; /** * NavDestination item0. */ public static readonly NAV_...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * WaterFlow component vertical spacing. */ AST#property_declaration#Left public static readonly COLUMNS_GAP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotati...
export class CommonConstants { public static readonly COLUMNS_GAP: number = 7; public static readonly ROWS_GAP: number = 12; public static readonly NAV_DESTINATION_ITEM_0: string = 'NavDestination_item_0'; public static readonly NAV_DESTINATION_ITEM_1: string = 'NavDestination_item_1'; publ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/common/CommonConstants.ets#L16-L41
6ec6f4ec2a1008ff0ef8622d5a042c95923133cc
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/helper/kvManagerHelper.ets
arkts
getValue
通过key获取对应的value值 @param key @returns
static getValue(key: string, callBack: (dataValue: kvValueType) => void) { if (kvManagerHelper.kvStore !== undefined) { kvManagerHelper.kvStore.get(key, (err, data) => { if (err != undefined) { console.error(`Failed to get data. Code:${err.code},message:${err.message}`); } co...
AST#method_declaration#Left static getValue AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Lef...
static getValue(key: string, callBack: (dataValue: kvValueType) => void) { if (kvManagerHelper.kvStore !== undefined) { kvManagerHelper.kvStore.get(key, (err, data) => { if (err != undefined) { console.error(`Failed to get data. Code:${err.code},message:${err.message}`); } co...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/helper/kvManagerHelper.ets#L66-L76
6c1686647618f51a5fcf912e4d8f9ded5c52bf0f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
startAlipaySdk
调起支付宝 SDK @param {string} payInfo - 支付参数 @returns {void} 无返回值
private startAlipaySdk(payInfo: string): void { const navStack: NavPathStack | undefined = getNavPathStack(); if (!navStack) { ToastUtils.showError($r("app.string.payment_failed")); return; } new Pay().payWithNav(payInfo, true, undefined, navStack) .then((result: Map<string, string>): ...
AST#method_declaration#Left private startAlipaySdk AST#parameter_list#Left ( AST#parameter#Left payInfo : 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 void AST#primar...
private startAlipaySdk(payInfo: string): void { const navStack: NavPathStack | undefined = getNavPathStack(); if (!navStack) { ToastUtils.showError($r("app.string.payment_failed")); return; } new Pay().payWithNav(payInfo, true, undefined, navStack) .then((result: Map<string, string>): ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L76-L90
74ae5358026d51f4a2637575e98bf2616229857f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/game/GameCenterPage.ets
arkts
buildExpProgressBar
构建经验进度条
@Builder buildExpProgressBar() { if (!this.gameData) return; const currentExp = this.gameData.experience - this.gameData.level.requiredExp; const nextLevelExp = this.gameData.level.nextLevelExp; const progress = nextLevelExp > 0 ? (currentExp / (nextLevelExp - this.gameData.level.requiredExp)) : 1; ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildExpProgressBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AS...
@Builder buildExpProgressBar() { if (!this.gameData) return; const currentExp = this.gameData.experience - this.gameData.level.requiredExp; const nextLevelExp = this.gameData.level.nextLevelExp; const progress = nextLevelExp > 0 ? (currentExp / (nextLevelExp - this.gameData.level.requiredExp)) : 1; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/game/GameCenterPage.ets#L188-L225
dc781cea1869596380ddfc0b63058e20e3f533f8
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/entryability/EntryAbility.ets
arkts
cleanupOfflineManager
清理离线管理器
private cleanupOfflineManager(): void { try { const offlineManager = SimpleOfflineManager.getInstance(); offlineManager.destroy(); hilog.info(0x0000, 'EntryAbility', 'Offline manager cleaned up successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to cleanup offli...
AST#method_declaration#Left private cleanupOfflineManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#st...
private cleanupOfflineManager(): void { try { const offlineManager = SimpleOfflineManager.getInstance(); offlineManager.destroy(); hilog.info(0x0000, 'EntryAbility', 'Offline manager cleaned up successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to cleanup offli...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/entryability/EntryAbility.ets#L64-L72
9325dafda9f4152438c37a57390c89491c0d0d76
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/SnapshotUtil.ets
arkts
onSnapshotListener
开启系统截屏事件的监听 @param callBack 截图回调
static onSnapshotListener(callback: VoidCallback): void { AppUtil.getMainWindow().on("screenshot", callback); }
AST#method_declaration#Left static onSnapshotListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left VoidCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ...
static onSnapshotListener(callback: VoidCallback): void { AppUtil.getMainWindow().on("screenshot", callback); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/SnapshotUtil.ets#L77-L79
f282f5bb8cd1a998c1e45117923a634c574ad009
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
isValidDate
验证日期格式 @param dateString 日期字符串 @param format 期望的格式 @returns 是否有效
static isValidDate(dateString: string, format?: string): boolean { const date = DateUtils.parseDate(dateString); return date !== null; }
AST#method_declaration#Left static isValidDate AST#parameter_list#Left ( AST#parameter#Left dateString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format ? : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static isValidDate(dateString: string, format?: string): boolean { const date = DateUtils.parseDate(dateString); return date !== null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L99-L102
7162537f021f60162dfb2f930649bea6a58cdaef
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets
arkts
removeImage
删除选择的图片
removeImage(index: number): void { const newImages = this.selectedImages.slice(); newImages.splice(index, 1); this.selectedImages = newImages; }
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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
removeImage(index: number): void { const newImages = this.selectedImages.slice(); newImages.splice(index, 1); this.selectedImages = newImages; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets#L142-L146
28c36d5a1c7a6d6e37c9c4f84dc50a4ccb537233
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
startAnimateTo
选择的省市区名下方的下滑线动画 @param duration 动画时长 @param leftMargin 下划线动画偏移量
startAnimateTo(duration: number, leftMargin: number) { animateTo({ duration: duration, // 动画时长 curve: Curve.Linear, // 动画曲线 iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }, () => { this.leftMargin = leftMargin; }) }
AST#method_declaration#Left startAnimateTo AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left leftMargin : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
startAnimateTo(duration: number, leftMargin: number) { animateTo({ duration: duration, curve: Curve.Linear, iterations: 1, playMode: PlayMode.Normal }, () => { this.leftMargin = leftMargin; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L164-L173
6b1f32895b7c793594940b3eea1b457a1e3ebfea
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
isResourceStr
判断是否是ResourceStr类型
static isResourceStr(value: Any) { return Tools.isString(value) || Tools.isResource(value); }
AST#method_declaration#Left static isResourceStr AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left...
static isResourceStr(value: Any) { return Tools.isString(value) || Tools.isResource(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L368-L370
c7026030841590cf505554ece2c051a8d706dc9a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
toNetworkDemo
跳转到 Network Demo 示例页 @returns {void} 无返回值
static toNetworkDemo(): void { navigateTo(DemoRoutes.NetworkDemo); }
AST#method_declaration#Left static toNetworkDemo 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...
static toNetworkDemo(): void { navigateTo(DemoRoutes.NetworkDemo); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L15-L17
2f5a2089849abebcfec1f3998cda9b55ba4c336c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
自动同步配置
export interface AutoSyncConfig { enabled: boolean; frequency: AutoSyncFrequency; wifiOnly: boolean; batteryOptimization: boolean; syncOnAppStart: boolean; syncOnAppClose: boolean; maxRetries: number; retryInterval: number; // 秒 dataTypes: DataType[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AutoSyncConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left frequency : AST#type_annot...
export interface AutoSyncConfig { enabled: boolean; frequency: AutoSyncFrequency; wifiOnly: boolean; batteryOptimization: boolean; syncOnAppStart: boolean; syncOnAppClose: boolean; maxRetries: number; retryInterval: number; dataTypes: DataType[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L285-L295
d4343f4c839629c52431edd3253b9696cd0f1a87
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets
arkts
get
获取key缓存数据 @param key 键值
get(key: string): ArrayBuffer | null { let path = this.path + '/' + key; if (FileUtils.exist(path)) { let content: ArrayBuffer = FileUtils.readFile(path); // 重新设置key,更新key的设置时间 this.putCacheMap(key, content.byteLength); return content; } else { return null; } }
AST#method_declaration#Left get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ArrayBuffer AST#pr...
get(key: string): ArrayBuffer | null { let path = this.path + '/' + key; if (FileUtils.exist(path)) { let content: ArrayBuffer = FileUtils.readFile(path); this.putCacheMap(key, content.byteLength); return content; } else { return null; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets#L147-L157
f61f977a43c1df102ae5039bf1e3f41f29d22afb
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets
arkts
isInitialized
检查会话是否已初始化
public isInitialized(): boolean { console.info('UserSession: 检查是否已初始化:', this.initialized); return this.initialized; }
AST#method_declaration#Left public isInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_express...
public isInitialized(): boolean { console.info('UserSession: 检查是否已初始化:', this.initialized); return this.initialized; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets#L65-L68
9b4f8483e4838d56a520097c456097dc605cd3a5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets
arkts
实现TabDataSource接口的对象,用于tabs加载数据
export class TabDataSource extends BasicDataSource { private dataArray: TabDataModel[] = []; /** * 获取数据总数 * @returns */ public totalCount(): number { return this.dataArray.length; } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */ public getData(index: number): TabDataModel { ...
AST#export_declaration#Left export AST#class_declaration#Left class TabDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left...
export class TabDataSource extends BasicDataSource { private dataArray: TabDataModel[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): TabDataModel { return this.dataArray[index]; } public addData(index: number, data: TabDataModel): void...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets#L116-L152
30e88887c82f4c38a2daa42aacadb1bd557cc254
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
isEmpty
判断字符串是否为空(undefined、null、字符串长度为0) @param str 被检测的字符串 @return 是否为空
private static isEmpty(str: string | undefined | null): boolean { return str == undefined || str == null || str.length == 0; }
AST#method_declaration#Left private static isEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_ty...
private static isEmpty(str: string | undefined | null): boolean { return str == undefined || str == null || str.length == 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L167-L169
4d25c5b87768bf259f0292632ec43cc5ebe0ef58
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/HttpUtil.ets
arkts
delete
@description: delete请求函数 @param {string} url 请求地址 @param {Object} data 请求参数 @param {RequestConfig} OtherConfig request其他配置 @return {*}
public delete<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url,{ method: http.RequestMethod.DELETE,extraData: data}) }
AST#method_declaration#Left public delete AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Righ...
public delete<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url,{ method: http.RequestMethod.DELETE,extraData: data}) }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/HttpUtil.ets#L116-L118
7d93be4330eb7b75d19884b19a0277aa3b70d94f
github
chenyy0708/wanharmony.git
00e95a536122accf51518d674989d12fafbf37c2
entry/src/main/ets/view/LoadMoreLayout.ets
arkts
LoadMoreLayout
The load more layout component.
@Component export default struct LoadMoreLayout { build() { Column() { Text('加载更多...').width('100%').height(50) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct LoadMoreLayout AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_conten...
@Component export default struct LoadMoreLayout { build() { Column() { Text('加载更多...').width('100%').height(50) } } }
https://github.com/chenyy0708/wanharmony.git/blob/00e95a536122accf51518d674989d12fafbf37c2/entry/src/main/ets/view/LoadMoreLayout.ets#L20-L27
ab311552418d0d714d3df54de9950e498598c26a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/MessageUtil.ets
arkts
buildView
构建view @param viewName
private buildView(componentContent: ComponentContent<MessageCfg>, cfg: MessageCfg) { /** * 获取弹框控制对象 */ if (!this.promptAction) { this.promptAction = cfg.context.getPromptAction(); } //打开弹框 this.promptAction?.openCustomDialog(componentContent, { alignment: DialogAlignment.Bottom...
AST#method_declaration#Left private buildView AST#parameter_list#Left ( AST#parameter#Left componentContent : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ComponentContent AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MessageCfg AST#primary_type#Right AST#type_annotati...
private buildView(componentContent: ComponentContent<MessageCfg>, cfg: MessageCfg) { if (!this.promptAction) { this.promptAction = cfg.context.getPromptAction(); } this.promptAction?.openCustomDialog(componentContent, { alignment: DialogAlignment.Bottom, autoCancel: false, ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L53-L77
50e92fb7997278a6806c961a6dfde465c7e37f1d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets
arkts
Register the delayed task and pass the parameters. @param version Current application version. @param bundleName The name of the application package for which the task needs to be registered. @param filePath Storage address of the application package.
export async function startUpdateSample(version: string, bundleName: string, filePath: string): Promise<void> { try { let workInfo = { workId: 1, bundleName: bundleName, abilityName: 'WorkSchedulerAbility', networkType: workScheduler.NetworkType.NETWORK_TYPE_ANY, parame...
AST#export_declaration#Left export AST#function_declaration#Left async function startUpdateSample AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left bundleName : AST#type_a...
export async function startUpdateSample(version: string, bundleName: string, filePath: string): Promise<void> { try { let workInfo = { workId: 1, bundleName: bundleName, abilityName: 'WorkSchedulerAbility', networkType: workScheduler.NetworkType.NETWORK_TYPE_ANY, parame...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets#L117-L134
73d1facc6ef2ed425f4aa82c372246653f77cb1b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/model/BannerInfo.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface BannerInfo { image: Resource; title: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface BannerInfo AST#object_type#Left { AST#type_member#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Lef...
export interface BannerInfo { image: Resource; title: string; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/model/BannerInfo.ets#L16-L19
c70e040e86b3639690d6b483be1282fef4b2590f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets
arkts
processReceivedData
处理接收到的数据
private async processReceivedData(text: string, data: Uint8Array | null, msg: string | null) { if (data && data.length > 0) { const dbSound = new CDBSound() dbSound.lang = lang_en_us dbSound.text = text dbSound.data = data //插入db await CSoundDbAccessor.sh...
AST#method_declaration#Left private async processReceivedData AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primar...
private async processReceivedData(text: string, data: Uint8Array | null, msg: string | null) { if (data && data.length > 0) { const dbSound = new CDBSound() dbSound.lang = lang_en_us dbSound.text = text dbSound.data = data await CSoundDbAccessor.shared.i...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L97-L115
23b35321630a3d6898305b34a0faf8cc286a59e4
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/view/AVPlayer.ets
arkts
popupBuilder
[End build] The popup constructor defines the content of the dialog box
@Builder popupBuilder(): void { Row({ space: 2 }) { Text($r('app.string.last_history', this.showTipsTime)) .fontSize($r('app.float.font_size_14')) .fontColor($r('sys.color.font_primary')) } .height($r('app.float.size_44')) .padding({ left: $r('app.float.size_16'), right: $r('app....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_...
@Builder popupBuilder(): void { Row({ space: 2 }) { Text($r('app.string.last_history', this.showTipsTime)) .fontSize($r('app.float.font_size_14')) .fontColor($r('sys.color.font_primary')) } .height($r('app.float.size_44')) .padding({ left: $r('app.float.size_16'), right: $r('app....
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/view/AVPlayer.ets#L370-L379
ec81c911026023803260e287faa6c54aa1161805
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
isLandscape
设备当前是否以横屏方式显示(横屏)
static isLandscape(): Boolean { const direction = DeviceUtil.getDirection(); return direction === resourceManager.Direction.DIRECTION_HORIZONTAL; }
AST#method_declaration#Left static isLandscape AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dir...
static isLandscape(): Boolean { const direction = DeviceUtil.getDirection(); return direction === resourceManager.Direction.DIRECTION_HORIZONTAL; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L359-L362
a8a057e23012b0b831348733d3fd03845e2e3075
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
insertChatLog
==================== CHAT LOG OPERATIONS ==================== Insert a chat log entry @param chatLog - ChatLog object to insert @returns Row ID of inserted chat log
async insertChatLog(chatLog: ChatLog): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const data = chatLog.toRow(); const valueBucket: relationalStore.ValuesBucket = { 'date': data.date, 'content': data.content, 'is_use...
AST#method_declaration#Left async insertChatLog AST#parameter_list#Left ( AST#parameter#Left chatLog : AST#type_annotation#Left AST#primary_type#Left ChatLog AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
async insertChatLog(chatLog: ChatLog): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const data = chatLog.toRow(); const valueBucket: relationalStore.ValuesBucket = { 'date': data.date, 'content': data.content, 'is_use...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L647-L669
c1c876f7c6d981e20c3eaef6781d863a61dc7575
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/PhotoGridPage.ets
arkts
onActive
The callback when current page is in the foreground
onActive(): void { if (!this.isActive) { Log.info(TAG, 'onActive'); this.isActive = true; this.loadItem(); } }
AST#method_declaration#Left onActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expressi...
onActive(): void { if (!this.isActive) { Log.info(TAG, 'onActive'); this.isActive = true; this.loadItem(); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/PhotoGridPage.ets#L383-L389
d75c8691d39feb08caa2345df05e5bafcf1d0774
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets
arkts
setAVPlayerCallback
设置AVPlayer事件监听 @param avPlayer
setAVPlayerCallback(avPlayer: media.AVPlayer) { avPlayer.on('videoSizeChange', (width: number, height: number) => { this.videoWidth = width; this.videoHeight = height; this.ratio = width * (1.0) / height; }) avPlayer.on('timeUpdate', (time: number) => { this.currentTime = time; ...
AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERR...
setAVPlayerCallback(avPlayer: media.AVPlayer) { avPlayer.on('videoSizeChange', (width: number, height: number) => { this.videoWidth = width; this.videoHeight = height; this.ratio = width * (1.0) / height; }) avPlayer.on('timeUpdate', (time: number) => { this.currentTime = time; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets#L387-L413
5f21aef3c616dc2164ec89dc02665d54a9395d72
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getContext
获取上下文,common.UIAbilityContext @returns
static getContext(): common.UIAbilityContext { if (!AppUtil.context) { AppUtil.context = getContext() as common.UIAbilityContext; //兜底 LogUtil.error("请在UIAbility的onCreate方法中调用AppUtil的init方法初始化!"); } return AppUtil.context; }
AST#method_declaration#Left static getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#builder_function_body#Left { AST#ui_control_...
static getContext(): common.UIAbilityContext { if (!AppUtil.context) { AppUtil.context = getContext() as common.UIAbilityContext; LogUtil.error("请在UIAbility的onCreate方法中调用AppUtil的init方法初始化!"); } return AppUtil.context; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L77-L83
93a7046fc90f40f62d76b277cb46eeee6d0b518c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
@Author csx @DateTime 2024/7/4 00:12 @TODO CryptoSyncUtil 加解密工具类-同步
export class CryptoSyncUtil { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @param keyCoding 公钥的编码方式(utf8/hex/base64) * @returns */ static convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number, keyCoding: buf...
AST#export_declaration#Left export AST#class_declaration#Left class CryptoSyncUtil AST#class_body#Left { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @param keyCoding 公钥的编码方式(utf8/hex/base64) * @returns */ AST#method_declaration#Left sta...
export class CryptoSyncUtil { static convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding) { let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(publicKey, keyName, keyCoding) }; let aesGenerator = crypto.createAsyKeyGenera...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L27-L502
49da147cdda87a74b49cca0725666983ed86ef16
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/CategoryChannel.ets
arkts
应用约束61:使用export default代替module.exports
export default CategoryChannel;
AST#export_declaration#Left export default AST#expression#Left CategoryChannel AST#expression#Right ; AST#export_declaration#Right
export default CategoryChannel;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/CategoryChannel.ets#L28-L28
fb913b24a457ac614d41b92764cd5db5a8892049
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/AppUtility.ets
arkts
getQuizTopTextStrings
Used for Quiz top Text @param context 上下文对象 @returns 测验顶部文本数组
static getQuizTopTextStrings(context: common.Context): string[] { const texts: string[] = [ context.resourceManager.getStringSync($r('app.string.test_top_txt_unit').id), context.resourceManager.getStringSync($r('app.string.test_top_txt_all').id), context.resourceManager.getStringSync($r('app.strin...
AST#method_declaration#Left static getQuizTopTextStrings 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 getQuizTopTextStrings(context: common.Context): string[] { const texts: string[] = [ context.resourceManager.getStringSync($r('app.string.test_top_txt_unit').id), context.resourceManager.getStringSync($r('app.string.test_top_txt_all').id), context.resourceManager.getStringSync($r('app.strin...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L86-L95
b26f6c96532be4eb8bab4aea6c2cb474da25dfd6
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/22.@Styles抽取通用属性和事件.ets
arkts
commonStyles
1. 全局定义 不支持传参
@Styles function commonStyles() { .width(100) .height(100) .aspectRatio(1) // 设置宽高比例为1 }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function commonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Lef...
@Styles function commonStyles() { .width(100) .height(100) .aspectRatio(1) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/22.@Styles抽取通用属性和事件.ets#L34-L38
66cb6e78b5a3dd1666c39065dc9f3f88a729b66a
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets
arkts
canLoop
是否允许循环 @param canLoop @returns
canLoop(canLoop: boolean) { this.builderOptions.canLoop = canLoop return this; }
AST#method_declaration#Left canLoop AST#parameter_list#Left ( AST#parameter#Left canLoop : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AS...
canLoop(canLoop: boolean) { this.builderOptions.canLoop = canLoop return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets#L39-L42
40a0f22fadbb4418c15e539f7330d7df41639f46
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets
arkts
addData
在指定索引位置增加一个元素 @param index
public addData(index: number, data: SiteItem): void { this.dataList.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left SiteItem AST#primary_type#...
public addData(index: number, data: SiteItem): void { this.dataList.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L160-L163
93d0da43eebbb254dcb7ed8ffaa2b0ef1f9f344d
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/http/apiService.ets
arkts
获取专题接口
export function getTopicData(start: number = 0) { return axiosClient.get<TopicModel>( { url: baseUrl + "api/v3/specialTopics", params: { "start": start } } ) }
AST#export_declaration#Left export AST#function_declaration#Left function getTopicData AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parame...
export function getTopicData(start: number = 0) { return axiosClient.get<TopicModel>( { url: baseUrl + "api/v3/specialTopics", params: { "start": start } } ) }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L68-L75
94e760fd8e7312af1bde6a422ffdceb54af44621
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
recommendation
自定义首页推荐
@Builder recommendation() { Scroll() { Column() { Search({ placeholder: $r('app.string.mini_player_animation_search') }) .width($r('app.string.mini_player_animation_common_width')) .height($r('app.string.mini_player_animation_music_common_height')) .backgroundColor(Colo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right recommendation 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_e...
@Builder recommendation() { Scroll() { Column() { Search({ placeholder: $r('app.string.mini_player_animation_search') }) .width($r('app.string.mini_player_animation_common_width')) .height($r('app.string.mini_player_animation_music_common_height')) .backgroundColor(Colo...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L289-L321
fd6db0bc3a621e7e3cc1cfe443451bca50bcfa0b
gitee
openharmony-sig/ohos_axios
75d72897982ea6e10fa99c62c62a65425af0a568
entry/src/main/ets/pages/Index.ets
arkts
download
下载
download() { this.clear() this.showUrl = this.downloadUrl this.startTime = new Date().getTime(); let filePath = getContext(this).cacheDir + '/blue.jpg' // 下载。如果文件已存在,则先删除文件。 try { fs.accessSync(filePath); fs.unlinkSync(filePath); }
AST#method_declaration#Left download AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expression...
download() { this.clear() this.showUrl = this.downloadUrl this.startTime = new Date().getTime(); let filePath = getContext(this).cacheDir + '/blue.jpg' try { fs.accessSync(filePath); fs.unlinkSync(filePath); }
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L588-L598
89177fe14c3f18a3445571ab1efd920db4d475b9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/renderGroup/feature/renderGroup/Index.ets
arkts
ProfitScene
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { ProfitScene } from './src/main/ets/pages/ProfitScene';
AST#export_declaration#Left export { ProfitScene } from './src/main/ets/pages/ProfitScene' ; AST#export_declaration#Right
export { ProfitScene } from './src/main/ets/pages/ProfitScene';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/renderGroup/feature/renderGroup/Index.ets#L16-L16
81603c6ecd21688812997dbf9538a8aa1cf42379
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/LoadContentWindow.ets
arkts
LoadContent
弹窗画面缩放大小
@Entry({ routeName: entryName, storage: LocalStorage.getShared() }) // window单独加载的命名路由页面: LoadContent @Component export struct LoadContent { @LocalStorageLink('content') content: string = ''; build() { Column() { Row() { Image($r('app.media.custom_dialog_cancel_icon')) .height($r('ap...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left routeName AST#property_name#Right : AST#expression#Left entryName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#pro...
@Entry({ routeName: entryName, storage: LocalStorage.getShared() }) @Component export struct LoadContent { @LocalStorageLink('content') content: string = ''; build() { Column() { Row() { Image($r('app.media.custom_dialog_cancel_icon')) .height($r('app.integer.custom_dialog_image_siz...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/LoadContentWindow.ets#L24-L76
bf4d8c5f149f847e7695ee4e97a3e980413f9012
gitee
openharmony/bundlemanager_bundle_framework
89882654172b6bfba2a4a1ebfacdd6c9296f6f21
interfaces/kits/ani/bundle_manager/ets/bundleManager/Skill.ets
arkts
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...
export interface Skill { readonly actions: Array<string>; readonly entities: Array<string>; readonly uris: Array<SkillUri>; readonly domainVerify: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Skill AST#object_type#Left { AST#type_member#Left readonly AST#ERROR#Left actions AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#L...
export interface Skill { readonly actions: Array<string>; readonly entities: Array<string>; readonly uris: Array<SkillUri>; readonly domainVerify: boolean; }
https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/bundle_manager/ets/bundleManager/Skill.ets#L16-L21
5e5646da82c2cf98e158948416f77dd21efbbc02
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Refreshes the zones entries in AppStorage.
export function refresh_AppStorage_zones() { let zones = scan_zones(); AppStorage.setOrCreate('zones', zones[0] as string[]); AppStorage.setOrCreate('zones_opened', zones[1] as boolean[]); }
AST#export_declaration#Left export AST#function_declaration#Left function refresh_AppStorage_zones AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left zones = AST#expression#Left AST#call_expression#Left AST#ex...
export function refresh_AppStorage_zones() { let zones = scan_zones(); AppStorage.setOrCreate('zones', zones[0] as string[]); AppStorage.setOrCreate('zones_opened', zones[1] as boolean[]); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L63-L67
08e2ec4b76f6e8be8a814bdc194e01d164c98226
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
getStyleLabel
获取样式标签
private getStyleLabel(style: string): string { const labels: Record<string, string> = { 'warm': '温馨', 'formal': '正式', 'humorous': '幽默', 'poetic': '诗意', 'simple': '简洁' }; return labels[style] || '简洁'; }
AST#method_declaration#Left private getStyleLabel AST#parameter_list#Left ( AST#parameter#Left style : 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...
private getStyleLabel(style: string): string { const labels: Record<string, string> = { 'warm': '温馨', 'formal': '正式', 'humorous': '幽默', 'poetic': '诗意', 'simple': '简洁' }; return labels[style] || '简洁'; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L643-L652
6c9720ee98d4e3340986370b9439192b9d6b19c1
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/KMP.ets
arkts
Knuth-Morris-Pratt (KMP) 字符串搜索算法实现 该算法通过预处理模式串来避免不必要的比较
export class KMP { /** * 使用 KMP 算法在文本中搜索模式串 * @param text 要搜索的文本 * @param pattern 要查找的模式串 * @returns 模式串在文本中的起始位置,如果未找到则返回 -1 */ public static search(text: string, pattern: string): number { if (!text || !pattern || pattern.length > text.length) { return -1; } const lps = KMP.compu...
AST#export_declaration#Left export AST#class_declaration#Left class KMP AST#class_body#Left { /** * 使用 KMP 算法在文本中搜索模式串 * @param text 要搜索的文本 * @param pattern 要查找的模式串 * @returns 模式串在文本中的起始位置,如果未找到则返回 -1 */ AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left text : ...
export class KMP { public static search(text: string, pattern: string): number { if (!text || !pattern || pattern.length > text.length) { return -1; } const lps = KMP.computeLPS(pattern); let i = 0; let j = 0; while (i < text.length) { if (pattern[j] === text[i]) { i...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L5-L274
a838d9156fe526e1fc4e6a01af61283ed02fd21a
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
login
用户登录 @param username 用户名 @param password 密码
async login(username: string, password: string): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.loginUser(username, password); if (userData) { this.currentUser = UserInfo.fromCloudObject(userData); this.loggedIn = true; return this.currentUser; ...
AST#method_declaration#Left async login AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
async login(username: string, password: string): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.loginUser(username, password); if (userData) { this.currentUser = UserInfo.fromCloudObject(userData); this.loggedIn = true; return this.currentUser; ...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L51-L64
184477c471a359e84cd4a462f94c14ae71c4416c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
capitalize
将字符串首字母转换为大写,剩下为小写 @param str 待转换的字符串 @returns 转换后的
static capitalize(str: string = ''): string { if (StrUtil.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
AST#method_declaration#Left static capitalize AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
static capitalize(str: string = ''): string { if (StrUtil.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L206-L213
73914e803a6156377cff64d96eef2879e73d517e
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
generateAESKey
生成AES的对称密钥-默认base64 @param resultCoding 生成AES秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns AES密钥
static generateAESKey(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES256', resultCoding); }
AST#method_declaration#Left static generateAESKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres...
static generateAESKey(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES256', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L61-L63
50cabfc786e4b7b476f2abf2bf44ae2e58dbc072
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.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_search_engines_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_search_engines_update', Date.now()); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L10-L12
e7b7b0727b6e7ae1a2f5cb64ad622e89c427cf43
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ScanUtils.ets
arkts
onDetectBarCode
调用图片识码,使用Promise方式异步返回识码结果。 @param uri 图片路径。 @param options scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。 enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。 enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。 @returns ScanResult 扫码结果: scanType 码类型。 originalValue 码识别内容结果。 scanCodeRect 码识别位置信息。
static onDetectBarCode(uri: string, options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }): Promise<Array<scanBarcode.ScanResult>> { let inputImage: detectBarcode.InputImage = { uri: uri } return detectBarcode.decode(inputImage, option...
AST#method_declaration#Left static onDetectBarCode AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ...
static onDetectBarCode(uri: string, options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }): Promise<Array<scanBarcode.ScanResult>> { let inputImage: detectBarcode.InputImage = { uri: uri } return detectBarcode.decode(inputImage, option...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L115-L122
5696c729b3b2a7ecf3fa2cbc65f45e149d96220b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
createSubWindow
创建子窗口
private createSubWindow(windowStage: window.WindowStage | null) { try { if (!windowStage) { return; } windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => { if (err.code) { console.error("Failed to create the subwindow, Cause: " + JSON.stringify(err));...
AST#method_declaration#Left private createSubWindow AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Rig...
private createSubWindow(windowStage: window.WindowStage | null) { try { if (!windowStage) { return; } windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => { if (err.code) { console.error("Failed to create the subwindow, Cause: " + JSON.stringify(err));...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L92-L117
0e666de8e2287758a4de8682be83a726d1aeb730
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/request/GoodsSearchRequest.ets
arkts
@file 商品搜索分页请求模型 @author Joker.X
export class GoodsSearchRequest { /** * 页码 */ page: number = 1; /** * 每页大小 */ size: number = 20; /** * @param {Partial<GoodsSearchRequest>} init - 初始化数据 */ constructor(init?: Partial<GoodsSearchRequest>) { if (!init) { return; } this.page = init.page ?? this.page; th...
AST#export_declaration#Left export AST#class_declaration#Left class GoodsSearchRequest AST#class_body#Left { /** * 页码 */ AST#property_declaration#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#pr...
export class GoodsSearchRequest { page: number = 1; size: number = 20; constructor(init?: Partial<GoodsSearchRequest>) { if (!init) { return; } this.page = init.page ?? this.page; this.size = init.size ?? this.size; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/request/GoodsSearchRequest.ets#L5-L25
3144fdb46de319f58b42104a31fac6c5d6250cb1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/empty/EmptyData.ets
arkts
构建数据缺省页视图 @returns {void} 无返回值
build(): void { Empty({ description: "暂无数据", imageRes: $r("app.media.ic_empty_data") }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left "暂无数据" AST#expression...
build(): void { Empty({ description: "暂无数据", imageRes: $r("app.media.ic_empty_data") }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyData.ets#L13-L18
e680d016128b89cb1f152ec335d19f1b3969e0b6
github
qumingzhentmdnan/HealthyDietArkts.git
1b526eb8789f8ee28e3b63a852e1f23809431d6e
entry/src/main/ets/common/component/audioComponent.ets
arkts
setAVPlayerCallback
注册avplayer回调函数
setAVPlayerCallback() { // seek操作结果回调函数 this.avPlayer.on('seekDone', (seekDoneTime) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 this.avPlayer.on('error', (err) => { console.error(`Invoke avPlayer failed...
AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { // seek操作结果回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Le...
setAVPlayerCallback() { this.avPlayer.on('seekDone', (seekDoneTime) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) this.avPlayer.on('error', (err) => { console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); this.av...
https://github.com/qumingzhentmdnan/HealthyDietArkts.git/blob/1b526eb8789f8ee28e3b63a852e1f23809431d6e/entry/src/main/ets/common/component/audioComponent.ets#L61-L99
a7df11ddf73269ecfc85c93de1e12f289b564cb3
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/pages/View/FestivalInfo.ets
arkts
briefRow
async checkAgentSupport() { try { let context = this.getUIContext()?.getHostContext() as common.UIAbilityContext; this.isAgentSupport = await this.controller.isAgentSupport(context, this.agentId) } catch (err) { hilog.error(0x0001, 'Agent', `err code: ${err.code}, message: ${err.message}`) } } initListeners() { this.c...
@Builder briefRow(key : string,value : string){ Row({space : 8}){ Text(key) .secondTitleFontStyle(this.currentBreakpoint) Text(value) .contentFontStyle(this.currentBreakpoint) } .margin({bottom : 10}) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right briefRow AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#pr...
@Builder briefRow(key : string,value : string){ Row({space : 8}){ Text(key) .secondTitleFontStyle(this.currentBreakpoint) Text(value) .contentFontStyle(this.currentBreakpoint) } .margin({bottom : 10}) }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/View/FestivalInfo.ets#L89-L97
69c4e764f74634cb4765deb1e696d7678ad29746
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setEntryLabelTypeface
Sets a custom Typeface for the drawing of the entry labels. @param tf
public setEntryLabelTypeface(tf: FontFamily): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintEntryLabels().setFontFamily(tf); }
AST#method_declaration#Left public setEntryLabelTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontFamily AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#p...
public setEntryLabelTypeface(tf: FontFamily): void { ( this.mRenderer as PieChartRenderer).getPaintEntryLabels().setFontFamily(tf); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L729-L732
4f7a1bc41869d46b7698fb203fb9a4901c36d689
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CategoryPage.ets
arkts
getCategoryColumnsTemplate
获取分类网格列模板 @returns {string} 列模板字符串
private getCategoryColumnsTemplate(): string { const columnsCount: number = bp({ sm: 3, md: 4, lg: 6 }); let template: string = ""; for (let index: number = 0; index < columnsCount; index++) { template = `${template}1fr${index === columnsCount - 1 ? "" : " "}`; } return template; }
AST#method_declaration#Left private getCategoryColumnsTemplate 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_decl...
private getCategoryColumnsTemplate(): string { const columnsCount: number = bp({ sm: 3, md: 4, lg: 6 }); let template: string = ""; for (let index: number = 0; index < columnsCount; index++) { template = `${template}1fr${index === columnsCount - 1 ? "" : " "}`; } return template; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L218-L225
3f9fe37be4d51339677251d185023863c4473c78
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets
arkts
Created by philipp on 12/06/15. @ts-ignore
export default abstract class ChartTouchListener<T extends Chart> { /** * the last touch gesture that has been performed **/ protected mLastGesture: ChartGesture = ChartGesture.NONE; // states protected static NONE: number = 0; protected static DRAG: number = 1; protected static X_ZOOM: number = 2; ...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class ChartTouchListener AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Chart AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right ...
export default abstract class ChartTouchListener<T extends Chart> { protected mLastGesture: ChartGesture = ChartGesture.NONE; protected static NONE: number = 0; protected static DRAG: number = 1; protected static X_ZOOM: number = 2; protected static Y_ZOOM: number = 3; protected static PINCH_ZOOM: nu...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets#L37-L152
773fd55fb0d0a23dee110f44346d8b37780fda34
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets
arkts
fetchFromMemory
从内存中取回数据,如果数据不存在,返回null @param key 键值
fetchFromMemory(key: string): null | ResponseDataType { let res = this.cache.get(key); if (!res) { return null; } return res; }
AST#method_declaration#Left fetchFromMemory AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left null A...
fetchFromMemory(key: string): null | ResponseDataType { let res = this.cache.get(key); if (!res) { return null; } return res; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets#L40-L46
c745184c720ad82b73006fb043382d03ec0b14f1
gitee
junw2024/hnchain-ArkTs.git
0cc3c182ad418709b577fa24e9fe909a205232c6
entry/src/main/ets/common/constants/GlobalData.ets
arkts
全局本地存储单例
export default class GlobalData { public static readonly TG_AUTH: string = "auth" private storage: LocalStorage = new LocalStorage(); private static instance: GlobalData private constructor() { } public static getInstance(): GlobalData { if(!this.instance){ this.instance =new GlobalData() }...
AST#export_declaration#Left export default AST#class_declaration#Left class GlobalData AST#class_body#Left { AST#property_declaration#Left public static readonly TG_AUTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "auth" AST#expression#R...
export default class GlobalData { public static readonly TG_AUTH: string = "auth" private storage: LocalStorage = new LocalStorage(); private static instance: GlobalData private constructor() { } public static getInstance(): GlobalData { if(!this.instance){ this.instance =new GlobalData() }...
https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/common/constants/GlobalData.ets#L4-L24
03130f90586962f3e09dea09f257b181683ae9de
github
fengcreate/harmony-document
798534b0f76399dc84e7940f5b14b3ae4e53c6a9
BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets
arkts
transfer
Database migration from HarmonyOS 4.0 to HarmonyOS NEXT. eg: The db file name for HarmonyOS 4.0 is: source_deb.db, which contains the table 'user'. The 'user' field contains fields such as' id ',' integer ',' username ', and' string '. The db file name for HarmonyOS NEXT is target_deb.db, which contains the table 't_us...
async transfer(context: common.Context): Promise<void> { // Step 1: Move the db file. let result = this.moveDbFile(context); if (!result) { hilog.error(0x0000, 'BackupRestore DbTransferManager', 'moveDbFile failed'); return; } // Step 2: query the number of data entries in the user tabl...
AST#method_declaration#Left async transfer 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 : AST#type_an...
async transfer(context: common.Context): Promise<void> { let result = this.moveDbFile(context); if (!result) { hilog.error(0x0000, 'BackupRestore DbTransferManager', 'moveDbFile failed'); return; } let count = await this.querySourceUserCount(context); const PAGE_SIZE = 10; ...
https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets#L39-L66
ac82d5c114aa8ead13c0d5ae97f57750a20f624e
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/advertisingpage/src/main/ets/components/AdvertisingPage.ets
arkts
AdvertisingPageComponent
按键靠近右侧屏幕距离 功能描述:本示例介绍了如何实现全屏启动页 推荐场景:应用冷启动广告页 核心组件: 1.changeFullScreen 2.timerInterval 实现步骤: 1.通过window.getLastWindow在页面启动时实现沉浸式布局。 2.通过定时器设置自动进入页面时长,也可手动跳过进入页面。
@Component export struct AdvertisingPageComponent { @State pageCountDown: number = 5; // 进场动画总用时5s @StorageProp('windowSize') windowSize: window.Size = { width: display.getDefaultDisplaySync().width, height: display.getDefaultDisplaySync().height }; @Link isShow: boolean; private timer: number = 0; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AdvertisingPageComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right pageCountDown : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
@Component export struct AdvertisingPageComponent { @State pageCountDown: number = 5; @StorageProp('windowSize') windowSize: window.Size = { width: display.getDefaultDisplaySync().width, height: display.getDefaultDisplaySync().height }; @Link isShow: boolean; private timer: number = 0; changeFu...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/advertisingpage/src/main/ets/components/AdvertisingPage.ets#L35-L138
63e1dadbc6a29c1d13e0012503ee0e96cfe7b5f6
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
getAllUsers
获取所有用户
async getAllUsers(): Promise<UserInfo[]> { try { const users = await this.cloudDBService.getAllUsers(); return users.map(user => UserInfo.fromCloudObject(user)); } catch (error) { console.error('获取所有用户失败:', error); return []; } }
AST#method_declaration#Left async getAllUsers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserInfo [ ] AST#array_type#Right AST#primary_typ...
async getAllUsers(): Promise<UserInfo[]> { try { const users = await this.cloudDBService.getAllUsers(); return users.map(user => UserInfo.fromCloudObject(user)); } catch (error) { console.error('获取所有用户失败:', error); return []; } }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L161-L169
0f0fd6403db27051c848ce4abc94e22e7f007e8b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/product/entry/src/main/ets/tablet/pages/EntryView.ets
arkts
getModuleTitle
获取当前页面name @param name 模块路由信息 @returns
getModuleTitle(name: string): null | string { for (let index = 0; index < waterFlowData.length; index++) { if (waterFlowData[index].appUri === name) { return waterFlowData[index].name; } } if (name === this.privacyAgreementUri) { let value: string | undefined = AppStorage.get('agre...
AST#method_declaration#Left getModuleTitle AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left null A...
getModuleTitle(name: string): null | string { for (let index = 0; index < waterFlowData.length; index++) { if (waterFlowData[index].appUri === name) { return waterFlowData[index].name; } } if (name === this.privacyAgreementUri) { let value: string | undefined = AppStorage.get('agre...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/tablet/pages/EntryView.ets#L74-L85
5b43fcc7284648ecb6a51d3fb459395ed3c75636
gitee