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
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
hash
计算字符串的哈希值 @param str 要计算哈希值的字符串 @returns 哈希值
private static hash(str: string): number { let hash = 0; for (let i = 0; i < str.length; i++) { hash = (RabinKarp.BASE * hash + str.charCodeAt(i)) % RabinKarp.PRIME; } return hash; }
AST#method_declaration#Left private static hash 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 number AST#primary_typ...
private static hash(str: string): number { let hash = 0; for (let i = 0; i < str.length; i++) { hash = (RabinKarp.BASE * hash + str.charCodeAt(i)) % RabinKarp.PRIME; } return hash; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L57-L63
f4f13804ae44c455620eccf57fccb8cc90888a30
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
generateId
私有方法
private generateId(): string { return `notification_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
AST#method_declaration#Left private generateId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_lit...
private generateId(): string { return `notification_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L358-L360
de8e8db64995ab9bbf71847a3694c77b9428e243
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
arkts
saveCarts
保存选中的购物车项(仅购物车页面使用) @param {Cart[]} carts 购物车列表 @returns {Promise<void>} Promise<void>
saveCarts(carts: Cart[]): Promise<void> { return this.dataSource.setCarts(carts); }
AST#method_declaration#Left saveCarts AST#parameter_list#Left ( AST#parameter#Left carts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima...
saveCarts(carts: Cart[]): Promise<void> { return this.dataSource.setCarts(carts); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderCacheStoreRepository.ets#L31-L33
648724918faf935dc49c48e8396d7568d2c4d848
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
buildClockHand
构建时钟数字
@Builder buildClockNumber(hour: number, isOuter: boolean) { Text((hour === 0 ? 12 : hour > 12 ? hour : hour).toString()) .fontSize(isOuter ? 14 : 10) .fontWeight(this.tempHour === hour ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.tempHour === hour ? '#4ECDC4' : '#333333') .width(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left buildClockNumber AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isOuter : AST#t...
@Builder buildClockNumber(hour: number, isOuter: boolean) { Text((hour === 0 ? 12 : hour > 12 ? hour : hour).toString()) .fontSize(isOuter ? 14 : 10) .fontWeight(this.tempHour === hour ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.tempHour === hour ? '#4ECDC4' : '#333333') .width(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L2278-L2312
b994739b7b73c228fe323a71ae95e7de992970c4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets
arkts
onClose
关闭事件订阅 @param callback
public onClose(callback: () => void): void { this.mSocket?.setOnCloseListener(callback); this.onWifiDisconnect(callback); }
AST#method_declaration#Left public onClose AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left 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#function_typ...
public onClose(callback: () => void): void { this.mSocket?.setOnCloseListener(callback); this.onWifiDisconnect(callback); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L70-L74
1d4416dc8a94d10f97876ce18c140542155819e3
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/extension_actions.ets
arkts
terminate_extension
All jobs to be done right before uninstallation. @param id The id of extension.
function terminate_extension(id: string) { console.log(`[terminate_extension][${id}] About to be uninstalled!`); }
AST#function_declaration#Left function terminate_extension AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_...
function terminate_extension(id: string) { console.log(`[terminate_extension][${id}] About to be uninstalled!`); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L189-L191
b7c2a51d52dc00cd73e8060263298002f838be45
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
offLocationChange
关闭位置变化订阅,并删除对应的定位请求。 @param callback 不传,取消当前类型的所有订阅。 @returns 失败返回错误码,成功返回0。
static offLocationChange(callback?: Callback<geoLocationManager.Location>): number { try { if (callback) { geoLocationManager.off('locationChange', callback); } else { geoLocationManager.off('locationChange'); //callback:需要取消订阅的回调函数。若无此参数,则取消当前类型的所有订阅。 } return 0; //成功返回-0 ...
AST#method_declaration#Left static offLocationChange AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . Location AST#...
static offLocationChange(callback?: Callback<geoLocationManager.Location>): number { try { if (callback) { geoLocationManager.off('locationChange', callback); } else { geoLocationManager.off('locationChange'); } return 0; } catch (err) { LogUtil.error(err); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L134-L147
fd3cfd366dbac104887ed806228e9f3199a65f67
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/ContactsPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage aboutToAppear'); this.loadContacts(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expre...
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage aboutToAppear'); this.loadContacts(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L35-L38
9bbe6bcd89d3e4b7a5d79ce60c227e9a1ff99000
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets
arkts
setContext
设置上下文信息 @param context
setContext(context: common.UIAbilityContext): void { this.objects.set(CONTEXT_STR, context); }
AST#method_declaration#Left setContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
setContext(context: common.UIAbilityContext): void { this.objects.set(CONTEXT_STR, context); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets#L45-L47
f3cebf92095dbee429555bdf2615968b0978d239
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
buildSearchHistorySection
构建搜索历史区域
@Builder buildSearchHistorySection() { Column({ space: 12 }) { Row() { Text('搜索历史') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .layoutWeight(1) Button('清除') .type(ButtonType.Capsule) .fontSize(12) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchHistorySection 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#com...
@Builder buildSearchHistorySection() { Column({ space: 12 }) { Row() { Text('搜索历史') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .layoutWeight(1) Button('清除') .type(ButtonType.Capsule) .fontSize(12) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L325-L358
72c78c2314763aeb8c6e957e61a1d4bf881240a6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/trace/src/main/ets/view/IconView.ets
arkts
IconItem
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct IconItem { image: string | Resource = ''; text: string | Resource = ''; build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignContent: FlexAlign.Center }) { Image(this.image) .id('itemImage') .height($r('app.integer.LazyForEachPag...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IconItem AST#component_body#Left { AST#property_declaration#Left image : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_ty...
@Component export struct IconItem { image: string | Resource = ''; text: string | Resource = ''; build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignContent: FlexAlign.Center }) { Image(this.image) .id('itemImage') .height($r('app.integer.LazyForEachPag...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/trace/src/main/ets/view/IconView.ets#L16-L41
c1114588177801243c0631a06fb27ed2b7551eef
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
getCurrentTheme
获取当前主题配置
getCurrentTheme(): ThemeConfig | null { return this.currentTheme; }
AST#method_declaration#Left getCurrentTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ThemeConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#...
getCurrentTheme(): ThemeConfig | null { return this.currentTheme; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L169-L171
71bbe90cf3b0115dca8d6fce5816767a28d16955
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
3D变换接口
export interface Transform3D { position: Vector3D; rotation: Vector3D; scale: Vector3D; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Transform3D AST#object_type#Left { AST#type_member#Left position : AST#type_annotation#Left AST#primary_type#Left Vector3D AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rotation : AST#type_annotat...
export interface Transform3D { position: Vector3D; rotation: Vector3D; scale: Vector3D; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L177-L181
ab2b498ee7870ee14e278416576198ec53c919b0
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/UpgradeAdapter.ets
arkts
getPageInstance
取支持的升级类型以及UX实例 @return 支持的升级类型以及UX实例
getPageInstance(): IPage { if (!this._page) { this._page = new OtaPage(); } return this._page; }
AST#method_declaration#Left getPageInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IPage 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_...
getPageInstance(): IPage { if (!this._page) { this._page = new OtaPage(); } return this._page; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/UpgradeAdapter.ets#L48-L53
03896ece1bb2000d121618da62f9914a34800d1b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
useShareTemplate
使用分享模板
async useShareTemplate(templateId: string, data: any): Promise<string> { try { const template = this.shareTemplates.find(t => t.id === templateId); if (!template) { throw new Error('分享模板不存在'); } // 使用模板生成内容 const content = this.applyTemplate(template.template, data); ...
AST#method_declaration#Left async useShareTemplate AST#parameter_list#Left ( AST#parameter#Left templateId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left any AST#prima...
async useShareTemplate(templateId: string, data: any): Promise<string> { try { const template = this.shareTemplates.find(t => t.id === templateId); if (!template) { throw new Error('分享模板不存在'); } const content = this.applyTemplate(template.template, data); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L344-L366
301c879b35696ca951383e4500102beadf12823f
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/schedule/common/models/addScheduleModel.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, softw...
export class AddScheduleModel { creatorId:string deviceConfig:string endTime:string name:string remindDay:string sceneId:string startTime:string stateDetail:string userIds:string constructor
AST#export_declaration#Left export AST#ERROR#Left class AddScheduleModel { creatorId : AST#ERROR#Left string deviceConfig : string endTime : string name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left rem in dDay AST#ERROR#Right : string sceneId : ...
export class AddScheduleModel { creatorId:string deviceConfig:string endTime:string name:string remindDay:string sceneId:string startTime:string stateDetail:string userIds:string constructor
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/common/models/addScheduleModel.ets#L16-L27
2bfdf6311eef0ffc1e9abb96f4053ab271babbba
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
selectDialog
选择类弹出框
selectDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showSelectDialog({ radioContent: ["文本菜单选项一", "文本菜单选项二", "文本菜单选项三", "文本菜单选项四", "文本菜单选项五"], onCheckedChanged: (index) => { ToastUtil.showToast(`${index}`); }, onAction: (action, dialogId, value) =...
AST#method_declaration#Left selectDialog 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statemen...
selectDialog(index: number) { if (index == 0) { DialogHelper.showSelectDialog({ radioContent: ["文本菜单选项一", "文本菜单选项二", "文本菜单选项三", "文本菜单选项四", "文本菜单选项五"], onCheckedChanged: (index) => { ToastUtil.showToast(`${index}`); }, onAction: (action, dialogId, value) => { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L381-L456
43ff801a266a887e2238c7b26b3b8316cfe7eef1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/DialogConfig.ets
arkts
TODO 弹窗工具类,默认样式参数 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class DialogConfig { //------------------------------------公共参数---promptAction.BaseDialogOptions---------------------------------------- uiAbilityContext?: common.UIAbilityContext; //设置UIAbilityContext backCancel: boolean = true; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。true表示关闭弹窗。false表示不关闭弹窗。默认值...
AST#export_declaration#Left export AST#class_declaration#Left class DialogConfig AST#class_body#Left { //------------------------------------公共参数---promptAction.BaseDialogOptions---------------------------------------- AST#property_declaration#Left uiAbilityContext ? : AST#type_annotation#Left AST#primary_type#Left AST...
export class DialogConfig { uiAbilityContext?: common.UIAbilityContext; backCancel: boolean = true; autoCancel: boolean = true; alignment: DialogAlignment = DialogAlignment.Default; offset: Offset = { dx: 0, dy: 0 }; maskRect: Rectangle = { x: 0, y: 0, width: '100%', height: '100%' }; maskColor...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/DialogConfig.ets#L28-L119
6cb738639bf5cef7cc6e15a739c52a8205bcea72
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/ValidationUtils.ets
arkts
validateName
验证姓名 @param name 姓名 @param type 姓名类型(chinese | english | mixed) @returns 是否有效
static validateName(name: string, type: 'chinese' | 'english' | 'mixed' = 'mixed'): boolean { if (!name || name.trim() === '') { return false; } const trimmedName = name.trim(); switch (type) { case 'chinese': { const regex = new RegExp(RegexConstants.CHINESE_NAME_REGEX); ...
AST#method_declaration#Left static validateName 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#Left type AST#ERROR#Left : 'chinese' | 'english' | 'mixed' AST#ERROR#Right = AST#...
static validateName(name: string, type: 'chinese' | 'english' | 'mixed' = 'mixed'): boolean { if (!name || name.trim() === '') { return false; } const trimmedName = name.trim(); switch (type) { case 'chinese': { const regex = new RegExp(RegexConstants.CHINESE_NAME_REGEX); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/ValidationUtils.ets#L45-L56
64cba85018181c76f0558d08668495dbfe49a543
github
seasonZhu/HarmonyStudy.git
b55e58c962e9b39d5211337590bdd45f2c2349b3
entry/src/main/ets/httpRequest/configuration/ConfigurationAxiosClient.ets
arkts
/ 定义Axios配置、请求拦截器和响应拦截器的接口
export interface ConfigurationAxiosClient extends AxiosRequestConfig { /// 根据需要添加Axios配置的自定义属性 }
AST#export_declaration#Left export AST#interface_declaration#Left interface ConfigurationAxiosClient AST#extends_clause#Left extends AxiosRequestConfig AST#extends_clause#Right AST#object_type#Left { /// 根据需要添加Axios配置的自定义属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ConfigurationAxiosClient extends AxiosRequestConfig { }
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/httpRequest/configuration/ConfigurationAxiosClient.ets#L4-L6
39f3cb9f6ecefba6276cf417a299d039ec8eba63
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/views/StateComponent.ets
arkts
convertValue
转换文案 @returns
convertValue() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.string.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.string.load_error') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: r...
AST#method_declaration#Left convertValue 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 switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewSt...
convertValue() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.string.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.string.load_error') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: r...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/StateComponent.ets#L59-L77
85981d57f2afee2f841fe95ab3dbbacd5d689fd8
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getSelect
【系统】单选弹窗(支持设置标题、内容、确认按钮、单选列表内容设置) @returns
static getSelect(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext): SelectBuilderProxy { return new SelectBuilderProxy(title, confirm, radioContent, uiContext) }
AST#method_declaration#Left static getSelect AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left confirm : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AS...
static getSelect(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext): SelectBuilderProxy { return new SelectBuilderProxy(title, confirm, radioContent, uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L75-L78
fac8d4bf7ef07b7ffcaade7d09ad8d01a90ea779
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
exportFullBackup
导出完整备份
async exportFullBackup(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting full backup export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0,...
AST#method_declaration#Left async exportFullBackup AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type...
async exportFullBackup(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting full backup export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0,...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L315-L366
325a9e9c1b188c0744ac3fae04a4b35a361b1fa1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets
arkts
requestPermission
请求读取图库媒体权限
static async requestPermission(context: common.UIAbilityContext, permissions: Array<Permissions>): Promise<PermissionResult> { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let result: PermissionRequestResult = await atManager.requestPermissionsFromUser(context, per...
AST#method_declaration#Left static async requestPermission AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static async requestPermission(context: common.UIAbilityContext, permissions: Array<Permissions>): Promise<PermissionResult> { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let result: PermissionRequestResult = await atManager.requestPermissionsFromUser(context, per...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets#L9-L28
08ec401490b51490c7c3b85b7a44d0ed89e490e5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSourceImpl.ets
arkts
@file 用户贡献者相关数据源实现类 @author Joker.X
export class UserContributorNetworkDataSourceImpl implements UserContributorNetworkDataSource { /** * 获取用户贡献者分页数据 * @param {PageRequest} params - 分页参数 * @returns {Promise<NetworkResponse<NetworkPageData<UserContributor>>>} 贡献者列表 */ async getUserContributorPage(params: PageRequest): Promise<NetworkRespon...
AST#export_declaration#Left export AST#class_declaration#Left class UserContributorNetworkDataSourceImpl AST#implements_clause#Left implements UserContributorNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /** * 获取用户贡献者分页数据 * @param {PageRequest} params - 分页参数 * @returns {Promise<NetworkRes...
export class UserContributorNetworkDataSourceImpl implements UserContributorNetworkDataSource { async getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<UserContributor>>> = await NetworkClien...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSourceImpl.ets#L10-L21
befec4bc6cc9b53387db3bc39c7289c8281d7540
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handletabs/src/main/ets/pages/HandleTabs.ets
arkts
HandleTabsComponent
功能描述: 本示例介绍使用了Tab组件实现自定义增删Tab页签的功能。 推荐场景: 多用于浏览器等场景。 核心组件: 1. 自定义TabBar 实现步骤: 1. 设置Tab组件的barHeight为0,隐藏组件自带的TabBar。 2. 使用@Link修饰符,将自定义TabBar组件和Tab组件通过focusIndex和tabArray进行双向绑定。 3. 在自定义TabBar中修改focusIndex和tabArray的值时,Tab组件根据数据变化进行对应UI变更。
@Component export struct HandleTabsComponent { @State tabArray: Array<number> = [0]; // 控制页签渲染的数组 @State focusIndex: number = 0; // Tabs组件当前显示的页签下标 private addressList: Array<number> = new Array(8).fill(0) // 快捷方式集合 controller: TabsController = new TabsController(); // Tabs控制器 /** * TabContent内容视图 */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HandleTabsComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tabArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type...
@Component export struct HandleTabsComponent { @State tabArray: Array<number> = [0]; @State focusIndex: number = 0; private addressList: Array<number> = new Array(8).fill(0) controller: TabsController = new TabsController(); @Builder tabContentBuilder() { Column() { Search().width('90%') ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/HandleTabs.ets#L34-L121
5eb6082dd4303e10d5c697c3e09caff315b589b4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativeembed/src/main/ets/mock/GoodsMock.ets
arkts
商品列表数据源
export const PRODUCT_DATA: Array<ProductDataModel> = [ new ProductDataModel(0, $r("app.media.nativeembed_product000"), $r("app.string.nativeembed_product_title000"), $r("app.string.nativeembed_product_price000")), new ProductDataModel(1, $r("app.media.nativeembed_product001"), $r("app.string.nativeembed_product_tit...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PRODUCT_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ProductDataModel AST#primary_type#Right AST#type_annotati...
export const PRODUCT_DATA: Array<ProductDataModel> = [ new ProductDataModel(0, $r("app.media.nativeembed_product000"), $r("app.string.nativeembed_product_title000"), $r("app.string.nativeembed_product_price000")), new ProductDataModel(1, $r("app.media.nativeembed_product001"), $r("app.string.nativeembed_product_tit...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/mock/GoodsMock.ets#L19-L26
b44e80a0d29f042e351bd504d34d860623ec94c9
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘90%’
export const THOUSANDTH_940: string = '94%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_940 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '94%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar...
export const THOUSANDTH_940: string = '94%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L62-L62
67addebf125e47f350f1b4ad6eccee15173f7265
github
ClozyA/DonateAPPForHarmony.git
8eaf7f25a91137e457d43d438316eacec061c87b
entry/src/main/ets/componet/Header.ets
arkts
Header
@Preview
@Component export struct Header { @Prop isIndex: boolean = false @Prop title:string = "" // @State isIndex: boolean = true // @State title: string = "首页-测试数据" build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center, }) { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Header AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right isIndex : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#...
@Component export struct Header { @Prop isIndex: boolean = false @Prop title:string = "" build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center, }) { Image(this.isIndex ? $r("app.media.ArrowBackFilled") : "") ...
https://github.com/ClozyA/DonateAPPForHarmony.git/blob/8eaf7f25a91137e457d43d438316eacec061c87b/entry/src/main/ets/componet/Header.ets#L4-L43
c86df48ab5f18be2040ef46aa46086bbe9252fcb
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
rehash
重新计算滑动窗口的哈希值 @param oldHash 旧哈希值 @param oldChar 要移除的字符 @param newChar 要添加的字符 @param h 最高位的权重 @returns 新的哈希值
private static rehash(oldHash: number, oldChar: string, newChar: string, h: number): number { let newHash = oldHash; newHash = (newHash + RabinKarp.PRIME - (oldChar.charCodeAt(0) * h) % RabinKarp.PRIME) % RabinKarp.PRIME; newHash = (newHash * RabinKarp.BASE + newChar.charCodeAt(0)) % RabinKarp.PRIME; re...
AST#method_declaration#Left private static rehash AST#parameter_list#Left ( AST#parameter#Left oldHash : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldChar : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
private static rehash(oldHash: number, oldChar: string, newChar: string, h: number): number { let newHash = oldHash; newHash = (newHash + RabinKarp.PRIME - (oldChar.charCodeAt(0) * h) % RabinKarp.PRIME) % RabinKarp.PRIME; newHash = (newHash * RabinKarp.BASE + newChar.charCodeAt(0)) % RabinKarp.PRIME; re...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L73-L78
7e672570809aab01256396bb7feee7e489a8e10e
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/route/RoutePath.ets
arkts
路由表管理
export class RoutePath { static readonly SplashPage = "pages/SplashPage" static readonly MainPage = "pages/MainPage" static readonly CategoryPage = "pages/CategoryPage" static readonly ContainerPage = "pages/container/ContainerPage" static readonly TopicDetailPage = "pages/topicDetail/TopicDetailPage" stati...
AST#export_declaration#Left export AST#class_declaration#Left class RoutePath AST#class_body#Left { AST#property_declaration#Left static readonly SplashPage = AST#expression#Left "pages/SplashPage" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly MainPage = AST#expressi...
export class RoutePath { static readonly SplashPage = "pages/SplashPage" static readonly MainPage = "pages/MainPage" static readonly CategoryPage = "pages/CategoryPage" static readonly ContainerPage = "pages/container/ContainerPage" static readonly TopicDetailPage = "pages/topicDetail/TopicDetailPage" stati...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/route/RoutePath.ets#L4-L16
8cce19916ec1504eb9ac32a308990b9d468c5a28
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets
arkts
应用约束1:参数添加类型注解
constructor(client: Client) { this.client = client; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left Client 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#...
constructor(client: Client) { this.client = client; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets#L36-L38
8d354255ea0ec8a42b2649913ad7f435f79bf0b2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
getSmsCode
获取短信验证码 @param {Record<string, string>} params - 验证码请求参数 @returns {Promise<NetworkResponse<string>>} 发送结果
async getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>> { const response: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("user/login/smsCode", params); return response.data; }
AST#method_declaration#Left async getSmsCode AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annot...
async getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>> { const response: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("user/login/smsCode", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L49-L53
7db512cb1429549b17672a72bbbf994cf0ba48b1
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets
arkts
stopRenderer
停止播放录音
async stopRenderer() { // 获取音频渲染器(播放器) const audioRenderer = await this.getAudioRenderer() if ( audioRenderer.state === audio.AudioState.STATE_RUNNING || audioRenderer.state === audio.AudioState.STATE_PAUSED ) { await audioRenderer.stop() // 停止 audioRenderer.release() /...
AST#method_declaration#Left async stopRenderer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取音频渲染器(播放器) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioRenderer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_e...
async stopRenderer() { const audioRenderer = await this.getAudioRenderer() if ( audioRenderer.state === audio.AudioState.STATE_RUNNING || audioRenderer.state === audio.AudioState.STATE_PAUSED ) { await audioRenderer.stop() audioRenderer.release() this.audioRend...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets#L176-L190
77a94922f7cb327bbe512d653f2a9d7f9166854b
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets
arkts
pushData
在数组末尾添加data
public pushData(data: string): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public pushData(data: string): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets#L91-L94
124b324b03ff722ae6c0c718a271eda962de6d2d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/analytics/AnalyticsService.ets
arkts
getStatisticsData
获取完整统计数据
async getStatisticsData(): Promise<StatisticsData> { try { const [overview, birthday, greeting, usage, trend] = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); ret...
AST#method_declaration#Left async getStatisticsData 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 StatisticsData AST#primary_type#Right AST#type_annotation#Right...
async getStatisticsData(): Promise<StatisticsData> { try { const [overview, birthday, greeting, usage, trend] = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); ret...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L168-L189
3bcc085b355a447d6299d86fce34edba89599404
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Task.ets
arkts
Task Data Model Represents a scheduled task with a specific due time Database row representation for Task
export interface TaskRow { id: number; title: string; due_time: number; is_done: number; created_at: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TaskRow AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#pr...
export interface TaskRow { id: number; title: string; due_time: number; is_done: number; created_at: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Task.ets#L9-L15
b051237cc06516ba31cb8b05eab6424b1a58b662
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets
arkts
OrderStatusItem
订单状态项
@Builder OrderStatusItem(label: string, icon: string, count: number) { Column({ space: AppDimensions.spaceSmall }) { Stack({ alignContent: Alignment.TopEnd }) { Text(icon) .fontSize(24) if (count > 0) { Text(count > 99 ? '99+' : count.toString()) .fontSize(10...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right OrderStatusItem AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Lef...
@Builder OrderStatusItem(label: string, icon: string, count: number) { Column({ space: AppDimensions.spaceSmall }) { Stack({ alignContent: Alignment.TopEnd }) { Text(icon) .fontSize(24) if (count > 0) { Text(count > 99 ? '99+' : count.toString()) .fontSize(10...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets#L173-L197
112178e080d1b519302825708084865cc7a7017c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets
arkts
getInitalList
原数组 返回原数组
public getInitalList() { let siteListString: string | undefined = AppStorage.get('siteList'); if (siteListString) { let siteListObject: SiteListDataSource | undefined = JSON.parse(siteListString); if (siteListObject === undefined) { return; } this.initialSiteList = siteListObject...
AST#method_declaration#Left public getInitalList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left siteListString : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#R...
public getInitalList() { let siteListString: string | undefined = AppStorage.get('siteList'); if (siteListString) { let siteListObject: SiteListDataSource | undefined = JSON.parse(siteListString); if (siteListObject === undefined) { return; } this.initialSiteList = siteListObject...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L29-L41
4a59b1c6cb685d601424dab442ed47c9a24b0130
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets
arkts
watchProgress
右边可滑动条状物对应的时间组件的宽度
watchProgress() { this.progressLinePosition = { x: this.leftThumbRect[2] + this.transparentWidth * this.progress, y: this.topPaddingWidth }; }
AST#method_declaration#Left watchProgress 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 . progressLinePosition AST#member_expr...
watchProgress() { this.progressLinePosition = { x: this.leftThumbRect[2] + this.transparentWidth * this.progress, y: this.topPaddingWidth }; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L85-L90
f3ee8869066efe3b85e2b0bf002f622c592fe825
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/LineRadarRenderer.ets
arkts
clipPathSupported
Clip path with hardware acceleration only working properly on API level 18 and above. @return
private clipPathSupported(): boolean { return Utils.getSDKInt() >= 8; }
AST#method_declaration#Left private clipPathSupported AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#bina...
private clipPathSupported(): boolean { return Utils.getSDKInt() >= 8; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/LineRadarRenderer.ets#L104-L106
ebaf941a3f29f1e6ad5dc45929cd505d11e16c5f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
addData
通过索引添加数据 @param index 索引号 @param data
public addData(index: number, data: T): void { this.originDataArray.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 T AST#primary_type#Right A...
public addData(index: number, data: T): void { this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L62-L65
a6b9f081c0f8271852f60787786c3779dfa7e581
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toLogin
跳转到登录页面 @returns {void} 无返回值
static toLogin(): void { navigateTo(AuthRoutes.Login); }
AST#method_declaration#Left static toLogin 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_expre...
static toLogin(): void { navigateTo(AuthRoutes.Login); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/auth/AuthNavigator.ets#L13-L15
18fa61ee059de7b3c438e97ec3e615f320d48f1f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/CalendarApiService.ets
arkts
getLunarFestivals
获取农历节日
private getLunarFestivals(key: string): Festival[] { const lunarFestivals: Record<string, Festival[]> = { '01-01': [{ name: '春节', type: 'legal', description: '农历新年', isHoliday: true, importance: 5 }], '01-15': [{ name: '元宵节', type: 'traditional', description: '正月十五', isHoliday: false, importance: 4 }], ...
AST#method_declaration#Left private getLunarFestivals AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#L...
private getLunarFestivals(key: string): Festival[] { const lunarFestivals: Record<string, Festival[]> = { '01-01': [{ name: '春节', type: 'legal', description: '农历新年', isHoliday: true, importance: 5 }], '01-15': [{ name: '元宵节', type: 'traditional', description: '正月十五', isHoliday: false, importance: 4 }], ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L393-L408
41cca88da71a723e61b59dbb9f3ea574957470db
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets
arkts
aboutToAppear
限制线类型 图表数据初始化
aboutToAppear() { // TODO 知识点:必须初始化图表配置构建类 this.model = new BarChartModel(); this.model.setPinchZoom(false); // TODO 知识点:配置图表指定样式,各部件间没有先后之分 // 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件 const description: Description | null = this.model.getDescription(); if (description) { description.setEnabl...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:必须初始化图表配置构建类 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right ...
aboutToAppear() { this.model = new BarChartModel(); this.model.setPinchZoom(false); const description: Description | null = this.model.getDescription(); if (description) { description.setEnabled(false); } const legend: Legend | null = this.model.getLegend(); if (leg...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets#L64-L141
625bfba0537d072f143ae4f779c44da5b4692245
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/Utils/FormIdStore.ets
arkts
getStore
获取 Preferences 实例
private static async getStore(context: common.Context): Promise<preferences.Preferences> { return await preferences.getPreferences(context, PREFERENCES_NAME); }
AST#method_declaration#Left private static async getStore 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#Righ...
private static async getStore(context: common.Context): Promise<preferences.Preferences> { return await preferences.getPreferences(context, PREFERENCES_NAME); }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/Utils/FormIdStore.ets#L9-L11
4b1c4893b2829450d5a643499e742da54c9faea7
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
draw
绘制
draw(context: DrawContext): void { // 初始化 this.instance.init(context, this.width, this.height) // 绘制 this.instance.draw() if (this.decorators.length == 0) return; // 遍历执行所有 ArkTS 装饰器 const canvas = context.canvas; const style = this.instance.getStyleConfi...
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext 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 ...
draw(context: DrawContext): void { this.instance.init(context, this.width, this.height) this.instance.draw() if (this.decorators.length == 0) return; const canvas = context.canvas; const style = this.instance.getStyleConfig(); const current = t...
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L247-L260
9bd4bcf212a6d46b69ec113b0db39e1c802935f7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
getFallbackValue
获取兜底值(优先默认值,其次取配置中第一个可用值) @param {BreakpointValueOptions<T>} options - 断点值配置 @param {T | undefined} defaultValue - 默认值 @returns {T} 兜底值
private getFallbackValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T { if (defaultValue !== undefined) { return defaultValue; } const orderedTypes: BreakpointType[] = [ BreakpointType.XS, BreakpointType.SM, BreakpointType.MD, BreakpointType.LG ]; for (...
AST#method_declaration#Left private getFallbackValue AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BreakpointValueOptions AST#type_argum...
private getFallbackValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T { if (defaultValue !== undefined) { return defaultValue; } const orderedTypes: BreakpointType[] = [ BreakpointType.XS, BreakpointType.SM, BreakpointType.MD, BreakpointType.LG ]; for (...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L163-L183
16a0e9b0a53f0ba4cd14e8e3429e94ec3ad2cf70
github
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
createFormBindingData
根据 data 类型创建 FormBindingData
public createFormBindingData(data: string | FormData): formBindingData.FormBindingData { if(typeof(data) === "string") return this.createEmptyFormBindingData(data); else return formBindingData.createFormBindingData(data); }
AST#method_declaration#Left public createFormBindingData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left FormData AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramet...
public createFormBindingData(data: string | FormData): formBindingData.FormBindingData { if(typeof(data) === "string") return this.createEmptyFormBindingData(data); else return formBindingData.createFormBindingData(data); }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L194-L197
67d58daf3a231e9e1a79e278ced5bf9fde3f4522
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
ReadStreamOptions type @interface ReadStreamOptions @syscap SystemCapability.FileManagement.File.FileIO @since 20
export interface ReadStreamOptions { /** * The starting range for reading a file by stream. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ start?: number; /** * The ending range for reading a file by stream. * * @type { ?number } * @sysc...
AST#export_declaration#Left export AST#interface_declaration#Left interface ReadStreamOptions AST#object_type#Left { /** * The starting range for reading a file by stream. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left start ? : AST#typ...
export interface ReadStreamOptions { start?: number; end?: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4487-L4505
2da733de422d27e8361ffe885b4421e346f13b8c
gitee
junw2024/hnchain-ArkTs.git
0cc3c182ad418709b577fa24e9fe909a205232c6
entry/src/main/ets/common/utils/WindowManager.ets
arkts
窗口状态栏管理
export default class WindowManager { //private readonly TAG = 'StatusBarManager'; private readonly CONFIG_SYSTEM_BAR_HEIGHT = 'systemBarHeight'; private static instance: WindowManager private windowStage: window.WindowStage; private mConfig = new HashMap<string,any>() private //单例模式 private constructo...
AST#export_declaration#Left export AST#ERROR#Left default class WindowManager { //private readonly TAG = 'StatusBarManager'; AST#property_declaration#Left private readonly CONFIG_SYSTEM_BAR_HEIGHT = AST#expression#Left 'systemBarHeight' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left...
export default class WindowManager { private readonly CONFIG_SYSTEM_BAR_HEIGHT = 'systemBarHeight'; private static instance: WindowManager private windowStage: window.WindowStage; private mConfig = new HashMap<string,any>() private private constructor
https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/common/utils/WindowManager.ets#L8-L17
e70b53b647f9de3e162802b5321e7f4f682e61d3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/constant/CommonConstant.ets
arkts
Common constants for common component.
export class CommonConstants { // custom dialog public static readonly CUSTOM_DIALOG_ICON_SIZE = 40; // percent public static readonly FULL_PERCENT: string = '100%'; public static readonly HALF_PERCENT: string = '50%'; // border radius public static readonly BORDER_RADIUS_SLIGHT: number = 2; public stat...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // custom dialog AST#property_declaration#Left public static readonly CUSTOM_DIALOG_ICON_SIZE = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right // percent AST#property_declaration#Left ...
export class CommonConstants { public static readonly CUSTOM_DIALOG_ICON_SIZE = 40; public static readonly FULL_PERCENT: string = '100%'; public static readonly HALF_PERCENT: string = '50%'; public static readonly BORDER_RADIUS_SLIGHT: number = 2; public static readonly BORDER_RADIUS_SOFT: number = 1...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/constant/CommonConstant.ets#L19-L75
1c7157e97530518ffe99557d2e71b4f38e340a93
gitee
jiwangyihao/FlameChase.git
446275e6972bd5f92a3c5b7eba354ca83d504594
entry/src/main/ets/utils/DesignSystem.ets
arkts
hslToRgb
Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. @param color The HSL color object {h, s, l} with values from 0-1. @returns The RGB representation {r, g, b} with values from 0-255.
static hslToRgb(color: ColorHSL): ColorRGB { let h = color.h; let s = color.s; let l = color.l; let r: number, g: number, b: number; if (s === 0) { r = g = b = l; // achromatic } else { const hue2rgb = (p: number, q: number, t: number): number => { if (t < 0) { t +...
AST#method_declaration#Left static hslToRgb AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ColorHSL AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ColorRGB AST#primary_t...
static hslToRgb(color: ColorHSL): ColorRGB { let h = color.h; let s = color.s; let l = color.l; let r: number, g: number, b: number; if (s === 0) { r = g = b = l; } else { const hue2rgb = (p: number, q: number, t: number): number => { if (t < 0) { t += 1; ...
https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/utils/DesignSystem.ets#L35-L76
d3601a669bc1d6d853e36331b3f7e0cec807f9d4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
get
MARK: - dayOfs 日份List
get dayOfs(): DayOf[] { let dict: Map<number, Box[]> = new Map(); // 每天的boxes按distance从小-大排序, // 这样就是实现每天的新字在前,复习的字在后面 this.boxes.sort((a, b) => a.compareTo(b)).forEach((box) => { if (dict.has(box.num)) { dict.get(box.num)!.push(box); } else { dict.set(box.num, [box]); ...
AST#method_declaration#Left get AST#ERROR#Left dayOfs AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DayOf [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AS...
get dayOfs(): DayOf[] { let dict: Map<number, Box[]> = new Map(); this.boxes.sort((a, b) => a.compareTo(b)).forEach((box) => { if (dict.has(box.num)) { dict.get(box.num)!.push(box); } else { dict.set(box.num, [box]); } }); let dayOfs: DayOf[] = Array.from(di...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L156-L174
76a612a87b1e7f5fbc11a4be251cc9b897c949ec
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
提前天数验证规则接口
export interface AdvanceDaysValidationRule { min: number; max: number; allowedValues: number[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AdvanceDaysValidationRule AST#object_type#Left { AST#type_member#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left max : AST#type_annot...
export interface AdvanceDaysValidationRule { min: number; max: number; allowedValues: number[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L157-L161
295f9adf7fa9e2db1f6359c46e3e141d4ba32748
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
deleteById
按主键删除 Demo 记录 @param {number} id - 记录主键 @returns {Promise<void>} Promise<void>
async deleteById(id: number): Promise<void> { this.orm.deleteById(DemoEntity, id); }
AST#method_declaration#Left async deleteById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async deleteById(id: number): Promise<void> { this.orm.deleteById(DemoEntity, id); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L62-L64
40626fdcf7f54933113f0a00a7bf9cd70b1db763
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getInstance
单例--升级管理类对象实例 @return 升级管理类对象实例
static getInstance(): OtaUpdateManager { return globalThis.otaUpdateManager ?? new OtaUpdateManager(); }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left OtaUpdateManager AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#ca...
static getInstance(): OtaUpdateManager { return globalThis.otaUpdateManager ?? new OtaUpdateManager(); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L57-L59
9fb15e9cba31e21995ba3f78444b314b74cfa52a
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/entry/PixelEntry.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 PixelEntry { a: number = 0; b: number = 0; r: number = 0; g: number = 0; f: number = 0; pixel: number = 0; public toString(): string { return 'PixelEntry a:' + this.a + ';b:' + this.b + ';r:' + this.r + ';g:' + this.g + ';f:' + this.f; } }
AST#export_declaration#Left export AST#class_declaration#Left class PixelEntry AST#class_body#Left { AST#property_declaration#Left a : 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#property_declaration#Right AST#...
export class PixelEntry { a: number = 0; b: number = 0; r: number = 0; g: number = 0; f: number = 0; pixel: number = 0; public toString(): string { return 'PixelEntry a:' + this.a + ';b:' + this.b + ';r:' + this.r + ';g:' + this.g + ';f:' + this.f; } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/entry/PixelEntry.ets#L15-L26
0f65103e8e1cd3de2647c2d13d62fc680fca5bf6
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
@file 订单确认页面 ViewModel @author Joker.X
@ObservedV2 export default class OrderConfirmViewModel extends BaseNetWorkViewModel<ConfirmOrder> { /** * 订单缓存本地存储仓库 */ private readonly orderCacheStoreRepository: OrderCacheStoreRepository = new OrderCacheStoreRepository(); /** * 页面仓库 */ private readonly pageRepository: PageRepository = new PageRep...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderConfirmViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary...
@ObservedV2 export default class OrderConfirmViewModel extends BaseNetWorkViewModel<ConfirmOrder> { private readonly orderCacheStoreRepository: OrderCacheStoreRepository = new OrderCacheStoreRepository(); private readonly pageRepository: PageRepository = new PageRepository(); private readonly orderReposi...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L22-L382
16c4d95fe996dc0232e59f587979e9522ec6687f
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/SplashScreenSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common Constants for all features.
export class CommonConstants { /** * Time default value. */ static readonly TIME_DEFAULT_VALUE: number = 0; /** * Delay seconds. */ static readonly DELAY_SECONDS: number = 3; /** * Incremental value. */ static readonly INCREMENT_VALUE: number = 1; /** * Interval delay. */ stat...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Time default value. */ AST#property_declaration#Left static readonly TIME_DEFAULT_VALUE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#exp...
export class CommonConstants { static readonly TIME_DEFAULT_VALUE: number = 0; static readonly DELAY_SECONDS: number = 3; static readonly INCREMENT_VALUE: number = 1; static readonly INTERVAL_DELAY: number = 1000; static readonly INTERVAL_ID_DEFAULT: number = 0; static readonly STACK_...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L89
07e3ebba39a4632b41392a104ee318b585e1941e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Chip.d.ets
arkts
Enum for ChipSize @enum { string } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Enum for ChipSize @enum { string } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare enum ChipSize { /** * Normal type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Normal type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ NORMAL = "NORMAL", /** * ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ChipSize AST#enum_body#Left { /** * Normal type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Normal type. * * @syscap SystemCapability.ArkUI.ArkUI.F...
export declare enum ChipSize { NORMAL = "NORMAL", SMALL = "SMALL" }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L44-L79
ec5d73bb1325cdbc640a6c39095a1485c22d0101
gitee
de8gemaker/AccountApp.git
b5156cd90ac02239b39fd0f91d32851acad8ba42
entry/src/main/ets/models/account/accountPO.ets
arkts
记录的数据库持久化对象
export default class AccountPO { /** * 记录id */ id?: number; /** * 记录类型 */ type: number; /** * 收支类型 */ accountType: number; /** * 记录描述 */ description?: string = ''; /** * 记录的创建时间 */ createTime?: number; /** * 金额 */ amount: number; /** * 记录日期 */ time: ...
AST#export_declaration#Left export default AST#class_declaration#Left class AccountPO AST#class_body#Left { /** * 记录id */ AST#property_declaration#Left id ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 记录类型 */...
export default class AccountPO { id?: number; type: number; accountType: number; description?: string = ''; createTime?: number; amount: number; time: number; }
https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/models/account/accountPO.ets#L4-L33
07818b27ab7dd2562c55ebe28aeec7be40a6e3a5
github
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleE/entry/src/main/ets/pages/buy/Buy.ets
arkts
aboutToAppear
纬度
aboutToAppear() { Logger.info(TAG, 'Buy aboutToAppear begin'); // 商家列表 this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => { Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`); this.businessList = res; this.businessList.forEa...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expr...
aboutToAppear() { Logger.info(TAG, 'Buy aboutToAppear begin'); this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => { Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`); this.businessList = res; this.businessList.forEach((bus...
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleE/entry/src/main/ets/pages/buy/Buy.ets#L36-L56
f56f71107318178dd7d69dbd2d7678c2ed647955
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Piece.ets
arkts
get
获取wordIds数组
get wordIds(): number[] { return this._wordIds; }
AST#method_declaration#Left get AST#ERROR#Left wordIds AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left ...
get wordIds(): number[] { return this._wordIds; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L32-L34
3674ed5beb297945bbf1c85727a587c5fc43941e
github
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/pages/startPage/LoginPage.ets
arkts
LoginPage
登录页面
@Entry @Component export struct LoginPage{ @State @Watch('onInputChange') inputnickname:string='' @State @Watch('onInputChange') inputpassword:string='' @State btnisdisable:boolean=true onInputChange(){ // 当两输入框和密码不为空时,登录按钮才可以被点击 this.btnisdisable=!(this.inputnickname&&this.inputpassword) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct LoginPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onInput...
@Entry @Component export struct LoginPage{ @State @Watch('onInputChange') inputnickname:string='' @State @Watch('onInputChange') inputpassword:string='' @State btnisdisable:boolean=true onInputChange(){ this.btnisdisable=!(this.inputnickname&&this.inputpassword) }
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/pages/startPage/LoginPage.ets#L7-L19
5295d83faff7c78892225330f20b7cc0a5351412
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
getAllItems
查询全部 Demo 记录并按更新时间倒序 @returns {Promise<DemoEntity[]>} Demo 列表
async getAllItems(): Promise<DemoEntity[]> { const list: DemoEntity[] = this.orm.query(DemoEntity).find(); // 以更新时间/创建时间倒序排列,便于展示最新数据 return list.sort((left: DemoEntity, right: DemoEntity) => { const leftTime: number = new Date(left.updatedAt ?? left.createdAt ?? "").getTime() || 0; const rightT...
AST#method_declaration#Left async getAllItems 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 DemoEntity [ ] AST#array_type#Right AST#primary_t...
async getAllItems(): Promise<DemoEntity[]> { const list: DemoEntity[] = this.orm.query(DemoEntity).find(); return list.sort((left: DemoEntity, right: DemoEntity) => { const leftTime: number = new Date(left.updatedAt ?? left.createdAt ?? "").getTime() || 0; const rightTime: number = new Date(rig...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L78-L86
e0c715029be2c6532d4d9266a23a4d079f8fd03a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
getTargetId
获取 targetId,半模态用到 @param uiContext @param uniqueIdOrStrId 组件的id 或组件的uniqueId,this.getUniqueId()。 @returns
getTargetId(uiContext: UIContext, uniqueIdOrStrId: number | string): number | undefined { if (typeof uniqueIdOrStrId === 'number') { let frameNode: FrameNode | null | undefined = uiContext?.getFrameNodeByUniqueId(uniqueIdOrStrId); let targetId = frameNode?.getFirstChild()?.getUniqueId(); return ta...
AST#method_declaration#Left getTargetId AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uniqueIdOrStrId : AST#type_annotation#Left AST#union_type#Left AST#primary_t...
getTargetId(uiContext: UIContext, uniqueIdOrStrId: number | string): number | undefined { if (typeof uniqueIdOrStrId === 'number') { let frameNode: FrameNode | null | undefined = uiContext?.getFrameNodeByUniqueId(uniqueIdOrStrId); let targetId = frameNode?.getFirstChild()?.getUniqueId(); return ta...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L273-L283
c064bb3d4bcb60e2b5c1c5a84b7a71ba4db55554
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/pages/TakeTaxiDetailPage.ets
arkts
TakeTaxiDetailPage
页面背景透明并设置事件穿透,用于显示及操作下层地图组件,绑定半模态用来显示内容
@Component export struct TakeTaxiDetailPage { @State pageHeight: number = 0; @Consume pageStackForComponentSharedPages: NavPathStack; // 用于调整下层地图组件和上层内容的手势响应区域,跟scroll的currentOffset相关 @Consume mapResponseRegionHeight: number; @State isShow: boolean = true; @State isCenter: boolean = true; @State curFoldSt...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TakeTaxiDetailPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right pageHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t...
@Component export struct TakeTaxiDetailPage { @State pageHeight: number = 0; @Consume pageStackForComponentSharedPages: NavPathStack; @Consume mapResponseRegionHeight: number; @State isShow: boolean = true; @State isCenter: boolean = true; @State curFoldStatus: display.FoldStatus = 0; private screenW: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/pages/TakeTaxiDetailPage.ets#L22-L47
2146c29f7efe89cdc37d912ca2b95b047f7ac22a
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/views/StateComponent.ets
arkts
convertImage
转换图片 @returns
convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.common_empty_content') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: ...
AST#method_declaration#Left convertImage 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 switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewSt...
convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.common_empty_content') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: ...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/StateComponent.ets#L83-L101
10610ffec0ab1166a0a99107ed042a6dcac496e1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/selecttextmenu/src/main/ets/component/RichEditorComponent.ets
arkts
initMenuOptions
初始化文本选择按钮
initMenuOptions() { this.onCreatMenu = (textMenuItems: Array<TextMenuItem>) => { if (this.menuItemsContent) { // 循环遍历新增选项数组,传入RichEditor组件中 this.menuItemsContent.forEach((value) => { textMenuItems.push(value); }) } return textMenuItems; } this.onMenuItemCl...
AST#method_declaration#Left initMenuOptions 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 . onCreatMenu AST#member_expression#...
initMenuOptions() { this.onCreatMenu = (textMenuItems: Array<TextMenuItem>) => { if (this.menuItemsContent) { this.menuItemsContent.forEach((value) => { textMenuItems.push(value); }) } return textMenuItems; } this.onMenuItemClick = (textMenuItems: TextMen...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/selecttextmenu/src/main/ets/component/RichEditorComponent.ets#L62-L87
15d9a4c6cbf086fdf3f13a7f52fc8e25790e4802
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowScratchingBoard.ets
arkts
SaveMenu
Save menu
@Builder SaveMenu() { Menu() { MenuItem({ content: $r('app.string.Save_to_files'), }) .onClick(() => { document_save_from_uri(this.text); }) MenuItem({ content: $r('app.string.Save_to_gallery'), }).onClick(() => { image_save_from_uri(this.t...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SaveMenu 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#L...
@Builder SaveMenu() { Menu() { MenuItem({ content: $r('app.string.Save_to_files'), }) .onClick(() => { document_save_from_uri(this.text); }) MenuItem({ content: $r('app.string.Save_to_gallery'), }).onClick(() => { image_save_from_uri(this.t...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowScratchingBoard.ets#L172-L189
5ec5702f1b8fc047cf8fe58e10197f1f0d055de9
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/network/RequestStockBasicInfoApi.ets
arkts
queryStockListBaseInfo
从上交所或者深交所请求【一组股票】的基础信息:最新价 昨开价 最高 最低等 @param stockCodeAry stockCode List @param callback stockCode:StockBasicInfoBean
public queryStockListBaseInfo(stockCodeAry: string[], callback: Callback<Map<string, StockBasicInfoBean>>) { if (stockCodeAry.length <= 0) { callback(new Map<string, StockBasicInfoBean>()) return } // 合并两个网络请求的函数 const time = new Date().getTime() //code,name,open,high,low,last,prev_close...
AST#method_declaration#Left public queryStockListBaseInfo AST#parameter_list#Left ( AST#parameter#Left stockCodeAry : 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#Left callback : AS...
public queryStockListBaseInfo(stockCodeAry: string[], callback: Callback<Map<string, StockBasicInfoBean>>) { if (stockCodeAry.length <= 0) { callback(new Map<string, StockBasicInfoBean>()) return } const time = new Date().getTime() const select = 'code,name,open,high,low,volume,las...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/network/RequestStockBasicInfoApi.ets#L94-L122
795d3b34793bd95b6a7b7a6cfabfc7bae2a8ba6f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
AR场景配置接口
export interface ARSceneConfig { id: string; type: ARCardType; name: string; description: string; duration: number; // 动画持续时间(秒) autoPlay: boolean; loopAnimation: boolean; backgroundMusic?: string; soundEffects: string[]; lighting: LightingConfig; camera: CameraConfig; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ARSceneConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left A...
export interface ARSceneConfig { id: string; type: ARCardType; name: string; description: string; duration: number; autoPlay: boolean; loopAnimation: boolean; backgroundMusic?: string; soundEffects: string[]; lighting: LightingConfig; camera: CameraConfig; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L27-L39
2a4ba051258a6929636dcc3850f3faae5f7c1857
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/media/MediaManager.ets
arkts
pause
暂停播放
pause(): void { this.playerState.isPlaying = false; Logger.info('MediaManager', 'Playback paused'); }
AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre...
pause(): void { this.playerState.isPlaying = false; Logger.info('MediaManager', 'Playback paused'); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L52-L55
077e4a191d9f83bde842e0c9f71b5334a87fdec9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/utils/BackgroundTaskManager.ets
arkts
Background task tool class.
export class BackgroundTaskManager { public static startContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: context.abilityInfo.bundleName, abilityName: context.abi...
AST#export_declaration#Left export AST#class_declaration#Left class BackgroundTaskManager AST#class_body#Left { AST#method_declaration#Left public static startContinuousTask AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbility...
export class BackgroundTaskManager { public static startContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: context.abilityInfo.bundleName, abilityName: context.abi...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/utils/BackgroundTaskManager.ets#L26-L66
1e38aa984483889c97026018271df9a002da77e2
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/harA/src/main/ets/components/mainpage/A1.ets
arkts
harBuilder
[Start function_har_builder_a1]
@Builder export function harBuilder(value: object) { NavDestination() { Column() { // [StartExclude function_har_builder_a1] Text(`传入的参数:${JSON.stringify(value)}`) .margin(20) Button($r("app.string.to_index"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function harBuilder AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST...
@Builder export function harBuilder(value: object) { NavDestination() { Column() { Text(`传入的参数:${JSON.stringify(value)}`) .margin(20) Button($r("app.string.to_index"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harA/src/main/ets/components/mainpage/A1.ets#L18-L56
4cc8d4dc1b0293681196589031631c900ce39afd
gitee
youfrweb/harmonyProject.git
c95207f5ef319719a960c9e9a75b0c14a24842eb
entry/src/main/ets/utils/constant.ets
arkts
PersistentStorage 存储用户最近搜索记录
export const RECENT_SEARCH_LIST: string = 'recent_search_list' // AppStorage // 当前查找提示
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left RECENT_SEARCH_LIST : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'recent_search_list' AST#expression#Right AST#variable_declarator#Right //...
export const RECENT_SEARCH_LIST: string = 'recent_search_list'
https://github.com/youfrweb/harmonyProject.git/blob/c95207f5ef319719a960c9e9a75b0c14a24842eb/entry/src/main/ets/utils/constant.ets#L3-L6
9c30ed19154800088ba3c38b8653f4562c151db4
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
resetSegments
重置动画播放片段, 使动画重新从第一帧开始播放完整动画 @param forceFlag 值为true立刻生效, 值为false循环下次播放的时候生效 @since 8 @design
resetSegments(forceFlag: boolean) { this.animationItem?.resetSegments(forceFlag) }
AST#method_declaration#Left resetSegments AST#parameter_list#Left ( AST#parameter#Left forceFlag : 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#builder_function_body#Left { AST#expression_statement#Left AST#exp...
resetSegments(forceFlag: boolean) { this.animationItem?.resetSegments(forceFlag) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L230-L232
0271c8ac52728096b87d6583e6410ba30967d9eb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
resize
改变当前窗口大小,使用Promise异步回调。调用成功即返回,该接口返回后无法立即获取最终生效结果,如需立即获取,建议使用接口resizeAsync()。 @param width 目标窗口的宽度,单位为px,该参数仅支持整数输入,浮点数输入将向下取整,负值为非法参数。 @param height 目标窗口的高度,单位为px,该参数仅支持整数输入,浮点数输入将向下取整,负值为非法参数。 @param windowClass 不传该值,默认主窗口。 @returns
static async resize(width: number, height: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.resize(width, height); }
AST#method_declaration#Left static async resize AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
static async resize(width: number, height: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.resize(width, height); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L449-L452
b68b90ce02de7e2e4921bcfd8c81119e735537a2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/DashboardPage.ets
arkts
buildFilters
构建筛选器
@Builder buildFilters() { Column({ space: 12 }) { // 时间范围选择 Column({ space: 8 }) { Text('时间范围') .fontSize(14) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .width('100%') Scroll() { Row({ space: 8 }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilters 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_parame...
@Builder buildFilters() { Column({ space: 12 }) { Column({ space: 8 }) { Text('时间范围') .fontSize(14) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .width('100%') Scroll() { Row({ space: 8 }) { ForE...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/DashboardPage.ets#L202-L275
d1c7be883c961d76c115f7c0cc5ed4c2b4faa4c9
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinN.ets
arkts
SpinN
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinN { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinN AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinN { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinN.ets#L21-L281
d25b4abed185ac0ea9bf063db393c4c9c98c601c
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
unSubscribeUncollectEvent
取消订阅取消收藏event
unSubscribeUncollectEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_UNCOLLECT, key) }
AST#method_declaration#Left unSubscribeUncollectEvent 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#builder_function_body#Left { AST#expression_statement#Left AS...
unSubscribeUncollectEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_UNCOLLECT, key) }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L160-L162
2f83481462bfb44325627bec3abf7c24988f0c25
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets
arkts
getRouteInfoAndLinkAddress
[End fuction_judge_has_net] [Start get_route_info_and_link_address]
getRouteInfoAndLinkAddress() { connection.getDefaultNet().then((netHandle: connection.NetHandle) => { if (!netHandle || netHandle.netId === 0) { // If there is no default network, the netid of the obtained netHandler is 0, which is an exception. You can add some processing mechanisms as required. ...
AST#method_declaration#Left getRouteInfoAndLinkAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expressi...
getRouteInfoAndLinkAddress() { connection.getDefaultNet().then((netHandle: connection.NetHandle) => { if (!netHandle || netHandle.netId === 0) { return; } connection.getConnectionProperties(netHandle, (error: BusinessError, data: connection.ConnectionProperties) => { if (e...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets#L84-L104
d4f87acbe64bf3879468fc26c362e76d542f7406
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/FullScreen.ets
arkts
enable
启动全屏
async enable() { try { const ctx = AppStorage.get<Context>('context') // 空安全 if (ctx) { const winObj = await window.getLastWindow(ctx) // 上层窗口对象 // 打开全屏 winObj.setWindowLayoutFullScreen(true) // 异步操作 // logger.info('FullScreen封装', '完成') // 获取规避区域的高度 ...
AST#method_declaration#Left async enable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ctx = AST#expression#Left AST#call_express...
async enable() { try { const ctx = AppStorage.get<Context>('context') if (ctx) { const winObj = await window.getLastWindow(ctx) winObj.setWindowLayoutFullScreen(true) const statusBar = winObj.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTE...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/FullScreen.ets#L18-L42
590c7b77dd6d69ffbf5753ccfed7603936f12968
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets
arkts
back
返回页面
back(): boolean { if (this.webController.accessBackward()) { this.webController.backward(); return true; } return false; }
AST#method_declaration#Left back AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expres...
back(): boolean { if (this.webController.accessBackward()) { this.webController.backward(); return true; } return false; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets#L34-L40
ff419780080061fc21ca92e0a8dce40179432092
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/SoundEffect/SEManager.ets
arkts
clear
清空所有音效资源
public async clear(): Promise<void> { if (!this.soundPool) { return; } try { // 卸载所有音效 for (let entry of this.soundMap.entries()) { let type = entry[0]; // 第一个元素是键 let soundId = entry[1]; // 第二个元素是值 if (soundId > 0) { await this.soundPool.unload(soundId);...
AST#method_declaration#Left public async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
public async clear(): Promise<void> { if (!this.soundPool) { return; } try { for (let entry of this.soundMap.entries()) { let type = entry[0]; let soundId = entry[1]; if (soundId > 0) { await this.soundPool.unload(soundId); console.info(`Soun...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L240-L263
cd0c02d3bef746e662dfc1c76ef8583e53a76a01
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/eventpropagation/src/main/ets/view/FunctionDescription.ets
arkts
FunctionDescription
模块功能描述组件 @param title 标题 @param context 内容
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.ohos_id_text_size_headline')) .fontWeight(FontWeight.Medium) .textOverflow({ove...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FunctionDescription AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#...
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.ohos_id_text_size_headline')) .fontWeight(FontWeight.Medium) .textOverflow({ove...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eventpropagation/src/main/ets/view/FunctionDescription.ets#L21-L47
f5d79c5585faad16677f9e40638f58b160129654
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkWordPronUsable
============================================================ MARK: - Check times functions / 检查 单词发音功能 是否可用
public checkWordPronUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 /// 剩余 单词发音次数 if (this.remainWordPronCount() === 0) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_word_pron'), this.maxWordPronCountDail...
AST#method_declaration#Left public checkWordPronUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST...
public checkWordPronUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } if (this.remainWordPronCount() === 0) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_word_pron'), this.maxWordPronCountDaily)) } retur...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L188-L200
0da552c13f5ce7c456216b3c990bcc476130d47b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isAnyArrayBuffer
检查是否为ArrayBuffer或SharedArrayBuffer类型。 @param value @returns
static isAnyArrayBuffer(value: Object): boolean { return new util.types().isAnyArrayBuffer(value); }
AST#method_declaration#Left static isAnyArrayBuffer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object 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#prim...
static isAnyArrayBuffer(value: Object): boolean { return new util.types().isAnyArrayBuffer(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L163-L165
aa96469a2d941ca657c1f0e7cd317e234e1bba69
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets
arkts
one
@har/Index.ets
export { one } from '../Numbers'
AST#export_declaration#Left export { one } from '../Numbers' AST#export_declaration#Right
export { one } from '../Numbers'
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L65-L65
923a70fd9631c303ab5eb22d3e86b7b31d4d2f6b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets
arkts
pointInArea
某个点是否在某个范围内 @param x @param y @param area @returns
pointInArea(x: number, y: number, area: Array<number>): boolean { if (area.length === 4) { if (x >= (area[0] - 10) && x <= (area[2] + 10)) { return true; } else { return false; } } else { return false; } }
AST#method_declaration#Left pointInArea AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty...
pointInArea(x: number, y: number, area: Array<number>): boolean { if (area.length === 4) { if (x >= (area[0] - 10) && x <= (area[2] + 10)) { return true; } else { return false; } } else { return false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L380-L393
70141dd981d5357a474a87177f48509ba3c20e14
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
needsUpgrade
检查设置是否需要升级 @returns 是否需要升级
async needsUpgrade(): Promise<boolean> { try { const settings = await this.getSettings(); return settings.version !== BusinessConstants.SETTINGS_VERSION.toString(); } catch (error) { return true; // 如果无法读取版本,认为需要升级 } }
AST#method_declaration#Left async needsUpgrade AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_...
async needsUpgrade(): Promise<boolean> { try { const settings = await this.getSettings(); return settings.version !== BusinessConstants.SETTINGS_VERSION.toString(); } catch (error) { return true; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L441-L448
b529577cff592c23fd4c584f63357197a31238f4
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
rotate
旋转动画
static rotate(duration: number = 300): object { return { duration: duration, curve: curve.Linear, iterations: -1 // 无限循环 }; }
AST#method_declaration#Left static rotate 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#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
static rotate(duration: number = 300): object { return { duration: duration, curve: curve.Linear, iterations: -1 }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L51-L57
b6e176257502bc0a1c9e264aa4b01e7285cb6cc3
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
hideDeleteDialog
隐藏删除确认弹窗,并清空待删除 ID @returns {void} 无返回值
hideDeleteDialog(): void { this.isDeleteDialogVisible = false; this.deleteId = null; }
AST#method_declaration#Left hideDeleteDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m...
hideDeleteDialog(): void { this.isDeleteDialogVisible = false; this.deleteId = null; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressListViewModel.ets#L119-L122
682e852268f5e1ba793b7df557dffcd88e36569e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/play/DescriptionView.ets
arkts
textStyle
text style. @param fontSize Font size. @param fonWeight Font weight.
@Extend(Text) function textStyle(fontSize: Resource, fonWeight: number) { .fontSize(fontSize) .fontWeight(fonWeight) .fontColor($r('app.color.start_window_background')) .textAlign(TextAlign.Center) .margin(CommonConstants.MARGIN_PLAY_PAGE) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function textStyle AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AS...
@Extend(Text) function textStyle(fontSize: Resource, fonWeight: number) { .fontSize(fontSize) .fontWeight(fonWeight) .fontColor($r('app.color.start_window_background')) .textAlign(TextAlign.Center) .margin(CommonConstants.MARGIN_PLAY_PAGE) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/DescriptionView.ets#L23-L30
bb22137979070150df441dbee544961e3795706f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/view/VideoScreenDirectionSwitching.ets
arkts
VideoScreenDirectionSwitchingComponent
获取mock数据的json名称 功能描述: 本示例介绍了@ohos.multimedia.media组件和@ohos.window接口以及使用触摸热区实现视频横竖屏切换及进度条热区拖动的功能 推荐场景: 横竖屏视频等媒体播放场景 核心组件: 1. AVPlayer 实现步骤: 1. 初始化@ohos.multimedia.media的AVPlayer。 2. 当AVPlayer初始化完毕进入initialized状态时,将XComponent和AVPlayer通过surfaceId绑定。 3. 使用AVPlayer中的width和height属性判断是横屏视频还是竖屏视频,方便判断是否需要展示全屏观看按钮。 4. 调用@oh...
@Component export struct VideoScreenDirectionSwitchingComponent { @State contentData: FlowItemContentsData = new FlowItemContentsData(); // 瀑布流内容 @State selectedVideo: string = ''; // 选择的视频名称 @State selectedIndex: number = 0; // 选择的视频index @State isLandscape: boolean = false; // 是否横屏状态 @State isLandscapeStart...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoScreenDirectionSwitchingComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right contentData : AST#type_annotation#Left AST#primary_type#Left FlowItemConten...
@Component export struct VideoScreenDirectionSwitchingComponent { @State contentData: FlowItemContentsData = new FlowItemContentsData(); @State selectedVideo: string = ''; @State selectedIndex: number = 0; @State isLandscape: boolean = false; @State isLandscapeStart: boolean = false; @State statusHeigh...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/view/VideoScreenDirectionSwitching.ets#L41-L110
f5572966c3c27563907c0423e74ee348a3347a17
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
addDays
添加天数 @param date 基准日期 @param days 要添加的天数(可为负数) @returns 新的日期
static addDays(date: Date, days: number): Date { const result = new Date(date); result.setDate(result.getDate() + days); return result; }
AST#method_declaration#Left static addDays 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 days : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
static addDays(date: Date, days: number): Date { const result = new Date(date); result.setDate(result.getDate() + days); return result; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L181-L185
0ae6b0e8e7cd62b796578e5a2a8181462cd98ec0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/Part_Unit.ets
arkts
get
计算属性:获取错误回答的单词
get wrongWords(): WordUser[] { return this.aliveWords.filter(word => word.wrangTimes > 0 && word.correctedTimes === 0 ); }
AST#method_declaration#Left get AST#ERROR#Left wrongWords AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#...
get wrongWords(): WordUser[] { return this.aliveWords.filter(word => word.wrangTimes > 0 && word.correctedTimes === 0 ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Part_Unit.ets#L27-L31
5d3a765f27d87db4136bad7bd002ca5673fa492d
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
群聊列表请求参数
export interface GroupListParams { id: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GroupListParams AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Ri...
export interface GroupListParams { id: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L213-L215
ab51f4a7a7705f20d8934a7d48b483c222a5c36a
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/util/VersionUtils.ets
arkts
是否是AB升级 @return 是否是AB升级
export async function isABInstall(): Promise<boolean> { let newVersionInfo = globalThis.cachedNewVersionInfo || await OtaUpdateManager.getInstance().getNewVersion() .then(upgradeData => { this.log(`isABInstall upgradeData: ${upgradeData}`); return upgradeData.callResult == UpgradeCallResult.OK...
AST#export_declaration#Left export AST#function_declaration#Left async function isABInstall AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
export async function isABInstall(): Promise<boolean> { let newVersionInfo = globalThis.cachedNewVersionInfo || await OtaUpdateManager.getInstance().getNewVersion() .then(upgradeData => { this.log(`isABInstall upgradeData: ${upgradeData}`); return upgradeData.callResult == UpgradeCallResult.OK...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/util/VersionUtils.ets#L120-L131
e069b8a0ec909c48e6850f75c863e77a692a99b6
gitee