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
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
features/settings/Index.ets
arkts
Settings
Copyright (c) 2024 Yang He TickAuth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be...
export { Settings } from './src/main/ets/pages/Settings'
AST#export_declaration#Left export { Settings } from './src/main/ets/pages/Settings' AST#export_declaration#Right
export { Settings } from './src/main/ets/pages/Settings'
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/settings/Index.ets#L18-L18
aaf92b604b9a092bb3e27d902e051d274132c63a
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/MerchantDetailPage.ets
arkts
isFavorited
检查是否已收藏
private isFavorited(): boolean { if (!this.merchant) { return false; } return this.favoriteIds.includes(this.merchant.id); }
AST#method_declaration#Left private isFavorited AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expressio...
private isFavorited(): boolean { if (!this.merchant) { return false; } return this.favoriteIds.includes(this.merchant.id); }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/MerchantDetailPage.ets#L133-L138
92c345caa9117c4a639e79f73dcc83ca33008217
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
on
注册事件监听 @param eventName 事件名 @param handler 监听回调 @param isSticky 是否粘性 @returns
on(eventName: string, handler: Function, isSticky = false) { if (typeof handler === 'function') { let items: Set<Function> | undefined = EventBusCore.events.get(eventName); if (!items) { items = new Set(); EventBusCore.events.set(eventName, items); } items.add(handler); //添加事...
AST#method_declaration#Left on AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right...
on(eventName: string, handler: Function, isSticky = false) { if (typeof handler === 'function') { let items: Set<Function> | undefined = EventBusCore.events.get(eventName); if (!items) { items = new Set(); EventBusCore.events.set(eventName, items); } items.add(handler); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L25-L44
9df355db0e5892a65da8c5cd3e29bd79ecf298d4
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets
arkts
aboutToAppear
[StartExclude positive_of_lazy_for_each]
aboutToAppear(): void { for (let i = 1; i < 1000; i++) { this.data.pushData(i); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_...
aboutToAppear(): void { for (let i = 1; i < 1000; i++) { this.data.pushData(i); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets#L52-L56
0018cf77a6c8e7d59a27a2c56150998e1adea671
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Returns window of named by the id. @param id The id. @returns The window.Window.
export function window_of_id(id: string) { let windowClasses = AppStorage.get('windows') as window.Window[]; let idx = window_index_of_id(id); return windowClasses[idx]; }
AST#export_declaration#Left export AST#function_declaration#Left function window_of_id 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#st...
export function window_of_id(id: string) { let windowClasses = AppStorage.get('windows') as window.Window[]; let idx = window_index_of_id(id); return windowClasses[idx]; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L460-L464
6f2cae1171fde11e200b56a7023c378684e824f2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
scheduleUpcomingBirthdayReminder
为即将到来的生日创建提前提醒
public async scheduleUpcomingBirthdayReminder(contacts: Contact[], days: number, reminderTime: string): Promise<boolean> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Scheduling upcoming birthday reminder for ${contacts.length} contacts in ${days} days`); ...
AST#method_declaration#Left public async scheduleUpcomingBirthdayReminder 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 ...
public async scheduleUpcomingBirthdayReminder(contacts: Contact[], days: number, reminderTime: string): Promise<boolean> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Scheduling upcoming birthday reminder for ${contacts.length} contacts in ${days} days`); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L322-L367
64095d2bb78e2ac8885ec66be31146b059268fa0
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/view/Add/KeyBoardComponent.ets
arkts
dateGridItem
展示日期
@Builder dateGridItem(date: Date) { Text(dateToStr(date) === dateToStr(new Date(this.selectedDate)) ? '今日' : '' + (new Date(this.selectedDate).getMonth() + 1).toString() + '.' + new Date(this.selectedDate).getDate().toString()) .allSize() .textAlign(TextAlign.Center) .backgroundColor(Color.White...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dateGridItem AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left...
@Builder dateGridItem(date: Date) { Text(dateToStr(date) === dateToStr(new Date(this.selectedDate)) ? '今日' : '' + (new Date(this.selectedDate).getMonth() + 1).toString() + '.' + new Date(this.selectedDate).getDate().toString()) .allSize() .textAlign(TextAlign.Center) .backgroundColor(Color.White...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Add/KeyBoardComponent.ets#L168-L189
f7683a55cd792a6c957af9ba6cd7d7d5d8527d15
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
markAsRead
标记通知为已读
public markAsRead(notificationId: string): boolean { const notification = this.notifications.find(n => n.id === notificationId); if (notification) { notification.status = NotificationStatus.READ; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Marked no...
AST#method_declaration#Left public markAsRead AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
public markAsRead(notificationId: string): boolean { const notification = this.notifications.find(n => n.id === notificationId); if (notification) { notification.status = NotificationStatus.READ; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Marked no...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L272-L281
021b2b285d2fb7cff84b60f5922feb5bc4d22674
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderListPage.ets
arkts
OrderListContent
订单列表页面内容视图 @returns {void} 无返回值
@Builder private OrderListContent() { RefreshLayout({ loading: this.vm.isLoading, isEnableSlideUp: this.vm.isEnableSlideUp, scroller: this.listScroller, onRefresh: (direction): void => this.vm.onRefreshDirection(direction) }) { List({ space: 12, scroller: this.listScroller }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderListContent 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 RefreshLayout ( AST#component_parameters#Left { A...
@Builder private OrderListContent() { RefreshLayout({ loading: this.vm.isLoading, isEnableSlideUp: this.vm.isEnableSlideUp, scroller: this.listScroller, onRefresh: (direction): void => this.vm.onRefreshDirection(direction) }) { List({ space: 12, scroller: this.listScroller }) { ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderListPage.ets#L62-L85
c099e031fad6a3f8692917ba2d64781cae1af05a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getAxisLineDashPathEffect
returns the DashPathEffect that is set for axis line @return
public getAxisLineDashPathEffect(): DashPathEffect | null { return this.mAxisLineDashPathEffect; }
AST#method_declaration#Left public getAxisLineDashPathEffect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ...
public getAxisLineDashPathEffect(): DashPathEffect | null { return this.mAxisLineDashPathEffect; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L672-L674
de2f30c8541ad79b961cadc98ced146dbfa473e5
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/collections/set_001_T.ets
arkts
Introduction 集合-集合类型
export function set_001_T(taint_src : Set<string>) { taint.Sink(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function set_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST...
export function set_001_T(taint_src : Set<string>) { taint.Sink(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/set_001_T.ets#L5-L7
d53709b08dd41c586ffb7a1c5f6a92743b1c4d2a
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIWantStartAbility/entry/src/main/ets/pages/Index.ets
arkts
explicitStartAbility
显示启动Ability
async explicitStartAbility() { try { // 在启动Ability时指定了abilityName和bundleName let want = { deviceId: "", bundleName: "com.waylau.hmos.arkuiwantstartability", abilityName: "SecondAbility" }; let context = getContext(this) as context.AbilityContext; await context.s...
AST#method_declaration#Left async explicitStartAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 在启动Ability时指定了abilityName和bundleName AST#statement#Left AST#variable_declaration#Left let AST#variable_declar...
async explicitStartAbility() { try { let want = { deviceId: "", bundleName: "com.waylau.hmos.arkuiwantstartability", abilityName: "SecondAbility" }; let context = getContext(this) as context.AbilityContext; await context.startAbility(want); console.info(`...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIWantStartAbility/entry/src/main/ets/pages/Index.ets#L27-L41
531c645e899ae2740d4a15623b088d652f87b752
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/NetworkUtil.ets
arkts
getNetworkState
获取网络状态 @param slotId 卡槽ID,如果不指定slotId,默认主卡。 @returns
static async getNetworkState(slotId?: number): Promise<radio.NetworkState> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号 return radio.getNetworkState(slotId); }
AST#method_declaration#Left static async getNetworkState AST#parameter_list#Left ( AST#parameter#Left slotId ? : 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#gene...
static async getNetworkState(slotId?: number): Promise<radio.NetworkState> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); return radio.getNetworkState(slotId); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NetworkUtil.ets#L354-L357
6e72f45ab0d6452f990d6c26b4cb3a9ff93bbd82
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
retryRequest
重试请求 @returns {void} 无返回值
retryRequest(): void { this.setLoadingState(); this.executeRequest(); }
AST#method_declaration#Left retryRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#...
retryRequest(): void { this.setLoadingState(); this.executeRequest(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L86-L89
043c816e2d09d20f8af26eba324cd44332c5dc21
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment3.ets
arkts
Only read the value of the variable buttonMsg, without any write operations, just use the general variables directly
build() { Column() { Button(this.buttonMsg) .onClick(() => { this.getUIContext().animateTo({ duration: 50 }, () => { this.translateObj.translateX = (this.translateObj.translateX + 50) % 150; // Reassign value to variable translateObj when clicked. ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#member_expression#Left...
build() { Column() { Button(this.buttonMsg) .onClick(() => { this.getUIContext().animateTo({ duration: 50 }, () => { this.translateObj.translateX = (this.translateObj.translateX + 50) % 150; }) }) } .translate({ x: this.trans...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment3.ets#L32-L46
364d257d15c98897871fe6ad46264b999f447e66
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets
arkts
removeMetaInfo
/ 删除 Meta 信息
public async removeMetaInfo(info: CMetaInfo): Promise<void> { if (!info.fileName) return; const context = getContext(this); const prefs = await preferences.getPreferences(context, this.prefName); // 直接将该 key 对应的值置为 null await prefs.put(info.fileName, null); await prefs.flush(); }
AST#method_declaration#Left public async removeMetaInfo AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
public async removeMetaInfo(info: CMetaInfo): Promise<void> { if (!info.fileName) return; const context = getContext(this); const prefs = await preferences.getPreferences(context, this.prefName); await prefs.put(info.fileName, null); await prefs.flush(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets#L62-L71
e830db8b4396bdee64d28f358562707c9c1b23af
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
getLanguageSettings
获取语言设置 @returns 语言设置
async getLanguageSettings(): Promise<LanguageSettings> { const settings = await this.getSettings(); return settings.language; }
AST#method_declaration#Left async getLanguageSettings 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 LanguageSettings AST#primary_type#Right AST#type_annotation#R...
async getLanguageSettings(): Promise<LanguageSettings> { const settings = await this.getSettings(); return settings.language; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L324-L327
cdfd97f4a5521afb9c2ee3866d4792c7f750a13c
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
saveSettings
保存设置
private async saveSettings(): Promise<void> { try { await StorageUtils.putObject('simple_notification_settings', this.reminderSettings); hilog.info(0x0000, 'SimpleNotificationManager', 'Notification settings saved'); } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to...
AST#method_declaration#Left private async saveSettings 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#...
private async saveSettings(): Promise<void> { try { await StorageUtils.putObject('simple_notification_settings', this.reminderSettings); hilog.info(0x0000, 'SimpleNotificationManager', 'Notification settings saved'); } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L54-L61
f8d75ac4fc0dfef5af81973340cd9794aab16f40
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isWeakSet
Check whether the entered value is of type weakset. @param { Object } value - A WeakSet value @returns { boolean } Returns true if the value is a built-in WeakSet instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isWeakSet(value: Object): boolean;
AST#method_declaration#Left isWeakSet 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#primary_type#Right...
isWeakSet(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1411-L1411
32687a8f2f247629f69d005cd3752ebe39a0bbd0
gitee
MoonlitDropOfBlood/LeakCanary.git
bafc8da61475f8461b123a8d777c39f127875a7b
library/src/main/ets/Analyze.ets
arkts
shareToObject
跨线程对象转成普通对象 @param result @returns
function shareToObject(result: ResultData):NodeRef[] { const nodes:NodeRef[] = [] result.nodeRefs.forEach((ite:NodeRefShare)=>{ const refs:ReferenceChain[] = [] ite.ref.forEach((item=>{ refs.push({ from: { nodeId:item.from.nodeId, name:item.from.name, type:item.fr...
AST#function_declaration#Left function shareToObject AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left ResultData 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_...
function shareToObject(result: ResultData):NodeRef[] { const nodes:NodeRef[] = [] result.nodeRefs.forEach((ite:NodeRefShare)=>{ const refs:ReferenceChain[] = [] ite.ref.forEach((item=>{ refs.push({ from: { nodeId:item.from.nodeId, name:item.from.name, type:item.fr...
https://github.com/MoonlitDropOfBlood/LeakCanary.git/blob/bafc8da61475f8461b123a8d777c39f127875a7b/library/src/main/ets/Analyze.ets#L118-L148
06eedaae347f6e615c06173e6e673234088c63d3
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/main/MainNavigator.ets
arkts
toCart
跳转到购物车页 @param {boolean} [showBackIcon] - 是否显示返回按钮 @returns {void} 无返回值
static toCart(showBackIcon?: boolean): void { if (showBackIcon !== undefined) { const params: MainCartParam = { showBackIcon }; navigateTo(MainRoutes.Cart, params); return; } navigateTo(MainRoutes.Cart); }
AST#method_declaration#Left static toCart AST#parameter_list#Left ( AST#parameter#Left showBackIcon ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
static toCart(showBackIcon?: boolean): void { if (showBackIcon !== undefined) { const params: MainCartParam = { showBackIcon }; navigateTo(MainRoutes.Cart, params); return; } navigateTo(MainRoutes.Cart); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/main/MainNavigator.ets#L39-L46
dbf52c5bcf0c744e63183e32621050b6787eb8f7
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/viewmodel/AboutViewModel.ets
arkts
@file 关于我们页面 ViewModel @author Joker.X
@ObservedV2 export default class AboutViewModel extends BaseViewModel { }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class AboutViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Right AST#...
@ObservedV2 export default class AboutViewModel extends BaseViewModel { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/viewmodel/AboutViewModel.ets#L7-L9
e053ee9db5f37b0fa05c4b5ec4a2c0bfb358c0d2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextUtils.ets
arkts
getShortText
获取收起后的短段落字符串 @param text 长段落字符串 @param fontSize 字符大小 @param maxLines 收起后最大行数 @param textWidth 段落宽度 @param suffix 省略号 @param lastSpan 展开收起按钮 @returns 短段落字符串
public static getShortText(text: string, fontSize: Resource | number | string, maxLines: number, textWidth: string | number | Resource, suffix: string, lastSpan: string): string { const minLinesTextSize: SizeOptions = MeasureText.measureTextSize({ textContent: text, fontSize: fontSize, max...
AST#method_declaration#Left public static getShortText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_t...
public static getShortText(text: string, fontSize: Resource | number | string, maxLines: number, textWidth: string | number | Resource, suffix: string, lastSpan: string): string { const minLinesTextSize: SizeOptions = MeasureText.measureTextSize({ textContent: text, fontSize: fontSize, max...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextUtils.ets#L17-L64
554c8f1ffd4452905bb84d6f4c1ab40caf5bbb90
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/MinuteLineComponent.ets
arkts
drawAveragePriceLine
绘制均价
drawAveragePriceLine() { this.context.strokeStyle = '#e99a4c' this.context.lineWidth = 0.8600009 this.context.beginPath() let itemCount = Math.max(this.stockData.line.length, 240) //按照分时数据量平分两个分时数据之间的间距 let itemDistance = this.minuteRect.width / itemCount let path = new Path2D() this.sto...
AST#method_declaration#Left drawAveragePriceLine 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 AST#member_expression#Left AST#expression#Left this AST#e...
drawAveragePriceLine() { this.context.strokeStyle = '#e99a4c' this.context.lineWidth = 0.8600009 this.context.beginPath() let itemCount = Math.max(this.stockData.line.length, 240) let itemDistance = this.minuteRect.width / itemCount let path = new Path2D() this.stockData.line.forEach((v...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/MinuteLineComponent.ets#L283-L304
802533e8cc3e26866863599164a78c9e00b1358d
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
search
字符集大小 使用 Rabin-Karp 算法在文本中搜索模式串 @param text 要搜索的文本 @param pattern 要查找的模式串 @returns 模式串在文本中的起始位置,如果未找到则返回 -1
public static search(text: string, pattern: string): number { if (!text || !pattern || pattern.length > text.length) { return -1; } const patternHash = RabinKarp.hash(pattern); const patternLength = pattern.length; const textLength = text.length; // 计算文本第一个窗口的哈希值 let textHash = Rabin...
AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
public static search(text: string, pattern: string): number { if (!text || !pattern || pattern.length > text.length) { return -1; } const patternHash = RabinKarp.hash(pattern); const patternLength = pattern.length; const textLength = text.length; let textHash = RabinKarp.hash(text.s...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L15-L50
afa6bbd037f7c198fedab11da4aa0bf41d5c958d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getConfigurationSync
获取设备的Configuration @returns
static getConfigurationSync(): resourceManager.Configuration { return ResUtil.getResourceManager().getConfigurationSync(); }
AST#method_declaration#Left static getConfigurationSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left resourceManager . Configuration AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#s...
static getConfigurationSync(): resourceManager.Configuration { return ResUtil.getResourceManager().getConfigurationSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L513-L515
f23aad263f68884f30aa67494e781c3ecbb39a2d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/AccountLoginPage.ets
arkts
AccountLoginContent
账号登录页面内容视图 @returns {void} 无返回值
@Builder private AccountLoginContent(): void { AnimatedAuthPage({ title: $r("app.string.welcome_login") }) { PhoneInputField({ phone: this.vm.account, onPhoneChange: (value: string): void => { this.vm.updateAccount(value); } }); SpaceVerticalXXLarge(); Sp...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AccountLoginContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left ...
@Builder private AccountLoginContent(): void { AnimatedAuthPage({ title: $r("app.string.welcome_login") }) { PhoneInputField({ phone: this.vm.account, onPhoneChange: (value: string): void => { this.vm.updateAccount(value); } }); SpaceVerticalXXLarge(); Sp...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/AccountLoginPage.ets#L42-L97
7718ca7a0b0c07012dbed7b540e2418011bf1c95
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/Index.ets
arkts
PipWindowViewComponent
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 { PipWindowViewComponent } from './src/main/ets/components/PipWindow';
AST#export_declaration#Left export { PipWindowViewComponent } from './src/main/ets/components/PipWindow' ; AST#export_declaration#Right
export { PipWindowViewComponent } from './src/main/ets/components/PipWindow';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/Index.ets#L16-L16
8d71baffa3c630560c286eaa6177a156ae36914e
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageRestore
迁移启动
onWindowStageRestore(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability Logger.info('[EntryAbility.onWindowStageRestore]', 'Ability onWindowStageRestore'); windowStage.loadContent('pages/Index', (err) => { if (err.code) { Logger.error('[EntryAbi...
AST#method_declaration#Left onWindowStageRestore AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right...
onWindowStageRestore(windowStage: window.WindowStage): void { Logger.info('[EntryAbility.onWindowStageRestore]', 'Ability onWindowStageRestore'); windowStage.loadContent('pages/Index', (err) => { if (err.code) { Logger.error('[EntryAbility.onWindowStageRestore]', 'Failed to load the content....
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/entryability/EntryAbility.ets#L73-L88
55663a3bed89e358a5d9cf3e9427adbbb299078d
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets
arkts
应用约束:18. 类字段在类中声明
constructor() { throw new Error(`The ${this.constructor.name} class may not be instantiated.`); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#n...
constructor() { throw new Error(`The ${this.constructor.name} class may not be instantiated.`); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets#L20-L22
32004a72d38a01f8f7ff238f927c3966593f4a92
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/CommonAttribute.ets
arkts
@file 通用属性扩展 @author Joker.X 快速设置宽高相同的 size @param {Length} value - 宽高尺寸 @returns {AttributeModifier<CommonAttribute>} 通用属性修饰器 @example Column() { Text("Hi"); }.attributeModifier(size(24));
export function size(value: Length): AttributeModifier<CommonAttribute> { return { applyNormalAttribute: (instance: CommonAttribute): void => { instance.size({ width: value, height: value }); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function size AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary...
export function size(value: Length): AttributeModifier<CommonAttribute> { return { applyNormalAttribute: (instance: CommonAttribute): void => { instance.size({ width: value, height: value }); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/CommonAttribute.ets#L13-L19
dad87ec2b812672742b907bfb83563d6d73a78f0
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
getNumber
/ 取 number
public static getNumber(key: string): number { let value = JhAESPreferencesUtils.getString(key) value = (value == '' || value == null) ? '0' : value return Number(value) }
AST#method_declaration#Left public static getNumber 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 number AST#primary...
public static getNumber(key: string): number { let value = JhAESPreferencesUtils.getString(key) value = (value == '' || value == null) ? '0' : value return Number(value) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L44-L48
fe264cf597ee40ca2ae64b3102cd021088f50ada
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets
arkts
getJSSdkVersionDevDir
jssdk某个版本路径 jssdk/version/main
public getJSSdkVersionDevDir(version: string) { return this.getJSSdkDir() + '/' + version + '/main'; }
AST#method_declaration#Left public getJSSdkVersionDevDir AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_s...
public getJSSdkVersionDevDir(version: string) { return this.getJSSdkDir() + '/' + version + '/main'; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L95-L97
26b02d03398c4a74eb3e6915357ff8d0ba0eeae4
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets
arkts
购物车商品规格
export interface CartSpec { id: number; specName: string; price: number; count: number; stock: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CartSpec 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 specName : AST#type_annotation#Left AS...
export interface CartSpec { id: number; specName: string; price: number; count: number; stock: number; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L78-L84
d060b1d8d51992f3ee8cbf5f7f4a507ce3ec0809
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isLeapYear
判断是否为闰年 @param year 年份 @returns 是否为闰年
static isLeapYear(year: number): boolean { return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0); }
AST#method_declaration#Left static isLeapYear AST#parameter_list#Left ( AST#parameter#Left year : 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 boolean AST#primary_typ...
static isLeapYear(year: number): boolean { return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L139-L141
589dfc05350798ff9a6d326a395b3c750914530c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FuzzySceneOptimization/entry/src/main/ets/pages/StaticBlur.ets
arkts
aboutToAppear
bottom navigation bar height
aboutToAppear(): void { window.getLastWindow(this.getUIContext().getHostContext()!, (err, windowBar) => { if (err.code) { return; } try { // get the height of the bottom navigation bar this.bottomSafeHeight = this.getUIContext() .px2vp(windowBar.getWin...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { window.getLastWindow(this.getUIContext().getHostContext()!, (err, windowBar) => { if (err.code) { return; } try { this.bottomSafeHeight = this.getUIContext() .px2vp(windowBar.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGAT...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FuzzySceneOptimization/entry/src/main/ets/pages/StaticBlur.ets#L31-L50
34c12d7dbc49a2bb49c15d4452adf3e09b1f4cf1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
数据加密相关
export interface EncryptionConfig { algorithm: EncryptionAlgorithm; keyDerivation: KeyDerivationMethod; iterations?: number; salt?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface EncryptionConfig AST#object_type#Left { AST#type_member#Left algorithm : AST#type_annotation#Left AST#primary_type#Left EncryptionAlgorithm AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left keyDerivat...
export interface EncryptionConfig { algorithm: EncryptionAlgorithm; keyDerivation: KeyDerivationMethod; iterations?: number; salt?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L329-L334
ad5b01f7f3b733a363cd1429a2e148686f756c85
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
祝福语统计
export interface GreetingStats { totalGenerated: number; totalUsed: number; averageRating: number; popularStyles: GreetingStyleStat[]; popularOccasions: GreetingOccasionStat[]; recentActivity: UsageTrend[]; topRatedGreetings: Greeting[]; mostUsedGreetings: Greeting[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingStats AST#object_type#Left { AST#type_member#Left totalGenerated : 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 totalUsed : AST#type_...
export interface GreetingStats { totalGenerated: number; totalUsed: number; averageRating: number; popularStyles: GreetingStyleStat[]; popularOccasions: GreetingOccasionStat[]; recentActivity: UsageTrend[]; topRatedGreetings: Greeting[]; mostUsedGreetings: Greeting[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L157-L166
e76a862558fb001016d1f2ca2be76776b9f15221
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/StudyTimeManager.ets
arkts
getCurrentSessionTime
获取当前会话的学习时长(分钟)
getCurrentSessionTime(): number { if (!this.isTracking || this.startTime === 0) { return 0 } const currentTime = Date.now() return Math.floor((currentTime - this.startTime) / 1000 / 60) }
AST#method_declaration#Left getCurrentSessionTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expressi...
getCurrentSessionTime(): number { if (!this.isTracking || this.startTime === 0) { return 0 } const currentTime = Date.now() return Math.floor((currentTime - this.startTime) / 1000 / 60) }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/StudyTimeManager.ets#L97-L104
073b0851ffb2a7280135464f2aba16891805ee2a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
arkts
encodePKCS1
加密 @param encodeStr 待加密的字符串 @param pubKey RSA公钥
static async encodePKCS1(str: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024); }
AST#method_declaration#Left static async encodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static async encodePKCS1(str: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L51-L53
6cecb2c9905922fc3c42f65bccf7332cd03ffe0d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample4/Sample4.ets
arkts
correctConcurrentFunc
[Start sample_4] Sample4.ets
@Concurrent function correctConcurrentFunc() { let count: number = 0; let id = setInterval(() => { count++; if (count == 10) { hilog.info(0xFF00, 'sampleTag', "the value has reached the threshold"); clearInterval(id); } }, 1000); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function correctConcurrentFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count : AST#type_annotation#Left AS...
@Concurrent function correctConcurrentFunc() { let count: number = 0; let id = setInterval(() => { count++; if (count == 10) { hilog.info(0xFF00, 'sampleTag', "the value has reached the threshold"); clearInterval(id); } }, 1000); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample4/Sample4.ets#L22-L32
bc2f7057431c88ed7ab6bd3e2972765ce8de8865
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
getNumber
获取数字值 @param key 键 @param defaultValue 默认值 @returns 数字值
async getNumber(key: string, defaultValue: number = 0): Promise<number> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as number; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to...
AST#method_declaration#Left async getNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
async getNumber(key: string, defaultValue: number = 0): Promise<number> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as number; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L116-L125
d0490893d2ea9d696639d03c926acb4300ef5887
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhEncryptUtils.ets
arkts
aesDecrypt
/ 字符串AES解密
public static aesDecrypt(dataStr: string) { const encryptedStr: CryptoJS.lib.WordArray = CryptoJS.enc.Base64.parse(dataStr) const str: string = CryptoJS.enc.Base64.stringify(encryptedStr) const decrypt: CryptoJS.lib.WordArray = CryptoJS.AES.decrypt(str, SECRET_KEY, { iv: SECRET_IV, mode: CryptoJ...
AST#method_declaration#Left public static aesDecrypt AST#parameter_list#Left ( AST#parameter#Left dataStr : 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#variable_dec...
public static aesDecrypt(dataStr: string) { const encryptedStr: CryptoJS.lib.WordArray = CryptoJS.enc.Base64.parse(dataStr) const str: string = CryptoJS.enc.Base64.stringify(encryptedStr) const decrypt: CryptoJS.lib.WordArray = CryptoJS.AES.decrypt(str, SECRET_KEY, { iv: SECRET_IV, mode: CryptoJ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhEncryptUtils.ets#L44-L54
92ca6ad68c4cca4c9a422ca641afdc493055e34a
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
Get
Called when data is obtained. @since 7 @deprecated since 10
static Get<T>(propName: string): T | undefined { return AppStorage.get<T>(propName) }
AST#method_declaration#Left static Get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
static Get<T>(propName: string): T | undefined { return AppStorage.get<T>(propName) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L133-L135
1bf2e9aed57e026a43552e4c3e55a02bb38c160f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/common/constants/StyleConstants.ets
arkts
Style constants for all features.
export default class StyleConstants { /** * The head aspect ratio. */ static readonly HEAD_ASPECT_RATIO: number = 1; /** * Weight to fill. */ static readonly WEIGHT_FULL: number = 1; /** * Minimum height of two lines of text. */ static readonly DOUBLE_ROW_MIN: number = 28; /** * Un...
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /** * The head aspect ratio. */ AST#property_declaration#Left static readonly HEAD_ASPECT_RATIO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ...
export default class StyleConstants { static readonly HEAD_ASPECT_RATIO: number = 1; static readonly WEIGHT_FULL: number = 1; static readonly DOUBLE_ROW_MIN: number = 28; static readonly UNIT_FP: string = 'fp'; static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/common/constants/StyleConstants.ets#L19-L134
4f013ca93b8d7732cf9f07dbbbce5f07fa7b95db
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/BruteForce.ets
arkts
暴力字符串搜索算法实现 通过逐个比较字符来查找模式串在文本中的位置
export class BruteForce { /** * 在文本中查找模式串的所有出现位置 * @param text 文本字符串 * @param pattern 模式串 * @returns 所有匹配位置的数组 */ static findAllMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const n ...
AST#export_declaration#Left export AST#class_declaration#Left class BruteForce AST#class_body#Left { /** * 在文本中查找模式串的所有出现位置 * @param text 文本字符串 * @param pattern 模式串 * @returns 所有匹配位置的数组 */ AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annot...
export class BruteForce { static findAllMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const n = text.length; const m = pattern.length; for (let i = 0; i <= n - m; i++) { let j = 0; ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BruteForce.ets#L5-L167
5397ebef3e6a96c4f7e52c95b693e1cce9469f77
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/TaskBoardPage.ets
arkts
onTaskUpdate
任务更新时刷新列表
onTaskUpdate() { this.tasks = AppState.tasks.slice(); // 创建新数组触发更新 }
AST#method_declaration#Left onTaskUpdate 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 . tasks AST#member_expression#Right = A...
onTaskUpdate() { this.tasks = AppState.tasks.slice(); }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TaskBoardPage.ets#L16-L18
7ecaa2680ebfdb972b136f42112ff960042fd43a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets
arkts
totalCount
获取数组长度
public totalCount(): number { return this.articleData.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.articleData.length; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets#L72-L74
63da7d2fc48881eeb5b52f241f0e3b802a9ed6c3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/model/FormDate.ets
arkts
formDay
换算当前星期几
formDay(): string { let day = new Date().getDay(); if (day === 1) { return '星期一'; } else if (day === 2) { return '星期二'; } else if (day === 3) { return '星期三'; } else if (day === 4) { return '星期四'; } else if (day === 5) { return '星期五'; } else if (day === 6) { ...
AST#method_declaration#Left formDay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left day = AST#express...
formDay(): string { let day = new Date().getDay(); if (day === 1) { return '星期一'; } else if (day === 2) { return '星期二'; } else if (day === 3) { return '星期三'; } else if (day === 4) { return '星期四'; } else if (day === 5) { return '星期五'; } else if (day === 6) { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/FormDate.ets#L30-L48
7909377c79ddb97af8fe7aec3b335d4eacf8da2b
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/search.ets
arkts
aboutToAppear
**************************************** build *********************************************//
aboutToAppear(): void { this.getRcommandContent() }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.getRcommandContent() }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L244-L246
05121071019d654a90be99cbf3e8366ef5d1e496
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerCtrlComp.ets
arkts
ctrlBtnBuilder
播放器控制按钮
@Builder ctrlBtnBuilder($$: CtrlBtnBuilderParam) { Button({ type: ButtonType.Circle, stateEffect: true, buttonStyle: ButtonStyleMode.TEXTUAL }) { Image($$.imgSrc) .width($$.btnSize) .height($$.btnSize) .fillColor(Color.White) .flexShrink(CommonConstants.MUSIC_CTRL_BTN_FLEX_SH...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ctrlBtnBuilder AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left CtrlBtnBuilderParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fun...
@Builder ctrlBtnBuilder($$: CtrlBtnBuilderParam) { Button({ type: ButtonType.Circle, stateEffect: true, buttonStyle: ButtonStyleMode.TEXTUAL }) { Image($$.imgSrc) .width($$.btnSize) .height($$.btnSize) .fillColor(Color.White) .flexShrink(CommonConstants.MUSIC_CTRL_BTN_FLEX_SH...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerCtrlComp.ets#L59-L73
875a3f87a92076b45ff5538b4eecb9a4933ea55b
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/SettingsService.ets
arkts
loadSettings
加载设置
private async loadSettings(): Promise<void> { if (!this.preferences) return; try { // 加载主题设置 const theme = await this.preferences.get(Constants.PREF_THEME, ThemeMode.AUTO); this.settings.themeMode = theme as ThemeMode; // 加载播放速度 const speed = await this.preferences.get(Constants....
AST#method_declaration#Left private async loadSettings 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#...
private async loadSettings(): Promise<void> { if (!this.preferences) return; try { const theme = await this.preferences.get(Constants.PREF_THEME, ThemeMode.AUTO); this.settings.themeMode = theme as ThemeMode; const speed = await this.preferences.get(Constants.PREF_PLAYBACK_SPEE...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L42-L82
8ed4311dc8b6d5a8dd4451e250e93b3a5ce64fda
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/AccessControl/entry/src/main/ets/pages/UserIdentityAuthentication.ets
arkts
userIAMAuthFinger
调用UserIAM拉起认证,触发HUKS的访问控制流程
function userIAMAuthFinger(huksChallenge: Uint8Array) { // 获取认证对象。 let authTypeList: userAuth.UserAuthType[] = [authType]; const authParam: userAuth.AuthParam = { challenge: huksChallenge, authType: authTypeList, authTrustLevel: authTrustLevel }; const widgetParam: userAuth.WidgetParam = { tit...
AST#function_declaration#Left function userIAMAuthFinger AST#parameter_list#Left ( AST#parameter#Left huksChallenge : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取认证对象。 AST#statem...
function userIAMAuthFinger(huksChallenge: Uint8Array) { let authTypeList: userAuth.UserAuthType[] = [authType]; const authParam: userAuth.AuthParam = { challenge: huksChallenge, authType: authTypeList, authTrustLevel: authTrustLevel }; const widgetParam: userAuth.WidgetParam = { title: 'PIN',...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/AccessControl/entry/src/main/ets/pages/UserIdentityAuthentication.ets#L197-L238
97157911876ef175703a901453f6c5b2ce0c8f9c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setSpaceBottom
Sets the bottom axis space in percent of the full range. Default 10f @param percent
public setSpaceBottom(percent: number): void { this.mSpacePercentBottom = percent; }
AST#method_declaration#Left public setSpaceBottom AST#parameter_list#Left ( AST#parameter#Left percent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
public setSpaceBottom(percent: number): void { this.mSpacePercentBottom = percent; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L353-L355
f30080cbcc84204135e6c3541eac55f22fd1b9cd
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
检查结果接口
export interface CheckResult { success: boolean; message?: string; errorCode?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CheckResult AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left message ? : AST#type_annotati...
export interface CheckResult { success: boolean; message?: string; errorCode?: number; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L5-L9
21655dd23c2c5fdc9dddd826ba5f77b3b7c5925a
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/static_function/static_function_001_T.ets
arkts
Introduction 静态函数
export function static_function_001_T(taint_src : string) { A.f(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function static_function_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function static_function_001_T(taint_src : string) { A.f(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/static_function/static_function_001_T.ets#L5-L8
d1639b9edca8a621c2a4d711db4cc48e5422bc46
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getRelativeTime
获取友好的时间显示 @param date 日期 @returns 友好的时间字符串(如:今天、昨天、3天前等)
static getRelativeTime(date: Date): string { const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); const diffHours = Math.floor(diffMs / (1000 * 60 * 60)); const diffMinutes = Math.floor(diffMs / (1000 * 60)); if (dif...
AST#method_declaration#Left static getRelativeTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static getRelativeTime(date: Date): string { const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); const diffHours = Math.floor(diffMs / (1000 * 60 * 60)); const diffMinutes = Math.floor(diffMs / (1000 * 60)); if (dif...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L100-L120
d1f5f33a03778fafb8c1a976c43b0803bc176bc3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
deletePreferences
Deletes the specified Preferences persistence file from memory and removes the Preferences instance.
async deletePreferences() { try { await dataPreferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME); } catch(err) { Logger.error(CommonConstants.TAG, `Failed to delete preferences, Cause: ${err}`); }; preference = preferenceTemp; this.showToastMessage($r('app.string.dele...
AST#method_declaration#Left async deletePreferences 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A...
async deletePreferences() { try { await dataPreferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME); } catch(err) { Logger.error(CommonConstants.TAG, `Failed to delete preferences, Cause: ${err}`); }; preference = preferenceTemp; this.showToastMessage($r('app.string.dele...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L48-L56
818a540b6113cfffcc28dba5096233ff49ab1ce8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinH.ets
arkts
SpinH
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinH { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 1; @Local scale2: number = 1; @Local scale3: number = 1; @Local scale4: number = 1; @Local scale5: number = 1; @Local scale6: number = 1; @Local scale7: number = 1; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinH 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 SpinH { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 1; @Local scale2: number = 1; @Local scale3: number = 1; @Local scale4: number = 1; @Local scale5: number = 1; @Local scale6: number = 1; @Local scale7: number = 1; ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinH.ets#L22-L218
250f913f94f0d96fac3dfda3161429e735998e25
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
buildOtherSettingsCard
构建其他设置卡片
@Builder buildOtherSettingsCard() { Column({ space: 16 }) { // 卡片标题 Row() { Text('⚙️') .fontSize(20) Text('其他设置') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') } .width('100%') .padding({ top: 4, bottom: 4 }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildOtherSettingsCard 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#compon...
@Builder buildOtherSettingsCard() { Column({ space: 16 }) { Row() { Text('⚙️') .fontSize(20) Text('其他设置') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') } .width('100%') .padding({ top: 4, bottom: 4 }) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L923-L973
b917bfa5ed2b6bbd16aa9a937c31d1380e438405
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdUtil.ets
arkts
simpleUUID
简化的UUID,去掉了横线
static simpleUUID(): string { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, (c) => { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }
AST#method_declaration#Left static simpleUUID 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#call_expressi...
static simpleUUID(): string { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, (c) => { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdUtil.ets#L28-L34
ff6a46c270400035b69186693e578e4ab6697dd0
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
registerDataChangeListener
Register the controller who changes the data
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L79-L83
31cbb7c5612823177d8ba4c2d0e67edc9cb3c5c5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/MD5.ets
arkts
digestSegmentSync
MD5摘要,分段,同步 @param data 待摘要的数据 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'MD5', resultCoding, len); }
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#quali...
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'MD5', resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/MD5.ets#L70-L72
f9bb92f020cc17ef06edc0a417e72088bfff9fd5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the external product series represented by a string. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get marketName(): string;
AST#method_declaration#Left static get AST#ERROR#Left marketName AST#ERROR#Right 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#method_declaration#Right
static get marketName(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L76-L76
e0fa19c7cc04878a619df906976b6a4b27803948
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets
arkts
ImageText
自定义封装图文组件
@Component export struct ImageText { @State item: string | Resource = $r('app.string.dynamicattributes_text'); @State textOneContent: string | Resource = $r('app.string.dynamicattributes_text'); @State textTwoContent: string | Resource = $r('app.string.dynamicattributes_text'); @State textThreeContent: string |...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right item : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right ...
@Component export struct ImageText { @State item: string | Resource = $r('app.string.dynamicattributes_text'); @State textOneContent: string | Resource = $r('app.string.dynamicattributes_text'); @State textTwoContent: string | Resource = $r('app.string.dynamicattributes_text'); @State textThreeContent: string |...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L77-L123
6a9219159ffb2b4efe27f1110b7ea5eaaa9dcf52
gitee
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/components/MusicPlayerBar.ets
arkts
formatTime
格式化时间
private formatTime(ms: number): string { const totalSeconds = Math.floor(ms / 1000); const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
AST#method_declaration#Left private formatTime AST#parameter_list#Left ( AST#parameter#Left ms : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
private formatTime(ms: number): string { const totalSeconds = Math.floor(ms / 1000); const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/MusicPlayerBar.ets#L68-L73
fc826646b1f1fc9416eeeca341eec810e6c1bab5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderCommentPage.ets
arkts
PageContent
页面内容 @returns {void} 无返回值
@Builder private PageContent(): void { ColumnStart({ fillMaxSize: true }) { Column() { LargePaddingVerticalScroll({ fillMaxSize: true }) { Column() { SpaceVerticalXXLarge(); this.RateSection(); SpaceVerticalLarge(); this.CommentFieldCard()...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private PageContent(): void { ColumnStart({ fillMaxSize: true }) { Column() { LargePaddingVerticalScroll({ fillMaxSize: true }) { Column() { SpaceVerticalXXLarge(); this.RateSection(); SpaceVerticalLarge(); this.CommentFieldCard()...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L64-L95
3a3c5307908affa20acf61a444832cd55efdbeed
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/GuideBuilderProxy.ets
arkts
onAction
操作事件 (action:点击高亮=0;点击自定义内容builder=1) @param action @returns
onAction(action: ActionCallback) { this.builderOptions.onAction = action return this; }
AST#method_declaration#Left onAction AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left ActionCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#...
onAction(action: ActionCallback) { this.builderOptions.onAction = action return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/GuideBuilderProxy.ets#L44-L47
4478ad62a11c9b5e0048f204b5b6a1e90d33093e
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_current_sub_url
Gets the current url of the sub tab. @returns The url.
get_current_sub_url() { return this.Tabs[this.sub_tab_idx].url; }
AST#method_declaration#Left get_current_sub_url AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#L...
get_current_sub_url() { return this.Tabs[this.sub_tab_idx].url; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L235-L237
b003062084809048e3e2d91827d558ab3630722e
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/BgCardShape.ets
arkts
BgCardShape
创建卡片背景形状
@ComponentV2 export struct BgCardShape { // @Local settings: UserSettings = PersistenceV2.connect(UserSettings, GlobalKey.kUserSettings)! build() { // if (this.settings.isListOneCircle) { // // 圆形卡片 // Circle() // .width('100%') // .height('100%') // .fill(Color.White) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct BgCardShape AST#component_body#Left { // @Local settings: UserSettings = PersistenceV2.connect(UserSettings, GlobalKey.kUserSettings)! AST#build_method#Left build ( ) AST#build_body#Left { // if (this.settings.isLis...
@ComponentV2 export struct BgCardShape { build() { Stack(){ Rect() .width('100%') .height('100%') .fill(Color.White) .borderRadius(16) .radius(16) .shadow({ radius: ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/BgCardShape.ets#L4-L54
89274959be41f9bb886f75e0d11164062f2fd88e
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isThisWeek
判断是否为本周 @param date 要判断的日期 @returns 是否为本周
static isThisWeek(date: Date): boolean { const weekStart = DateUtils.getWeekStart(); const weekEnd = new Date(weekStart); weekEnd.setDate(weekStart.getDate() + 6); return date >= weekStart && date <= weekEnd; }
AST#method_declaration#Left static isThisWeek AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#...
static isThisWeek(date: Date): boolean { const weekStart = DateUtils.getWeekStart(); const weekEnd = new Date(weekStart); weekEnd.setDate(weekStart.getDate() + 6); return date >= weekStart && date <= weekEnd; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L87-L93
c5ecaf3cdac30973ff1dc9d67a0a7ea445c58cda
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
时间轴控制器
export class AxisRenderController extends NodeController { private rootNode: FrameNode | null = null; private axisNode: AxisRender; constructor(width: number = 2000, height: number = 2000) { super(); this.axisNode = new AxisRender(); this.axisNode.frame = { x: 0, ...
AST#export_declaration#Left export AST#class_declaration#Left class AxisRenderController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#L...
export class AxisRenderController extends NodeController { private rootNode: FrameNode | null = null; private axisNode: AxisRender; constructor(width: number = 2000, height: number = 2000) { super(); this.axisNode = new AxisRender(); this.axisNode.frame = { x: 0, ...
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L482-L513
e25b81130bd271cb4a4970a0ce6609fd596bdbd4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SettingsPage aboutToAppear'); this.loadSettings(); }
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, 'SettingsPage aboutToAppear'); this.loadSettings(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L52-L55
cabad8eeef6e877bdee79d0286ed4a90c0e46e18
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
表现评级枚举
export enum PerformanceRating { S = 'S', // 完美 A = 'A', // 优秀 B = 'B', // 良好 C = 'C', // 一般 D = 'D' // 较差 }
AST#export_declaration#Left export AST#enum_declaration#Left enum PerformanceRating AST#enum_body#Left { AST#enum_member#Left S = AST#expression#Left 'S' AST#expression#Right AST#enum_member#Right , // 完美 AST#enum_member#Left A = AST#expression#Left 'A' AST#expression#Right AST#enum_member#Right , // 优秀 AST#enum_member...
export enum PerformanceRating { S = 'S', A = 'A', B = 'B', C = 'C', D = 'D' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L111-L117
d4bbc76d807529899a6f897a34264a21a32938e6
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FileUtil.ets
arkts
getTempDirPath
获取临时目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir; //根目录 if (StrUtil.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。 filePath = ...
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annot...
static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir; if (StrUtil.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { filePath = dirPath; } else ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L89-L105
590b479adcf6ab9a19c3fe0b9ee04aa8fd51badc
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
Data Change Listener. @interface DataChangeListener @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export interface DataChangeListener { /** * Data ready. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ onDataReloaded(): void /** * Data added. * * @param { number } index * @syscap SystemCapability.ArkUI....
AST#export_declaration#Left export AST#interface_declaration#Left interface DataChangeListener AST#object_type#Left { /** * Data ready. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ AST#type_member#Left onDataReloaded AST#parameter_list...
export interface DataChangeListener { onDataReloaded(): void onDataAdded(index: number): void onDataAdd(index: number): void onDataMoved(from: number, to: number): void onDataMove(from: number, to: number): void onDataDeleted(index: number): void onDataDele...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L457-L559
ae31390cc38064712f26b9d31fba45e7546ceef1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showTipsDialog
显示提示弹出框,即为带图形确认框 @param options
static showTipsDialog(options: TipsOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initPrimarySecondaryButton(options); ActionParameter.initImageResSize(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(w...
AST#method_declaration#Left static showTipsDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TipsOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
static showTipsDialog(options: TipsOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initPrimarySecondaryButton(options); ActionParameter.initImageResSize(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(w...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L165-L172
9ff144dc93509d9164d0d63044742c9273b14656
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/product/default/src/main/ets/defaultability/DefaultAbility.ets
arkts
updateBreakpoint
变更设备类型
private updateBreakpoint(windowWidth: number) :void{ let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; let curBp: string = ''; if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[2]) { curBp = BreakpointConstants.BREAKPOINT_SM; } else if (windowWidthVp < Breakpo...
AST#method_declaration#Left private updateBreakpoint AST#parameter_list#Left ( AST#parameter#Left windowWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#...
private updateBreakpoint(windowWidth: number) :void{ let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; let curBp: string = ''; if (windowWidthVp < BreakpointConstants.BREAKPOINT_SCOPE[2]) { curBp = BreakpointConstants.BREAKPOINT_SM; } else if (windowWidthVp < Breakpo...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/product/default/src/main/ets/defaultability/DefaultAbility.ets#L46-L57
6e5d277e39ae63e013b66fdebc34ad83d65814b8
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets
arkts
dispatchPointerMoveEvent
分发move事件的手势信息 @return {boolean|null} true表示向下翻页,false是向上翻页,null表示无操作
dispatchPointerMoveEvent( pointerEvent: GestureEvent): boolean | null { let currentTouch = new TouchEvent(vp2px(pointerEvent.fingerList[0].localX), vp2px(pointerEvent.fingerList[0].localY), pointerEvent.velocityX, pointerEvent.velocityY, pointerEvent.velocity); this.lastTouch = new TouchEvent...
AST#method_declaration#Left dispatchPointerMoveEvent AST#parameter_list#Left ( AST#parameter#Left pointerEvent : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#...
dispatchPointerMoveEvent( pointerEvent: GestureEvent): boolean | null { let currentTouch = new TouchEvent(vp2px(pointerEvent.fingerList[0].localX), vp2px(pointerEvent.fingerList[0].localY), pointerEvent.velocityX, pointerEvent.velocityY, pointerEvent.velocity); this.lastTouch = new TouchEvent...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets#L255-L313
b72295b68cee8890f711939b3769714cd3e115b6
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/WatchGiftBuilder.ets
arkts
WinnerItem
中奖名单
@Builder WinnerItem(item: VHWatchGiftWinner) { // 半模态的内容 Column({ space: 5 }){ Row({ space: 5 }) { Image(item.winner_avatar.length > 0 ? item.winner_avatar : $r('app.media.icon_avatar')).width(20).height(20).borderRadius(10) Text(FormatUtil.getTruncateText(item.winner_nickname,5)).fontCo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right WinnerItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftWinner AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_functio...
@Builder WinnerItem(item: VHWatchGiftWinner) { Column({ space: 5 }){ Row({ space: 5 }) { Image(item.winner_avatar.length > 0 ? item.winner_avatar : $r('app.media.icon_avatar')).width(20).height(20).borderRadius(10) Text(FormatUtil.getTruncateText(item.winner_nickname,5)).fontColor(Color...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/WatchGiftBuilder.ets#L281-L305
a7e6d54d8ad507e052e09b306f0d829801aa9901
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets
arkts
range
选择数据集合 @param range @returns
range(range: string[] | string[][] | TextPickerRangeContent[] | TextCascadePickerRangeContent[]) { this.builderOptions.range = range return this }
AST#method_declaration#Left range AST#parameter_list#Left ( AST#parameter#Left range : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary...
range(range: string[] | string[][] | TextPickerRangeContent[] | TextCascadePickerRangeContent[]) { this.builderOptions.range = range return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L19-L22
4976ca48fc5b2e79e71877c0f48df381eaf2a6dc
github
xixi-cquer/BiJiDaiBan.git
206dc33a837acbe6fc837feff848427e83946534
entry/src/main/ets/common/constants/Constants.ets
arkts
The request method enum.
export const enum RequestMethod { POST = 'POST', GET = 'GET' }
AST#export_declaration#Left export AST#enum_declaration#Left const enum RequestMethod AST#enum_body#Left { AST#enum_member#Left POST = AST#expression#Left 'POST' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left GET = AST#expression#Left 'GET' AST#expression#Right AST#enum_member#Right } AST#enum_body#R...
export const enum RequestMethod { POST = 'POST', GET = 'GET' }
https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/common/constants/Constants.ets#L196-L199
10cb970bad172a97a4fcbf31b3c32111feb609cd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CDBSound.ets
arkts
定义常量
export const lang_en_us: string = "en_us";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left lang_en_us : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "en_us" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat...
export const lang_en_us: string = "en_us";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CDBSound.ets#L2-L2
62d291d6a5ebdac5192e442b9f29c9b347c2f221
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets
arkts
IDataSource处理数据监听的基本实现
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; // 获取数组长度 public abstract totalCount(): number; // 获取指定索引数据 public getData(index: number): void { console.info('getData, index:' + index); } // 为LazyForEach组件向其数据源处添加listener监听 registerDat...
AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChange...
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; public abstract totalCount(): number; public getData(index: number): void { console.info('getData, index:' + index); } registerDataChangeListener(listener: DataChangeListener): void { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L20-L73
a66d970e4929f61b66835ab4f4fe9e2d708e432c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
importFromSystemContacts
从系统通讯录导入联系人
async importFromSystemContacts(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting system contacts import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOpera...
AST#method_declaration#Left async importFromSystemContacts AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
async importFromSystemContacts(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting system contacts import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOpera...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L100-L141
6e987a1fcda512954fd2db761671282695df5547
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
非对称密钥对象
export class CryptoKey { /** * 公钥 */ publicKey: string; /** * 私钥 */ privateKey: string; constructor(pubKey: string, priKey: string) { this.publicKey = pubKey; this.privateKey = priKey; } }
AST#export_declaration#Left export AST#class_declaration#Left class CryptoKey AST#class_body#Left { /** * 公钥 */ AST#property_declaration#Left publicKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 私钥 */ AST#pr...
export class CryptoKey { publicKey: string; privateKey: string; constructor(pubKey: string, priKey: string) { this.publicKey = pubKey; this.privateKey = priKey; } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L422-L436
0e5038efcb43f178ec29ef366b92cc46332e48cf
gitee
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/model/addressBookTopBar.ets
arkts
好友列表中单个好友的数据接口
export interface IaddressBookTopBarItem{ icon:Resource, title:string, bgColor:string }
AST#export_declaration#Left export AST#interface_declaration#Left interface IaddressBookTopBarItem AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left title : AST#type_ann...
export interface IaddressBookTopBarItem{ icon:Resource, title:string, bgColor:string }
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/model/addressBookTopBar.ets#L2-L6
2cb451c5be149cb4636ee815c6c14a89f89686cc
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/MPPointF.ets
arkts
getX
Set the point's coordinates from the data stored in the specified parcel. To write a point to a parcel, call writeToParcel(). @param in The parcel to read the point's coordinates from public void my_readFromParcel(Parcel in) { x = in.readFloat(); y = in.readFloat(); }
public getX(): number { return this.x; }
AST#method_declaration#Left public getX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
public getX(): number { return this.x; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MPPointF.ets#L109-L111
2d64956994a36861da2afc46c2c2f35fc13ccdf2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/Helper.ets
arkts
getResourceStr
获取按钮的字符串 @param resource @returns
static getResourceStr(resource: ResourceStr | ButtonOptions | SheetInfo): string | null { try { if (typeof resource === 'string') { return resource; } else { return Helper.getString(resource as Resource); } } catch (e) { return null } }
AST#method_declaration#Left static getResourceStr AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left ButtonOptions AST#primary_type#Right | AST#primary_type#Left SheetInfo AST#primary_type#...
static getResourceStr(resource: ResourceStr | ButtonOptions | SheetInfo): string | null { try { if (typeof resource === 'string') { return resource; } else { return Helper.getString(resource as Resource); } } catch (e) { return null } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L133-L143
541162a4161e26dee66e1271f1b392cc4cb2da4c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction.ets
arkts
DialogInteraction
[End custom_dialog_build_button] [Start dialog_constructor_accept]
@Entry @Component export struct DialogInteraction { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({ cancel: () => { this.onCancel(); }, confirm: () => { this.onAccept(); }, }), }) onCancel() { console.info(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DialogInteraction AST#component_body#Left { AST#property_declaration#Left dialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#pri...
@Entry @Component export struct DialogInteraction { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({ cancel: () => { this.onCancel(); }, confirm: () => { this.onAccept(); }, }), }) onCancel() { console.info(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/DialogInteraction.ets#L69-L85
609f37e4ef3ba7464d2ea8d7a5bed59a88649415
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/WorldClock/ClockArea.ets
arkts
drawPointer
绘制时针、分针、秒针
private drawPointer(degree: number, pointerImgRes: string) { this.renderContext.save(); let theta = (degree + AlarmClockConstants.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / AlarmClockConstants.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ...
AST#method_declaration#Left private drawPointer AST#parameter_list#Left ( AST#parameter#Left degree : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pointerImgRes : AST#type_annotation#Left AST#primary_type#Left string AST#...
private drawPointer(degree: number, pointerImgRes: string) { this.renderContext.save(); let theta = (degree + AlarmClockConstants.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / AlarmClockConstants.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/WorldClock/ClockArea.ets#L66-L80
6ebac27e18bed26ff34aecad4096f10c8532f101
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ZipTool.ets
arkts
compressDir
压缩指定目录 @param sourceDir 源目录路径(沙箱路径) @param destZip 目标ZIP文件路径(沙箱路径) @param options 压缩选项(可选) @returns Promise<boolean> 操作是否成功
static async compressDir( sourceDir: string, destZip: string, options?: zlib.Options ): Promise<boolean> { try { // 1. 验证源目录是否存在 if (!fs.accessSync(sourceDir)) { //throw new Error(`Source directory not found: ${sourceDir}`); DebugLog.e(`Source directory not found: ${sourceD...
AST#method_declaration#Left static async compressDir AST#parameter_list#Left ( AST#parameter#Left sourceDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left destZip : AST#type_annotation#Left AST#primary_type#Left string AS...
static async compressDir( sourceDir: string, destZip: string, options?: zlib.Options ): Promise<boolean> { try { if (!fs.accessSync(sourceDir)) { DebugLog.e(`Source directory not found: ${sourceDir}`) return false } const srcFolderName = PathUtilit...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ZipTool.ets#L52-L94
c124c0a2f6fd967101ece20e8ef08b2e6488866b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
openFeedback
打开用户反馈
private openFeedback(): void { promptAction.showToast({ message: '正在打开反馈页面...', duration: 1500 }); }
AST#method_declaration#Left private openFeedback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp...
private openFeedback(): void { promptAction.showToast({ message: '正在打开反馈页面...', duration: 1500 }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6227-L6232
8e25999c2fbca9f943251e9f7fb4fd76e3e2c2ea
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets
arkts
FullScreenLaunchComponent
Declares the FullScreenLaunchComponent, a component provided by ArkUI that allows you to define and use it in your application through the ArkTS-based declarative development paradigm. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
@Component export declare struct FullScreenLaunchComponent { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam content: Callback<void>; /** * Indicates atomic service appId. * @type { strin...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct FullScreenLaunchComponent AST#component_body#Left { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomic...
@Component export declare struct FullScreenLaunchComponent { @BuilderParam content: Callback<void>; appId: string; options?: AtomicServiceOptions; onError?: ErrorCallback; onTerminated?: Callback<TerminationInfo>; onReceive?: Callback<Record<string, Object>>; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets#L32-L86
bf25341bbd1b80902768efd982f6e6ab38f9201b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/ComponentVoiceBg.ets
arkts
ComponentVoiceBg
通用背景组件,包含 悬浮窗切换按钮 头像名称 提示语/计时组件 单个@BuilderParam,可以以闭包形式传入按钮group,实现不同页面的不同操作按钮
@Component export default struct ComponentVoiceBg { @Link mPerson: Caller; @BuilderParam options: () => void; private showTimer?: boolean; private tips?: string | Resource; build() { Column() { Column() { Row() { Blank() Button() { Image($r('app.media.icon_op...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ComponentVoiceBg AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mPerson : AST#type_annotation#Left AST#primary_type#Left Caller AST#primary_type#Right AST...
@Component export default struct ComponentVoiceBg { @Link mPerson: Caller; @BuilderParam options: () => void; private showTimer?: boolean; private tips?: string | Resource; build() { Column() { Column() { Row() { Blank() Button() { Image($r('app.media.icon_op...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/ComponentVoiceBg.ets#L28-L79
08e4c8a545dab59826b2723f42bae06888be0c56
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeaderV2.d.ets
arkts
Defines the SubHeaderV2SelectOptions. @interface SubHeaderV2SelectOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export interface SubHeaderV2SelectOptions { /** * Sets the options of the SubHeaderV2SelectOptions. * * @type { SelectOption[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ options: SelectOption[]; /** * Sets the selected index of the Sub...
AST#export_declaration#Left export AST#interface_declaration#Left interface SubHeaderV2SelectOptions AST#object_type#Left { /** * Sets the options of the SubHeaderV2SelectOptions. * * @type { SelectOption[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 ...
export interface SubHeaderV2SelectOptions { options: SelectOption[]; selectedIndex?: number; selectedContent?: ResourceStr; onSelect?: SubHeaderV2SelectOnSelect; defaultFocus?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeaderV2.d.ets#L160-L220
f6910794318b135b987018616165849bd53caae8
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SelectionMenu.d.ets
arkts
Construct parameter types for EditorMenuOptions. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Construct parameter types for EditorMenuOptions. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface EditorMenuOptions { /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Fu...
AST#export_declaration#Left export AST#interface_declaration#Left interface EditorMenuOptions AST#object_type#Left { /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of icon and text item. ...
export interface EditorMenuOptions { icon: ResourceStr; symbolStyle?: SymbolGlyphModifier; action?: () => void; builder?: () => void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SelectionMenu.d.ets#L38-L112
8752088e8aa25b7c3ba76bdce28d1eec222f712d
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
resetReconnectAttempts
重置重连计数器
private resetReconnectAttempts(): void { this.reconnectAttempts = 0; this.reconnectDelay = 1000; if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); this.reconnectTimer = -1; } }
AST#method_declaration#Left private resetReconnectAttempts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assig...
private resetReconnectAttempts(): void { this.reconnectAttempts = 0; this.reconnectDelay = 1000; if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); this.reconnectTimer = -1; } }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L39-L46
ae9cbd250678a64558f27f4a923d35b322022549
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/param/BlurAnimationOptions.ets
arkts
@author: HHBin @date: 2024-11-28 @desc: 模糊动画
export class BlurAnimationOptions implements INavAnimateOptions { _blur?: number _options?: BlurOptions _isBeforePage: boolean = false constructor
AST#export_declaration#Left export AST#ERROR#Left class BlurAnimationOptions AST#implements_clause#Left implements INavAnimateOptions AST#implements_clause#Right { _blur ? AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Le...
export class BlurAnimationOptions implements INavAnimateOptions { _blur?: number _options?: BlurOptions _isBeforePage: boolean = false constructor
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/BlurAnimationOptions.ets#L10-L15
e91f78dbf3d420ebd57a9ed3fd864b55f8fa0c76
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
byMonthDayForYear
获取某年某月的所有日期 @param year @param month @returns
static byMonthDayForYear(year: number, month: number): Day[][] { const FIRST_DAY_OF_WEEK = TimeUtils.getWeekDay(year, month, 1); const PREVIOUS_MONTH_DAYS = TimeUtils.getPreviousMonthLastDays(year, month, FIRST_DAY_OF_WEEK); const CURRENT_MONTH_DAYS = TimeUtils.getCurrentMonthDays(year, month); const CA...
AST#method_declaration#Left static byMonthDayForYear AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
static byMonthDayForYear(year: number, month: number): Day[][] { const FIRST_DAY_OF_WEEK = TimeUtils.getWeekDay(year, month, 1); const PREVIOUS_MONTH_DAYS = TimeUtils.getPreviousMonthLastDays(year, month, FIRST_DAY_OF_WEEK); const CURRENT_MONTH_DAYS = TimeUtils.getCurrentMonthDays(year, month); const CA...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L110-L163
0db8db17d3996b6ed622d5a6305a5c07911cf04f
gitee