nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Privacy/privacy/src/main/ets/pages/WebUrlSafe.ets
arkts
checkUrl
Check function
function checkUrl(str: string): boolean { let tmpUri = new uri.URI(str); let res = tmpUri.normalize(); // Note that you need to normalize tmpUri first. Otherwise, security verification will be bypassed hilog.info(0x0000, 'privacy', 'res.scheme:' + res.scheme); // Protocol hilog.info(0x0000, 'privacy', 'res....
AST#function_declaration#Left function checkUrl AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
function checkUrl(str: string): boolean { let tmpUri = new uri.URI(str); let res = tmpUri.normalize(); hilog.info(0x0000, 'privacy', 'res.scheme:' + res.scheme); hilog.info(0x0000, 'privacy', 'res.host:' + res.host); hilog.info(0x0000, 'privacy', 'res.port:' + res.port); hilog.info(0x0000, 'privacy'...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Privacy/privacy/src/main/ets/pages/WebUrlSafe.ets#L26-L41
bd8f820b67684efad56496d0f0de9fb4f7edbc15
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/game/VirtualShopPage.ets
arkts
buildCurrencyItem
构建货币项
@Builder buildCurrencyItem(type: CurrencyType, amount: number, color: string, icon: string) { Row({ space: 4 }) { Image($r(`app.media.${icon}`)) .width(16) .height(16) .fillColor(color) Text(amount.toString()) .fontSize(14) .fontColor($r('app.color.text_primary...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCurrencyItem AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left CurrencyType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left amount : AST#type_annot...
@Builder buildCurrencyItem(type: CurrencyType, amount: number, color: string, icon: string) { Row({ space: 4 }) { Image($r(`app.media.${icon}`)) .width(16) .height(16) .fillColor(color) Text(amount.toString()) .fontSize(14) .fontColor($r('app.color.text_primary...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/game/VirtualShopPage.ets#L187-L200
6edbe9d09f1e5b3cb5872e65600e65b809f901eb
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
setDeviceStatus
设置单个设备状态
setDeviceStatus(deviceId: string, isOn: boolean): void { const device = this.deviceStatus.find(device => device.id === deviceId); if (device) { device.isOn = isOn; } }
AST#method_declaration#Left setDeviceStatus AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isOn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
setDeviceStatus(deviceId: string, isOn: boolean): void { const device = this.deviceStatus.find(device => device.id === deviceId); if (device) { device.isOn = isOn; } }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L195-L200
f6824d2a7228e8d7d0cc3894e6828e0da0930fd2
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
add_history
Operations Adds a history, automatically puts it in the order of time. @param history A history_record object. @param no_reconstruct_plain_history A boolean, will not reconstruct plain history cache if set true.
add_history(history: history_record, instantly_save_to_disk: boolean, index: boolean, layer?: number) { // console.log('[Meow][bunch_of_history]' + ' '.repeat(layer || 0) + '(' + (layer || 0).toString() + ') Add history: ' + history.toString()); let history_date = new Date(history.accessed_time); let yea...
AST#method_declaration#Left add_history AST#parameter_list#Left ( AST#parameter#Left history : AST#type_annotation#Left AST#primary_type#Left history_record AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left instantly_save_to_disk : AST#type_annotation#Left AST#primary_type#Left b...
add_history(history: history_record, instantly_save_to_disk: boolean, index: boolean, layer?: number) { let history_date = new Date(history.accessed_time); let year = history_date.getUTCFullYear(); let month = history_date.getUTCMonth() + 1; this.open_month_from_disk_sync(year, month); ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L277-L346
1f966ffecbbeb69c7a59768796e60a2338d7b3d1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets
arkts
removeSound
删除声音
async removeSound(sound: CDBSound) { if (sound.idxx) { await CSoundDbAccessor.shared.deleteById(sound.idxx) } }
AST#method_declaration#Left async removeSound AST#parameter_list#Left ( AST#parameter#Left sound : AST#type_annotation#Left AST#primary_type#Left CDBSound AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_s...
async removeSound(sound: CDBSound) { if (sound.idxx) { await CSoundDbAccessor.shared.deleteById(sound.idxx) } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L118-L122
d2d746501a1589a4f55dddd2b1347c15f02ab584
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onForeground
Ability前台显示时的回调
onForeground(): void { console.log('[EntryAbility] Ability onForeground'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onForeground'); // 应用回到前台时的处理 this.handleForeground(); }
AST#method_declaration#Left onForeground 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#...
onForeground(): void { console.log('[EntryAbility] Ability onForeground'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onForeground'); this.handleForeground(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L67-L73
c8dc6d99040c25cfd07fccc6d90127084c354701
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DisplayUtil.ets
arkts
getCutoutHeight
获取挖孔屏、刘海屏等不可用屏幕区域的高度。单位px。 @returns
static async getCutoutHeight(): Promise<number> { let rect = await DisplayUtil.getCutoutRect(); if (rect) { return rect.height; } return 0; }
AST#method_declaration#Left static async getCutoutHeight 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 number AST#primary_type#Right AST#type_annotation#Right > ...
static async getCutoutHeight(): Promise<number> { let rect = await DisplayUtil.getCutoutRect(); if (rect) { return rect.height; } return 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L120-L126
ba27b8fbcc8f647f44a4a73dd1d09d9ffba617a9
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/SHA1.ets
arkts
SHA1哈希算法实现
export class SHA1 { private static readonly K: number[] = [ 0x5A827999, // 0-19 0x6ED9EBA1, // 20-39 0x8F1BBCDC, // 40-59 0xCA62C1D6 // 60-79 ]; /** * 左循环移位 */ private static leftRotate(n: number, rotate: number): number { return (n << rotate) | (n >>> (32 - rotate)); } /** *...
AST#export_declaration#Left export AST#class_declaration#Left class SHA1 AST#class_body#Left { AST#property_declaration#Left private static readonly K : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Le...
export class SHA1 { private static readonly K: number[] = [ 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 ]; private static leftRotate(n: number, rotate: number): number { return (n << rotate) | (n >>> (32 - rotate)); } private static toLittleEndian32(n: number): number { ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/SHA1.ets#L6-L152
71f2b15aa2d7ee49db3d8905f6fa0e12428544ee
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
获取或创建全局用户状态(持久化) @returns {UserState} 全局用户状态 @example const state = getUserState();
export function getUserState(): UserState { return PersistenceV2.globalConnect<UserState>({ type: UserState, key: USER_STATE_KEY, defaultCreator: () => new UserState(), areaMode: contextConstant.AreaMode.EL3 })!; }
AST#export_declaration#Left export AST#function_declaration#Left function getUserState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserState AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ...
export function getUserState(): UserState { return PersistenceV2.globalConnect<UserState>({ type: UserState, key: USER_STATE_KEY, defaultCreator: () => new UserState(), areaMode: contextConstant.AreaMode.EL3 })!; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L181-L188
acf94e2f0b49132ccd0205f93232af748c0cee38
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
getGenderText
性别显示名称
function getGenderText(gender: number): string { switch (gender) { case 1: return 'Male'; case 2: return 'Female'; default: return 'Not set'; }
AST#function_declaration#Left function getGenderText AST#parameter_list#Left ( AST#parameter#Left gender : 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#pri...
function getGenderText(gender: number): string { switch (gender) { case 1: return 'Male'; case 2: return 'Female'; default: return 'Not set'; }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L66-L71
b3b7d37667a5ff8f486855e6d76032a38517327a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
状态统计接口
export interface StatusStatistics { pending: number; in_progress: number; completed: number; cancelled: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StatusStatistics AST#object_type#Left { AST#type_member#Left pending : 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 in_progress : AST#type_an...
export interface StatusStatistics { pending: number; in_progress: number; completed: number; cancelled: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L108-L113
ed817e2245d75b9f0a1e5511379a88d2d9d9fd4b
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/common/PreferencesUtil.ets
arkts
getNumber
读取数字数据 @param context 应用上下文 @param key 键 @param defaultValue 默认值 @returns 数字值
static async getNumber(context: common.UIAbilityContext, key: string, defaultValue: number = 0): Promise<number> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); return await dataPreferences.get(key, defaultValue) as number; } catch (error) { console.error('Prefer...
AST#method_declaration#Left static async getNumber AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ke...
static async getNumber(context: common.UIAbilityContext, key: string, defaultValue: number = 0): Promise<number> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); return await dataPreferences.get(key, defaultValue) as number; } catch (error) { console.error('Prefer...
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L92-L100
e8703a8260b9f2732779700846a5ee13e7f59022
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets
arkts
equals
等价于 Swift 的 == 运算符
static equals(lhs: CMetaInfo, rhs: CMetaInfo): boolean { return lhs.fileName === rhs.fileName; }
AST#method_declaration#Left static equals AST#parameter_list#Left ( AST#parameter#Left lhs : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rhs : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#...
static equals(lhs: CMetaInfo, rhs: CMetaInfo): boolean { return lhs.fileName === rhs.fileName; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L14-L16
d0689e8df1e8bd2abf31617101a23accafdc83ea
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/model/ExpandCardItem.ets
arkts
@file 扩展模块卡片信息 @author Joker.X
export interface ExpandCardItem { /** * 标题 */ title: Resource; /** * 描述内容 */ description: Resource; /** * 点击事件 */ onClick: () => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ExpandCardItem AST#object_type#Left { /** * 标题 */ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 描述内容 */ AST#type_m...
export interface ExpandCardItem { title: Resource; description: Resource; onClick: () => void; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/model/ExpandCardItem.ets#L5-L20
fe50a4d486f8a58bab10d1ec22a3e09f729b53b8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets
arkts
regDisplayListener
注册屏幕状态监听 @returns {void}
regDisplayListener(): void { this.changePreferType(display.getFoldStatus()); display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { // 同一个状态重复触发不做处理 if (this.curFoldStatus === curFoldStatus) { return; } // 缓存当前折叠状态 this.curFoldStatus = curFoldStatus; ...
AST#method_declaration#Left regDisplayListener 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#expre...
regDisplayListener(): void { this.changePreferType(display.getFoldStatus()); display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { if (this.curFoldStatus === curFoldStatus) { return; } this.curFoldStatus = curFoldStatus; this.changePreferType...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets#L80-L91
15e882225d6b4a5871c175e090a2a28b24d2c0b3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
IDataSource处理数据监听的基本实现
export class NewsListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataList: Array<NewsItem> = []; public totalCount(): number { return this.dataList.length; } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */ public getData(index: number): NewsI...
AST#export_declaration#Left export AST#class_declaration#Left class NewsListDataSource 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 DataChangeListen...
export class NewsListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataList: Array<NewsItem> = []; public totalCount(): number { return this.dataList.length; } public getData(index: number): NewsItem { return this.dataList[index]; } public addDa...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L20-L131
bb9a831849a9c54920b550b73773ca76878a766c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreviewUtil.ets
arkts
generatePreviewInfo
根据文件uri构建PreviewInfo @param uri 文件的uri @returns
static generatePreviewInfo(uri: string): filePreview.PreviewInfo { const fileName = FileUtil.getFileName(uri); const fileExtention = FileUtil.getFileExtention(fileName); const mimeType = PreviewUtil.getMimeType(fileExtention); let previewInfo: filePreview.PreviewInfo = { title: fileName, uri...
AST#method_declaration#Left static generatePreviewInfo AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
static generatePreviewInfo(uri: string): filePreview.PreviewInfo { const fileName = FileUtil.getFileName(uri); const fileExtention = FileUtil.getFileExtention(fileName); const mimeType = PreviewUtil.getMimeType(fileExtention); let previewInfo: filePreview.PreviewInfo = { title: fileName, uri...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L113-L123
dcb4cd8044046ecf9de97a68757f3fe7dc07f9cd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
下载进度模板通知配置项(适用于文件下载类通知)
export interface NotificationTemplateOptions extends NotificationBasicOptions { /** 下载文件名称(必填,标识下载的文件) */ downloadFileName: string; /** 下载进度值(取值范围0-100,代表0%-100%的下载进度) */ downloadProgress: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationTemplateOptions AST#extends_clause#Left extends NotificationBasicOptions AST#extends_clause#Right AST#object_type#Left { /** 下载文件名称(必填,标识下载的文件) */ AST#type_member#Left downloadFileName : AST#type_annotation#Left AST#primary_type#Lef...
export interface NotificationTemplateOptions extends NotificationBasicOptions { downloadFileName: string; downloadProgress: number; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L598-L603
b53a931c2fdbbd616dc4109b0470946b2398b119
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
LunarCalendar_Fixed.ets
arkts
getLunarMonthDays
🔧 修复:获取农历年某月天数 - 使用准确数据
private static getLunarMonthDays(lunarYear: number, lunarMonth: number): number { if (lunarMonth < 1 || lunarMonth > 12) { return 0; } return AccurateLunarMonthDays.getMonthDays(lunarYear, lunarMonth); }
AST#method_declaration#Left private static getLunarMonthDays AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Lef...
private static getLunarMonthDays(lunarYear: number, lunarMonth: number): number { if (lunarMonth < 1 || lunarMonth > 12) { return 0; } return AccurateLunarMonthDays.getMonthDays(lunarYear, lunarMonth); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L273-L278
0cd74793e853e0fa4262df5769a1067f64c04d87
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/viewmodel/AppViewModel.ets
arkts
AppAppearanceViewModel
外观数据中心
@ObservedV2 export class AppAppearanceViewModel { // 壁纸 @Trace staticWallpaper: string = ''; // 壁纸 id @Trace staticWallpaperId: number = 1; // 是否开启组件高斯模糊 @Trace isComponentBlur: boolean = false; // 组件高斯模糊 @Trace componentBlur: number = 20; // 是否显示全部的按钮控件 @Trace isButtonsShow: boolean = true; // 是否...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class AppAppearanceViewModel AST#class_body#Left { // 壁纸 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right staticWallpaper : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
@ObservedV2 export class AppAppearanceViewModel { @Trace staticWallpaper: string = ''; id @Trace staticWallpaperId: number = 1; @Trace isComponentBlur: boolean = false; @Trace componentBlur: number = 20; @Trace isButtonsShow: boolean = true; @Trace isSideBarButtonShow: boolean = true; @T...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/viewmodel/AppViewModel.ets#L25-L44
67f988cd3e4f3e5ae9adf6a503538584c87830e9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets
arkts
enableDashedHighlightLine
Enables the highlight-line to be drawn in dashed mode, e.g. like this "- - - - - -" @param lineLength the length of the line pieces @param spaceLength the length of space in between the line-pieces @param phase offset, in degrees (normally, use 0)
public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void { let arr = [lineLength, spaceLength]; this.mHighlightDashPathEffect = new DashPathEffect(arr, phase); }
AST#method_declaration#Left public enableDashedHighlightLine AST#parameter_list#Left ( AST#parameter#Left lineLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left spaceLength : AST#type_annotation#Left AST#primary_type#L...
public enableDashedHighlightLine(lineLength: number, spaceLength: number, phase: number): void { let arr = [lineLength, spaceLength]; this.mHighlightDashPathEffect = new DashPathEffect(arr, phase); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets#L88-L92
e184a2613cd2ec4119f6a406a6b73ea37db3e484
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getDownloadPath
获取当前应用的Download路径(Download目录下当前应用包名对应的路径) @param relativePath 文件路径;相对路径(wps/doc);relativePath传空字符串表示根目录 @param fileName 不传或传空 返回当前应用的Download文件夹路径
static getDownloadPath(relativePath: string | undefined = undefined, fileName?: string) { const bundleName = AppUtil.getBundleName(); let downloadPath = '/storage/Users/currentUser/Download/' + bundleName; //获取Download目录下应用包名对应的path if (StrUtil.isNotEmpty(relativePath)) { downloadPath = downloadPath +...
AST#method_declaration#Left static getDownloadPath AST#parameter_list#Left ( AST#parameter#Left relativePath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#ex...
static getDownloadPath(relativePath: string | undefined = undefined, fileName?: string) { const bundleName = AppUtil.getBundleName(); let downloadPath = '/storage/Users/currentUser/Download/' + bundleName; if (StrUtil.isNotEmpty(relativePath)) { downloadPath = downloadPath + FileUtil.separator + rela...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L131-L144
44b256c6880a4100224605eded5484115b47fa1d
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/StudyTimeManager.ets
arkts
addStudyTime
添加学习时长到数据库
private async addStudyTime(minutes: number): Promise<void> { try { const dbManager = DatabaseManager.getInstance() const stats = await dbManager.getUserStats() const newTotalStudyTime = stats.totalStudyTime + minutes console.info(`[StudyTimeManager] 更新学习时长: ${stats.totalStudyTime} + ${minut...
AST#method_declaration#Left private async addStudyTime AST#parameter_list#Left ( AST#parameter#Left minutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic...
private async addStudyTime(minutes: number): Promise<void> { try { const dbManager = DatabaseManager.getInstance() const stats = await dbManager.getUserStats() const newTotalStudyTime = stats.totalStudyTime + minutes console.info(`[StudyTimeManager] 更新学习时长: ${stats.totalStudyTime} + ${minut...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/StudyTimeManager.ets#L82-L94
903de2488c4bec46d35190fecd19cd50c7aebadf
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Custom transition opacity.
export const CUSTOM_TRANSITION_OPACITY = 0.2;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CUSTOM_TRANSITION_OPACITY = AST#expression#Left 0.2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const CUSTOM_TRANSITION_OPACITY = 0.2;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L85-L85
5ca2efd1534d4427ddf5b8024fd90b87bdba8639
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
decryptECBSync
解密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @returns
static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob { return SM4.decryptSync(data, symKey, null, 'SM4_128|ECB|PKCS7'); }
AST#method_declaration#Left static decryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe...
static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob { return SM4.decryptSync(data, symKey, null, 'SM4_128|ECB|PKCS7'); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L186-L188
abab48f3dfd32640d394d803942f8e4783d61594
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/setting/SettingManager.ets
arkts
initPreferences
MARK: - 初始化 Preferences
private initPreferences(context: common.Context): void { try { this.preferences = preferences.getPreferencesSync(context, { name: Pref.PREF_NAME }); this.loadPreference(); } catch (err) { console.error('初始化 Preferences 失败:', (err as BusinessError).message); } }
AST#method_declaration#Left private initPreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS...
private initPreferences(context: common.Context): void { try { this.preferences = preferences.getPreferencesSync(context, { name: Pref.PREF_NAME }); this.loadPreference(); } catch (err) { console.error('初始化 Preferences 失败:', (err as BusinessError).message); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/setting/SettingManager.ets#L90-L97
942c0461ee87da243404c55897ff6d0aa4556087
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/GreetingsPage.ets
arkts
buildGreetingsList
构建祝福语列表
@Builder buildGreetingsList() { if (this.filteredGreetings.length === 0) { if (this.searchKeyword.trim()) { SearchEmptyView({ searchKeyword: this.searchKeyword }) } else { GreetingsEmptyView({ onCreateGreeting: () => { appRouter.push(RoutePaths.GREETING_EDIT); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expre...
@Builder buildGreetingsList() { if (this.filteredGreetings.length === 0) { if (this.searchKeyword.trim()) { SearchEmptyView({ searchKeyword: this.searchKeyword }) } else { GreetingsEmptyView({ onCreateGreeting: () => { appRouter.push(RoutePaths.GREETING_EDIT); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L315-L354
987539d7201afbf33cc0474de3e30562d331bf66
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
isDigits
检查字符串是否只包含数字字符 @param str - 要检查的字符串 @returns 如果字符串只包含数字则返回 true,否则返回 false
static isDigits(str: string): boolean { if (typeof str !== 'string' || str.length === 0) { return false; } return RegexUtil.isMatch(str, RegexUtil.REG_NUMBERS); }
AST#method_declaration#Left static isDigits AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
static isDigits(str: string): boolean { if (typeof str !== 'string' || str.length === 0) { return false; } return RegexUtil.isMatch(str, RegexUtil.REG_NUMBERS); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L224-L229
d923834ef0fe59f0835910ce0a53bfa436eb2645
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/CertVerify/entry/src/main/ets/pages/Index.ets
arkts
viewCertInfo
输出指定证书文件的证书信息
async viewCertInfo(filePath: string) { let x509Cert = await this.getCertFromFile(filePath) if (x509Cert != undefined) { this.showCertInfo(x509Cert) } else { this.msgHistory += "错误的证书文件格式:" + filePath + "\r\n"; } }
AST#method_declaration#Left async viewCertInfo AST#parameter_list#Left ( AST#parameter#Left filePath : 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_declarat...
async viewCertInfo(filePath: string) { let x509Cert = await this.getCertFromFile(filePath) if (x509Cert != undefined) { this.showCertInfo(x509Cert) } else { this.msgHistory += "错误的证书文件格式:" + filePath + "\r\n"; } }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/CertVerify/entry/src/main/ets/pages/Index.ets#L124-L131
22f93f5ddb0d153545c5d2874da300107acd973b
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/debug/logcat/LogcatPanelViews.ets
arkts
@author open_9527 @date 2025/11/3 @desc LogcatPanelViews
export enum LogPanelMode { Default = 'All', Log = 'Log', Info = 'Info', Warn = 'Warn', Error = 'Error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum LogPanelMode AST#enum_body#Left { AST#enum_member#Left Default = AST#expression#Left 'All' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Log = AST#expression#Left 'Log' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left...
export enum LogPanelMode { Default = 'All', Log = 'Log', Info = 'Info', Warn = 'Warn', Error = 'Error' }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/debug/logcat/LogcatPanelViews.ets#L10-L16
e93994555c84d7e59dffb21a23019ddf8db62acd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets
arkts
ScaleUpAndFadeOutOptions 点击时图标放大淡出动画的参数。
export class ScaleUpAndFadeOutOptions { transitionInDuration: number = 200; // 入场动画时长 transitionInScale: number = 0; // 入场缩放动画比例 transitionInRotateAngle: number = 30; // 入场旋转抖动角度 transitionInRotateCurve: ICurve = curves.springMotion(0.2, 0.3); // 入场旋转抖动动画曲线,使用弹性动画曲线 transitionOutDuration: number = 400; // 出场动...
AST#export_declaration#Left export AST#class_declaration#Left class ScaleUpAndFadeOutOptions AST#class_body#Left { AST#property_declaration#Left transitionInDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; ...
export class ScaleUpAndFadeOutOptions { transitionInDuration: number = 200; transitionInScale: number = 0; transitionInRotateAngle: number = 30; transitionInRotateCurve: ICurve = curves.springMotion(0.2, 0.3); transitionOutDuration: number = 400; transitionOutScale: number = 1.8; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets#L31-L38
edb2f8c806ec9c25f3d0729061d36ee2b20109ed
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets
arkts
itemWhileDrag
设置GridItem拖拽过程中显示的图形
@Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_icon_square_size")) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemWhileDrag 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 IconWithNameView ( AST#component_parameters#Left { AST#compo...
@Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r("app.string.drag_and_exchange_icon_square_size")) .height($r("app.string.drag_and_exchange_icon_square_size")) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets#L91-L96
4162d765a9f782572ffef88e600cf7cebc5502b0
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
Base64工具类
export class Base64Utils{ private constructor() {} /** * 编码,通过输入参数编码后输出Uint8Array对象。 * @param array * @returns */ static encodeSync(array: Uint8Array): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.encodeSync(array); return result; } /** * 编码,通过输入参数编码后输...
AST#export_declaration#Left export AST#class_declaration#Left class Base64Utils AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right /** * 编码,通过输入参数编码后输出...
export class Base64Utils{ private constructor() {} static encodeSync(array: Uint8Array): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.encodeSync(array); return result; } static encodeToStrSync(array: Uint8Array, options?: util.Type): string { let base64 = new...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L6-L78
b1e50f7672ae5d013c013590edc58dfa5a7f0602
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getDailySummariesForMonth
获取指定月份的每日总结列表 @param year - 年份 @param month - 月份 (1-12)
async getDailySummariesForMonth(year: number, month: number): Promise<DailySummary[]> { try { return await this.rdbHelper.getDailySummariesForMonth(year, month); } catch (error) { console.error(`[MainViewModel] Failed to get daily summaries: ${JSON.stringify(error)}`); return []; } }
AST#method_declaration#Left async getDailySummariesForMonth 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 AS...
async getDailySummariesForMonth(year: number, month: number): Promise<DailySummary[]> { try { return await this.rdbHelper.getDailySummariesForMonth(year, month); } catch (error) { console.error(`[MainViewModel] Failed to get daily summaries: ${JSON.stringify(error)}`); return []; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L671-L678
fe0001df5720aa6326ab70e930336379a175e720
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
应用错误接口
export interface AppError { code: ErrorCode; message: string; details?: Record<string, string | number | boolean>; timestamp: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AppError AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left ErrorCode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left message : AST#type_annotation#Lef...
export interface AppError { code: ErrorCode; message: string; details?: Record<string, string | number | boolean>; timestamp: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L131-L136
5e2732bb54b79dcded0cb5d25a4fc2a5199fac04
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets
arkts
枚举底部bar类型
export enum BarType { SHOPPING_CART, // 购物车 DETAILS, // 详情页 }
AST#export_declaration#Left export AST#enum_declaration#Left enum BarType AST#enum_body#Left { AST#enum_member#Left SHOPPING_CART AST#enum_member#Right , // 购物车 AST#enum_member#Left DETAILS AST#enum_member#Right , // 详情页 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum BarType { SHOPPING_CART, DETAILS, }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L181-L184
166904eb9f746bf22e9111271efa952833a6380e
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/DialogHelper.ets
arkts
电量不足弹框 @param operator 回调
export function displayNotEnoughBatteryDialog(operator ?: DialogOperator): void { defaultKnowDialog($r('app.string.battery_not_enough_title'), $r('app.string.battery_not_enough_content', FormatUtils.getNumberFormat(0.3)), operator); }
AST#export_declaration#Left export AST#function_declaration#Left function displayNotEnoughBatteryDialog AST#parameter_list#Left ( AST#parameter#Left operator ? : AST#type_annotation#Left AST#primary_type#Left DialogOperator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
export function displayNotEnoughBatteryDialog(operator ?: DialogOperator): void { defaultKnowDialog($r('app.string.battery_not_enough_title'), $r('app.string.battery_not_enough_content', FormatUtils.getNumberFormat(0.3)), operator); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L114-L117
a3d0c5f817f1d5c02763a88f8ce5e0e1568b62b5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class AnimationUtil { /** * 顶部弹出动画 * @param duration 动画时间 * @returns */ static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdg...
AST#export_declaration#Left export AST#class_declaration#Left class AnimationUtil AST#class_body#Left { /** * 顶部弹出动画 * @param duration 动画时间 * @returns */ AST#method_declaration#Left static transitionFromUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left...
export class AnimationUtil { static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })), TransitionEf...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L16-L82
834763c6d7def5a6ea9e61c011ae10e3b3b9f667
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/BasicDataSource.ets
arkts
pushData
添加数据
public pushData(data: T[]): void { data.forEach((item: T) => { this.articleData.push(item); this.notifyDataAdd(this.articleData.length - 1); }) }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri...
public pushData(data: T[]): void { data.forEach((item: T) => { this.articleData.push(item); this.notifyDataAdd(this.articleData.length - 1); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/BasicDataSource.ets#L100-L105
7521358752109b208f00cf6273de8f70fcc60e8d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpServer.ets
arkts
构建界面
build() { Column() { // 显示服务端IP地址的输入框 Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .margin({ bottom: MARGIN.MEDIUM }); TextInput() .width('80%') .onC...
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 { // 显示服务端IP地址的输入框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#...
build() { Column() { Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .margin({ bottom: MARGIN.MEDIUM }); TextInput() .width('80%') .onChange((value) =>...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpServer.ets#L65-L180
d0278eeaaf6b3ea7e831a01c65b95a55161041c5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/TabBarModel.ets
arkts
tabs数据信息。
export const TabsInfo: TabBarData[] = [ { id: TabBarType.DISCOVER, title: $r('app.string.multiple_screening_tab_main'), activeIcon: $r('app.media.multiple_screening_tab_explore_on'), defaultIcon: $r('app.media.multiple_screening_tab_explore_off') }, { id: TabBarType.LEARNING, title: $r('ap...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TabsInfo : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TabBarData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expres...
export const TabsInfo: TabBarData[] = [ { id: TabBarType.DISCOVER, title: $r('app.string.multiple_screening_tab_main'), activeIcon: $r('app.media.multiple_screening_tab_explore_on'), defaultIcon: $r('app.media.multiple_screening_tab_explore_off') }, { id: TabBarType.LEARNING, title: $r('ap...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/TabBarModel.ets#L37-L68
be5c1a266e3543b3eac30f15b8a82eb6fbf61893
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
load_from_disk
Loads key combination settings from disk
load_from_disk() { try { let combinations = bunch_of_settings.get('key_shortcuts') as string; // console.log('[bunch_of_key_shortcuts][load_from_disk] Combinations: ' + combinations); let keys_lines: string[] = []; if (combinations != '') { keys_lines = combinations.split('\n'); ...
AST#method_declaration#Left load_from_disk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left combinations = AST#expression#Left AST#as_...
load_from_disk() { try { let combinations = bunch_of_settings.get('key_shortcuts') as string; let keys_lines: string[] = []; if (combinations != '') { keys_lines = combinations.split('\n'); for (let index = 0; index < keys_lines.length; index++) { if (this.key_shor...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L102-L119
a2681b7eaaf03c96dc29611e2d531ef5a87793c2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets
arkts
getCurrentScreenWidth
获取当前屏幕宽度
getCurrentScreenWidth(): number { let screenWidth: number = px2vp(display.getDefaultDisplaySync().width); // 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。 if (!this.isPlugin && screenWidth >= this.DEVICESIZE) { return screenWidth / 2; }...
AST#method_declaration#Left getCurrentScreenWidth 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#variable_declaration#Left let AST#variable_declarator#Left scr...
getCurrentScreenWidth(): number { let screenWidth: number = px2vp(display.getDefaultDisplaySync().width); if (!this.isPlugin && screenWidth >= this.DEVICESIZE) { return screenWidth / 2; } else { return screenWidth; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L137-L145
42416c828ad301fe2aa4a520c09bf60e37b559fd
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SegmentButtonV2.d.ets
arkts
TabSegmentButtonV2
Defines segmented button with tab style. @struct TabSegmentedButton @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@ComponentV2 export declare struct TabSegmentButtonV2 { /** * Sets the items of the segmented button. * * @type { SegmentButtonV2Items } * @readonly * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Require @Param ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct TabSegmentButtonV2 AST#component_body#Left { /** * Sets the items of the segmented button. * * @type { SegmentButtonV2Items } * @readonly * @syscap Sy...
@ComponentV2 export declare struct TabSegmentButtonV2 { @Require @Param readonly items: SegmentButtonV2Items; @Require @Param readonly selectedIndex: number; @Event $selectedIndex?: OnSelectedIndexChange; @Event onItemClicked?: Callback<number>; @...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L359-L788
280ab802a47ecba4a82dc28eb6a62f7c085d2673
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
arkts
saveWordUser
====== 插入/更新 ======
async saveWordUser(wordUser: WordUser): Promise<void> { if (!this.db) return; const sql = ` REPLACE INTO ${Tables.Learn.NAME} ( ${Tables.Learn.Col.TITLE_EN}, ${Tables.Learn.Col.LEARN_TIMES}, ${Tables.Learn.Col.CORRECTED_TIMES}, ${Tables.Learn.Col.WRANG_TIMES}, ${Ta...
AST#method_declaration#Left async saveWordUser AST#parameter_list#Left ( AST#parameter#Left wordUser : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
async saveWordUser(wordUser: WordUser): Promise<void> { if (!this.db) return; const sql = ` REPLACE INTO ${Tables.Learn.NAME} ( ${Tables.Learn.Col.TITLE_EN}, ${Tables.Learn.Col.LEARN_TIMES}, ${Tables.Learn.Col.CORRECTED_TIMES}, ${Tables.Learn.Col.WRANG_TIMES}, ${Ta...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L159-L195
4224f3cba16c66294d0667616396ef0d80b77599
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets
arkts
set
设置命令监听器,用于接收平台下发的命令。 此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理 @param commandListener 命令监听器
set commandListener(value: CommandListener | null);
AST#method_declaration#Left set AST#ERROR#Left command List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CommandListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#typ...
set commandListener(value: CommandListener | null);
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets#L47-L47
2dad9adf4efb3ba172f7b83cf8bb96998f08607f
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api11/entry/src/main/ets/MainAbility/common/GlobalContext.ets
arkts
构造单例对象
export class GlobalContext { private constructor() { } private static instance: GlobalContext; public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instance; } getObject(value: string): Object | u...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instance; } getObject(value: string): Object | u...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api11/entry/src/main/ets/MainAbility/common/GlobalContext.ets#L17-L37
a79c2d5c7865e713d12699dec221e3712c784977
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets
arkts
[End vsync_power_case_1]
build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { // 30FPS 动态文本 Row() { this.doSomeRenderFirst() } .width('80%') .height('auto') .justifyContent(FlexAlign.Center) .margin({ top: 10 }) // 60FPS 动态文本 Row() { this....
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right ....
build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { Row() { this.doSomeRenderFirst() } .width('80%') .height('auto') .justifyContent(FlexAlign.Center) .margin({ top: 10 }) Row() { this.doSomeRenderSecond() ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/display_sync_example.ets#L108-L193
163fcf2b8aaa5429114fc75ffc20ee760536b76a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets
arkts
pushItem
从结尾插入数据
public pushItem(item: string): void { this.elements.push(item); this.listeners.forEach(listeners => listeners.onDataAdd(this.elements.length - CONFIGURATION.PAGEFLIPONE)); }
AST#method_declaration#Left public pushItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public pushItem(item: string): void { this.elements.push(item); this.listeners.forEach(listeners => listeners.onDataAdd(this.elements.length - CONFIGURATION.PAGEFLIPONE)); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets#L66-L69
2ba9fa95e3556b7492e68ab53425a4859d1054f0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets
arkts
updateImageStatus
视频播放完成后,更新播放图片状态
updateImageStatus() { logger.info(`AVPlayManager, updateImageStatus start`); if (this.playStatus !== 'completed') { return; } this.isPlaying = false; }
AST#method_declaration#Left updateImageStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_...
updateImageStatus() { logger.info(`AVPlayManager, updateImageStatus start`); if (this.playStatus !== 'completed') { return; } this.isPlaying = false; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets#L109-L115
133e07ab2cc5796a03e53e59a4049f315b028b31
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_b.ets
arkts
Introduction export-default/import
export default function cross_file_003_T_b(taint_src : string) { let t = cross_file_003_T_a(taint_src); taint.Sink(t); }
AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_003_T_b 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...
export default function cross_file_003_T_b(taint_src : string) { let t = cross_file_003_T_a(taint_src); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_b.ets#L7-L10
d9f63d830dc8463235deda7555975304a936b37e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/Range.ets
arkts
contains
Returns true if this range contains (if the value is in between) the given value, false if not. @param value @return
public contains(value: number): boolean { if (value > this.myfrom && value <= this.to) return true; else return false; }
AST#method_declaration#Left public contains AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type...
public contains(value: number): boolean { if (value > this.myfrom && value <= this.to) return true; else return false; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/Range.ets#L31-L37
0021a06d1ec60219f4688ab5ac30afeaa82f9745
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Dialog.ets
arkts
setContentNode
设置组件内容节点
setContentNode(node: ComponentContent<object>) { this.contentNode = node; // 将传入的节点赋值给实例变量 }
AST#method_declaration#Left setContentNode AST#parameter_list#Left ( AST#parameter#Left node : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ComponentContent AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right > AST#type...
setContentNode(node: ComponentContent<object>) { this.contentNode = node; }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L21-L23
ac010beae80a8ba652cfbd7a9e947f0fdac9ac21
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
getProvinceData
获取省数据 @returns
private getProvinceData(): Array<City> { let provList: Array<City> = new Array(); this.provinceList.forEach(province => { //默认将省数据赋值给当前listview对应的数据 provList.push(new City(province.name, province.code)); }) return provList; }
AST#method_declaration#Left private getProvinceData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right > AST#type_...
private getProvinceData(): Array<City> { let provList: Array<City> = new Array(); this.provinceList.forEach(province => { provList.push(new City(province.name, province.code)); }) return provList; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L148-L155
3c7f8650a3a4f4caafeb4a40627add3f55b5ae55
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/textInput/constants/TextInputConstants.ets
arkts
Copyright (C) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const TEXT_INPUT_FONT_SIZE = 16
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TEXT_INPUT_FONT_SIZE = AST#expression#Left 16 AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export const TEXT_INPUT_FONT_SIZE = 16
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/constants/TextInputConstants.ets#L16-L16
291022f23c3936a69bb590c2d084e894feaf0c87
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets
arkts
============================================================ MARK: - 详情项排序结构
export class ItemOrder { item : DetailItem order : number isVisible : boolean constructor
AST#export_declaration#Left export AST#ERROR#Left class ItemOrder { item : AST#ERROR#Left DetailItem order : number isVisible : AST#ERROR#Right boolean AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declara...
export class ItemOrder { item : DetailItem order : number isVisible : boolean constructor
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L34-L39
52d866db63a2a6076815a1e3530d4a09916703b7
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/ClassifyModel.ets
arkts
course classity model
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/ClassifyModel.ets#L21-L21
a3853a2dedc5edfdf63a66bf8056fa590fe63f75
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets
arkts
commonStyles
通用样式函数
@Styles commonStyles(){ .width('100%') .margin({ top: $r('app.string.ohos_id_elements_margin_vertical_m') }) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right commonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#e...
@Styles commonStyles(){ .width('100%') .margin({ top: $r('app.string.ohos_id_elements_margin_vertical_m') }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets#L143-L147
2133ebc3262978a3ae7bae4c450016ece2d6d66a
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/arkts/@arkts.collections.d.ets
arkts
getIndexOf
Locates the first occurrence of a certain bit value within a range of bits in a bit vector. @param { number } element - Element to be Located (0 means 0, else means 1). @param { number } fromIndex - The starting position of the index, containing the value at that index position. @param { number } toIndex - The end of ...
getIndexOf(element: number, fromIndex: number, toIndex: number): number;
AST#method_declaration#Left getIndexOf AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
getIndexOf(element: number, fromIndex: number, toIndex: number): number;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.collections.d.ets#L5596-L5596
b58f6a48dd07ae3b68997d1e9b4805b2203ecc4d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
createDynamicShortcuts
创建动态快捷方式
async createDynamicShortcuts(): Promise<void> { try { // 获取当前动态数据 const upcomingBirthdays = await this.getUpcomingBirthdays(); const dynamicShortcuts: ShortcutInfo[] = []; // 快速祝福快捷方式 if (upcomingBirthdays.length > 0) { const todayBirthday = upcomingBirthdays.find(b => this.is...
AST#method_declaration#Left async createDynamicShortcuts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS...
async createDynamicShortcuts(): Promise<void> { try { const upcomingBirthdays = await this.getUpcomingBirthdays(); const dynamicShortcuts: ShortcutInfo[] = []; if (upcomingBirthdays.length > 0) { const todayBirthday = upcomingBirthdays.find(b => this.isToday(b.birthday.date)...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L113-L199
9a0013b462fe15ee0fe8e8396e2ce28a10bdfae5
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets
arkts
decrement
计数减一 @returns {void} 无返回值
decrement(): void { this.counterState.decrement(); }
AST#method_declaration#Left decrement 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#Lef...
decrement(): void { this.counterState.decrement(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets#L28-L30
c3cfb4b375d392a900ada09d11885ba6fd58317d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets
arkts
drawLines
Draw box selection lines.
private drawLines() { this.canvasContext.beginPath(); this.canvasContext.lineWidth = Constants.LINES_WIDTH; this.canvasContext.strokeStyle = Constants.LINES_COLOR; this.canvasContext.globalAlpha = Constants.LINES_ALPHA; this.canvasContext.lineJoin = Constants.LINES_STYLE; this.canvasContext.move...
AST#method_declaration#Left private drawLines AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left...
private drawLines() { this.canvasContext.beginPath(); this.canvasContext.lineWidth = Constants.LINES_WIDTH; this.canvasContext.strokeStyle = Constants.LINES_COLOR; this.canvasContext.globalAlpha = Constants.LINES_ALPHA; this.canvasContext.lineJoin = Constants.LINES_STYLE; this.canvasContext.move...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets#L73-L132
a0272d136a8791a20e2e14fb17b69cd6c1195b81
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets
arkts
zero
定义一个静态属性来表示 Offset.zero
static zero(): Size { return new Size(0, 0); }
AST#method_declaration#Left static zero AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left ...
static zero(): Size { return new Size(0, 0); }
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#L1149-L1151
dbf8a355f60c1a2301e612e0394644e0a3c64e95
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_002_F/cross_file_002_F_a.ets
arkts
Introduction export/import
export function cross_file_002_F_a (taint_src : string) { return taint_src }
AST#export_declaration#Left export AST#function_declaration#Left function cross_file_002_F_a 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_statement#...
export function cross_file_002_F_a (taint_src : string) { return taint_src }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_002_F/cross_file_002_F_a.ets#L5-L7
dbae85f8da15ab7e40eecdd1102d87bbd38ee0a3
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets
arkts
给我一个字符串。我还你一个数组。
export function stringToArr(str: string, spa: string) { return str.split(spa) }
AST#export_declaration#Left export AST#function_declaration#Left function stringToArr 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 spa : AST#type_annotation#Left AST#prim...
export function stringToArr(str: string, spa: string) { return str.split(spa) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets#L48-L50
31e8f2d5f7949d3528e8e13ba071e4e0166734d8
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/entity/CroppedImage.ets
arkts
index属性存储切割图像对应的索引 构造函数,接受一个PixelMap对象和一个整数索引作为参数
constructor(pixelMap: PixelMap, index: number) { this.pixelMap = pixelMap; this.index = index; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
constructor(pixelMap: PixelMap, index: number) { this.pixelMap = pixelMap; this.index = index; }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/entity/CroppedImage.ets#L7-L10
5ffa3c847981a4ee715313090526f0db3908cfdb
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
onDraw
子类必须实现绘制逻辑
abstract onDraw(canvas: drawing.Canvas, style: AxisRenderStyleConfig, current: number, calculator: IAxisLineCalculator): void;
AST#method_declaration#Left abstract onDraw AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left drawing . Canvas AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left style : AST#type_an...
abstract onDraw(canvas: drawing.Canvas, style: AxisRenderStyleConfig, current: number, calculator: IAxisLineCalculator): void;
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L174-L174
10d1b88b96c9e2a7fedb684ff27c4390df916a68
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/Geography.ets
arkts
Geographical coordinate conversion tool.
export class Geography { /** * The Mercator projection calculates the pixel coordinate system, which may have stretching errors. * * @param Latitude * @param Longitude * @returns pixelCoordinates. */ public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { // C...
AST#export_declaration#Left export AST#class_declaration#Left class Geography AST#class_body#Left { /** * The Mercator projection calculates the pixel coordinate system, which may have stretching errors. * * @param Latitude * @param Longitude * @returns pixelCoordinates. */ AST#method_declaration#Left...
export class Geography { public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { const yMin = Geography.MercatorY(Const.SOUTH_LATITUDE); const yMax = Geography.MercatorY(Const.NORTH_LATITUDE); const xFactor = Const.MAP_WIDTH / (Const.EAST_LONGITUDE - Const.WE...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/Geography.ets#L22-L55
71a646382463a617f3ecf010ef0e5d616255cfee
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/setting/AdviceView.ets
arkts
sendAdvice
发送反馈
private async sendAdvice() { // 1. 检查登录状态 if (!UserManager.shared.isLogin()) { Toast.showMessage($r('app.string.login_not_login')) setTimeout(()=>{ this.isShowLoginView = true }, 1000) return; } this.isLoading = true; // 2. 构建反馈内容 const adviceStr = await this.b...
AST#method_declaration#Left private async sendAdvice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 1. 检查登录状态 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left A...
private async sendAdvice() { if (!UserManager.shared.isLogin()) { Toast.showMessage($r('app.string.login_not_login')) setTimeout(()=>{ this.isShowLoginView = true }, 1000) return; } this.isLoading = true; const adviceStr = await this.buildAdviceContent(); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/AdviceView.ets#L175-L199
11e50c908e6ff8ab16afd8cefb391b873d471e3e
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
arkts
generateAESKey
生成AES的对称密钥-默认base64 @param resultCoding 生成AES秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns AES密钥
static generateAESKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.generateSymKey('AES256', resultCoding); }
AST#method_declaration#Left static generateAESKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres...
static generateAESKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.generateSymKey('AES256', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L61-L63
e980a052038d5cd1be7fd51a735bae8a5b0a227e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Should be called when a tab is about to intercept a loading request. For a Web in main window, the pk field is required. For a Web in a popup, please ignore pk. @param pk The tab_info_packed. @param storage The LocalStorage. @param event The OnLoadInterceptEvent.
export function on_load_intercept(pk: tab_info_packed | undefined, storage: LocalStorage, event: OnLoadInterceptEvent) { let intercept = false; if (event) { let url: string = event.data.getRequestUrl(); if (url.substring(0, 5) == 'data:') { // Do not intercept data: intercept = false; } else...
AST#export_declaration#Left export AST#function_declaration#Left function on_load_intercept AST#parameter_list#Left ( AST#parameter#Left pk : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left tab_info_packed AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#...
export function on_load_intercept(pk: tab_info_packed | undefined, storage: LocalStorage, event: OnLoadInterceptEvent) { let intercept = false; if (event) { let url: string = event.data.getRequestUrl(); if (url.substring(0, 5) == 'data:') { intercept = false; } else if (url.substring(0, 5) ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L367-L391
c90d0623468f0ca4a74fc68a898dc745adad7ecd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource { private dataArray: ProductInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: ProductInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } /** * 获取索引对应的数据 * @pa...
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ProductInfo [ ]...
export class WaterFlowDataSource implements IDataSource { private dataArray: ProductInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: ProductInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } public getData(index: nu...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets#L21-L183
2b996385996e02ee4964eb473cc2084b289d2485
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets
arkts
onItemClicked
点击提示列表/历史记录进入范例页
private onItemClicked(): void { this.geometryId = 'search'; animateTo({ curve: Curve.Ease, duration: 20 }, () => { this.searchNewListData = []; this.isSearchPageShow = false; }) }
AST#method_declaration#Left private onItemClicked 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#assignment_exp...
private onItemClicked(): void { this.geometryId = 'search'; animateTo({ curve: Curve.Ease, duration: 20 }, () => { this.searchNewListData = []; this.isSearchPageShow = false; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L152-L161
7b34b4f949cb79461632e139ea38e0ff8f91a2de
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets
arkts
submitEdit
提交修改
async submitEdit() { try { if (!this.post.title || this.post.title.trim() === '') { promptAction.showToast({ message: '标题不能为空', duration: 2000 }); return; } if (!this.post.content || this.post.content.trim() === '') { promptAction.showToas...
AST#method_declaration#Left async submitEdit 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_...
async submitEdit() { try { if (!this.post.title || this.post.title.trim() === '') { promptAction.showToast({ message: '标题不能为空', duration: 2000 }); return; } if (!this.post.content || this.post.content.trim() === '') { promptAction.showToas...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L418-L503
c2a9724424c22f8b07a6377ccf4e050349f90c10
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/Book.ets
arkts
BaseDict.ts
export class BaseDict { dictId : number | null = null dictName : string | null = null textDb : string | null = null golds : number | null = null desciption : string | null = null static equals(lhs: BaseDict, rhs: BaseDict): boolean { return lhs.dictId === rhs.dictId } ...
AST#export_declaration#Left export AST#class_declaration#Left class BaseDict AST#class_body#Left { AST#property_declaration#Left dictId AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Rig...
export class BaseDict { dictId : number | null = null dictName : string | null = null textDb : string | null = null golds : number | null = null desciption : string | null = null static equals(lhs: BaseDict, rhs: BaseDict): boolean { return lhs.dictId === rhs.dictId } ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/Book.ets#L45-L71
bdfac7e1cb4b8aa145c4e1654d83553ab671a76b
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/VoiceUDPClient.ets
arkts
send
应用ArkTS约束:明确返回类型(约束45)
send(packet: Buffer): Promise<Buffer> { return new Promise((resolve, reject) => { if (!this.socket) throw new Error('No socket available'); if (!this.discordAddress || !this.discordPort) throw new Error('Invalid address/port'); this.socket.send(packet, this.discordPort, this.discordAddress,...
AST#method_declaration#Left send AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left Buffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#...
send(packet: Buffer): Promise<Buffer> { return new Promise((resolve, reject) => { if (!this.socket) throw new Error('No socket available'); if (!this.discordAddress || !this.discordPort) throw new Error('Invalid address/port'); this.socket.send(packet, this.discordPort, this.discordAddress,...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/VoiceUDPClient.ets#L53-L62
68ea60c883da980b7adfd7b250259406de124275
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
性别枚举
export enum Gender { MALE = 'male', FEMALE = 'female', UNKNOWN = 'unknown' }
AST#export_declaration#Left export AST#enum_declaration#Left enum Gender AST#enum_body#Left { AST#enum_member#Left MALE = AST#expression#Left 'male' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left FEMALE = AST#expression#Left 'female' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left U...
export enum Gender { MALE = 'male', FEMALE = 'female', UNKNOWN = 'unknown' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L51-L55
614955883909956e4640386dc23434df27553eb5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
onFilterChange
筛选变更处理
private onFilterChange(type: string, value: string): void { if (type === 'style') { this.selectedStyle = value; } else if (type === 'occasion') { this.selectedOccasion = value; } this.showFilterMenu = false; this.applyFilters(); }
AST#method_declaration#Left private onFilterChange AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
private onFilterChange(type: string, value: string): void { if (type === 'style') { this.selectedStyle = value; } else if (type === 'occasion') { this.selectedOccasion = value; } this.showFilterMenu = false; this.applyFilters(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L100-L108
97885209d91893838ae616984de7a654f18b7e62
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SubscriptionPage.ets
arkts
smartRefresh
智能刷新逻辑 新订阅1分钟内每5秒刷新,之后每2小时刷新一次 跳过已标记为获取失败的播客
async smartRefresh() { try { // 获取最新的播客列表 const podcasts = await this.podcastService.getSubscribedPodcasts(); for (const podcast of podcasts) { // 跳过已标记为获取失败的播客 if (podcast.isFetchFailed) { continue; } // 检查是否需要刷新 if (podcast.needsR...
AST#method_declaration#Left async smartRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 获取最新的播客列表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left podcasts = AST#expressi...
async smartRefresh() { try { const podcasts = await this.podcastService.getSubscribedPodcasts(); for (const podcast of podcasts) { if (podcast.isFetchFailed) { continue; } if (podcast.needsRefresh()) { console.info(`[Su...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SubscriptionPage.ets#L46-L74
56ff92cc4c2aee526bce98b5699383860b130035
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageUpdate.ets
arkts
handle
应用规则1: 显式声明方法参数类型和返回类型
handle(data: Object): { old: Object | null, updated: Object | null } { const client = this.client; // 应用规则14: 使用Map的get方法代替索引签名访问 const channel = client.channels.get(data['channel_id']); if (channel) { const message = channel.messages.get(data['id']); if (message) { message.patch(da...
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : 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#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#...
handle(data: Object): { old: Object | null, updated: Object | null } { const client = this.client; const channel = client.channels.get(data['channel_id']); if (channel) { const message = channel.messages.get(data['id']); if (message) { message.patch(data); client.e...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageUpdate.ets#L7-L34
b6beda52fd6b8a48acf70ffbe833867b1d20bada
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets
arkts
The style of BalanceComponent.
export class BalanceStyle { /** * The layout weight of BalanceComponent. */ static readonly LAYOUT_WEIGHT: number = 1; };
AST#export_declaration#Left export AST#class_declaration#Left class BalanceStyle AST#class_body#Left { /** * The layout weight of BalanceComponent. */ AST#property_declaration#Left static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Righ...
export class BalanceStyle { static readonly LAYOUT_WEIGHT: number = 1; };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L90-L95
88d79c9e6217db4a6f4a36a35be380478d321862
gitee
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/07.svg图标.ets
arkts
@State message: string = 'Hello World123';
build() { // build里面只能有一个容器组件 // 使用space控制组件间的距离 Column({ space: 20 }) { Image($r('app.media.ic_gallery_create')) .width(50) // 用于修改svg图标的颜色 .fillColor(Color.Red) } .padding(20) }
AST#build_method#Left build ( ) AST#build_body#Left { // build里面只能有一个容器组件 // 使用space控制组件间的距离 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_paramete...
build() { Column({ space: 20 }) { Image($r('app.media.ic_gallery_create')) .width(50) .fillColor(Color.Red) } .padding(20) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/07.svg图标.ets#L8-L18
a1d53fb69fc480e072f16a5942de5433e74f1643
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets
arkts
getPieces
MARK: - Utils for Plan 获取转换后的 Pieces
async getPieces(): Promise<Piece[]> { const piecesSet = new Set<Piece>(); const dbPieces = await this.dbPieces(); dbPieces.forEach(dbPiece => { const pieceNo = dbPiece.pieceNo; const wordId = dbPiece.wordId; if (pieceNo != null && wordId) { const existed = Array.from(piecesSet).fi...
AST#method_declaration#Left async getPieces AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Piece [ ] AST#array_type#Right AST#primary_type#Rig...
async getPieces(): Promise<Piece[]> { const piecesSet = new Set<Piece>(); const dbPieces = await this.dbPieces(); dbPieces.forEach(dbPiece => { const pieceNo = dbPiece.pieceNo; const wordId = dbPiece.wordId; if (pieceNo != null && wordId) { const existed = Array.from(piecesSet).fi...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L63-L81
11ded811e142624aedbc9908a5562c11b57d61fe
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider24.ets
arkts
buildSlider24
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 l...
@Builder function buildSlider24(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider24 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
@Builder function buildSlider24(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider24.ets#L16-L67
e1323b7d027092707f289d94f5a9f25769de4040
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getCityByNameSync
根据省名获取下面的市 @param provinceName 省名 @returns
static getCityByNameSync(provinceName: string): Array<AreaEntity> { let list = AreaHelper.getAreaSync(); for (let index = 0; index < list.length; index++) { if (provinceName == list[index].text) { return list[index].children ?? [] } } return []; }
AST#method_declaration#Left static getCityByNameSync AST#parameter_list#Left ( AST#parameter#Left provinceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
static getCityByNameSync(provinceName: string): Array<AreaEntity> { let list = AreaHelper.getAreaSync(); for (let index = 0; index < list.length; index++) { if (provinceName == list[index].text) { return list[index].children ?? [] } } return []; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L78-L86
2ee1f627e572c2450fa583be39bf6ea0f4f2978e
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/util/TextInputUtils.ets
arkts
根据字符生成md5, @param message 输入字符 @returns md5值
export function getMd5(message: string): string { let md = cryptoFramework.createMd('MD5'); // 数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制。 md.updateSync({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) }); let mdResult = md.digestSync(); return mdResult.data.toString() }
AST#export_declaration#Left export AST#function_declaration#Left function getMd5 AST#parameter_list#Left ( AST#parameter#Left message : 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#pri...
export function getMd5(message: string): string { let md = cryptoFramework.createMd('MD5'); md.updateSync({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) }); let mdResult = md.digestSync(); return mdResult.data.toString() }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/TextInputUtils.ets#L73-L79
cff2f9e8fcffe52a3fcd5fddbb85cd11b8219f31
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets
arkts
callFilePickerSaveFile
另存为
async callFilePickerSaveFile(fileName: string): Promise<void> { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); DocumentSaveOptions.newFileNames = [fileName]; let documentPicker = new picker.DocumentViewPicker(); documentPicker.save(DocumentSaveOptions).then(async (Document...
AST#method_declaration#Left async callFilePickerSaveFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
async callFilePickerSaveFile(fileName: string): Promise<void> { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); DocumentSaveOptions.newFileNames = [fileName]; let documentPicker = new picker.DocumentViewPicker(); documentPicker.save(DocumentSaveOptions).then(async (Document...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L120-L139
81b42b083d5a3e091427a975015504c2c227da02
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIBasicComponents/entry/src/main/ets/pages/Index.ets
arkts
NavigationToolbar
自定义一个Toolbar组件
@Builder NavigationToolbar() { Row() { Text("首页").fontSize(25).margin({ left: 70 }) Text("+").fontSize(25).margin({ left: 70 }) Text("我").fontSize(25).margin({ left: 70 }) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NavigationToolbar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_e...
@Builder NavigationToolbar() { Row() { Text("首页").fontSize(25).margin({ left: 70 }) Text("+").fontSize(25).margin({ left: 70 }) Text("我").fontSize(25).margin({ left: 70 }) } }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIBasicComponents/entry/src/main/ets/pages/Index.ets#L774-L780
4c7989c853723aaf9b26a2436d6c383209201d36
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/web/WebSearchService.ets
arkts
价格区间选项
export interface PriceRangeOption { label: string; min: number; max: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PriceRangeOption AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left min : AST#type_annotation#L...
export interface PriceRangeOption { label: string; min: number; max: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L12-L16
ee994471d17e8b5c032a81568ed56e77dc61a91d
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/KMP.ets
arkts
computeLPS
计算最长前缀后缀数组 (LPS) @param pattern 模式串 @returns LPS 数组
private static computeLPS(pattern: string): number[] { const lps: number[] = new Array(pattern.length).fill(0); let len = 0; let i = 1; while (i < pattern.length) { if (pattern[i] === pattern[len]) { len++; lps[i] = len; i++; } else { if (len !== 0) { ...
AST#method_declaration#Left private static computeLPS AST#parameter_list#Left ( AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_ty...
private static computeLPS(pattern: string): number[] { const lps: number[] = new Array(pattern.length).fill(0); let len = 0; let i = 1; while (i < pattern.length) { if (pattern[i] === pattern[len]) { len++; lps[i] = len; i++; } else { if (len !== 0) { ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L46-L67
1a1fb8cbc960bb0042f883e76f45c1679f1319ee
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets
arkts
calculateData
获取对应id的组件相对窗口左上角的属性
calculateData(id: string): AnimationInfo { let itemInfo: RectInfoInPx = ComponentAttrUtils.getRectInfoById(WindowUtils.window.getUIContext(), id); // 首先计算图片的宽高与窗口宽高的比例 let widthScaleRatio = itemInfo.width / WindowUtils.windowWidthPx; let heightScaleRatio = itemInfo.height / WindowUtils.windowHeigh...
AST#method_declaration#Left calculateData 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#type_annotation#Left AST#primary_type#Left AnimationInfo AST#primary_typ...
calculateData(id: string): AnimationInfo { let itemInfo: RectInfoInPx = ComponentAttrUtils.getRectInfoById(WindowUtils.window.getUIContext(), id); let widthScaleRatio = itemInfo.width / WindowUtils.windowWidthPx; let heightScaleRatio = itemInfo.height / WindowUtils.windowHeightPx; let isUseWi...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets#L110-L146
852304b04853942598cdcff2fbbb92ce342ad6c5
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
isNotNull
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotNull(str: string | undefined | null) { return false == StringUtils.isNull(str); }
AST#method_declaration#Left static isNotNull AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Rig...
static isNotNull(str: string | undefined | null) { return false == StringUtils.isNull(str); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L29-L31
ec4b855746033030409ee33e0913c8ceff28fb91
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/LunarTypes.ets
arkts
农历日期信息
export interface LunarDate { // 农历年份 year: number; // 农历月份 month: number; // 农历日期 day: number; // 是否闰月 isLeapMonth: boolean; // 农历年份文字描述(如:二○二五年) yearText: string; // 农历月份文字描述(如:正月、腊月) monthText: string; // 农历日期文字描述(如:初一、十五) dayText: string; // 完整农历描述 fullText: string; // 生肖 zodiac: ...
AST#export_declaration#Left export AST#interface_declaration#Left interface LunarDate AST#object_type#Left { // 农历年份 AST#type_member#Left year : 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 month : AST#type_an...
export interface LunarDate { year: number; month: number; day: number; isLeapMonth: boolean; 文字描述(如:二○二五年) yearText: string; 文字描述(如:正月、腊月) monthText: string; 文字描述(如:初一、十五) dayText: string; fullText: string; zodiac: string; ganZhi: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/LunarTypes.ets#L9-L30
23f53f94e9e5bdcfb62d28c222f5eea7323c91b8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets
arkts
toSecondAbilitySecond
Navigate to the Second Page of SecondAbility. @param context Context of EntryAbility. @param callback Execute the result callback function.
toSecondAbilitySecond(context: common.UIAbilityContext, callback: (abilityResult: common.AbilityResult) => void) { let want: Want = { 'deviceId': '', 'bundleName': CommonConstants.BUNDLE_NAME, 'abilityName': CommonConstants.SECOND_ABILITY_NAME, 'moduleName': CommonConstants.DEVICE_MODULE_NAM...
AST#method_declaration#Left toSecondAbilitySecond AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cal...
toSecondAbilitySecond(context: common.UIAbilityContext, callback: (abilityResult: common.AbilityResult) => void) { let want: Want = { 'deviceId': '', 'bundleName': CommonConstants.BUNDLE_NAME, 'abilityName': CommonConstants.SECOND_ABILITY_NAME, 'moduleName': CommonConstants.DEVICE_MODULE_NAM...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets#L75-L99
8dc6ec91c7729081eb0d31b5a70bc8c246afe8d2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
TODO:步骤五: 移除abilityID对应的UIContext,建议在EntryAbility中的onWindowStageDestroy中执行 @param abilityID
export function removeUIContext(abilityID: string): void { if (etswrapper !== undefined && etswrapper.removeUIContext !== undefined) { etswrapper.removeUIContext(abilityID); } }
AST#export_declaration#Left export AST#function_declaration#Left function removeUIContext AST#parameter_list#Left ( AST#parameter#Left abilityID : 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#L...
export function removeUIContext(abilityID: string): void { if (etswrapper !== undefined && etswrapper.removeUIContext !== undefined) { etswrapper.removeUIContext(abilityID); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L156-L160
cab19d711901744a1366aaa1b89dba958d9de8fa
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/PodcastService.ets
arkts
resetPodcastFetchStatus
重置播客获取失败状态(允许重新刷新)
async resetPodcastFetchStatus(podcastId: string): Promise<void> { await this.dbService.updatePodcastFetchStatus(podcastId, false); console.info(`[PodcastService] Reset fetch status for podcast: ${podcastId}`); }
AST#method_declaration#Left async resetPodcastFetchStatus AST#parameter_list#Left ( AST#parameter#Left podcastId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge...
async resetPodcastFetchStatus(podcastId: string): Promise<void> { await this.dbService.updatePodcastFetchStatus(podcastId, false); console.info(`[PodcastService] Reset fetch status for podcast: ${podcastId}`); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L175-L178
d17fcb744071cbdaa6dcf838685e19a8fc702e51
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
arkts
@memo
export function hookProgressContentModifier( receiver: ArkProgressComponent, value?: ContentModifier<ProgressConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const progressBuilder = (parentNode: KPointer, config: ProgressConfiguration): KPointer ...
AST#export_declaration#Left export AST#function_declaration#Left function hookProgressContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkProgressComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left valu...
export function hookProgressContentModifier( receiver: ArkProgressComponent, value?: ContentModifier<ProgressConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const progressBuilder = (parentNode: KPointer, config: ProgressConfiguration): KPointer ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L146-L159
417984a4638383248b7f9d96aa27390ac7a795a6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListInfo.ets
arkts
ListInfo
列表信息,包括图标、名字、是否可见 icon: 列表项图标 name: 列表项名称
@Observed export class ListInfo { public icon: ResourceStr = ''; public name: ResourceStr = ''; constructor(icon: ResourceStr = '', name: ResourceStr = '') { this.icon = icon; this.name = name; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ListInfo AST#class_body#Left { AST#property_declaration#Left public icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#express...
@Observed export class ListInfo { public icon: ResourceStr = ''; public name: ResourceStr = ''; constructor(icon: ResourceStr = '', name: ResourceStr = '') { this.icon = icon; this.name = name; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListInfo.ets#L21-L30
00ef975c49cdd3d7eb9728520709f596b53842b4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/CalendarPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'CalendarPage aboutToAppear'); this.initializePage(); }
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, 'CalendarPage aboutToAppear'); this.initializePage(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/CalendarPage.ets#L60-L63
b75b682013f0ae6c4629b6371221e8cea7daebc3
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Gets the storage of a zone with alias. @param alias The alias. @returns The LocalStorage or undefined.
export function storage_of_zone(alias: string) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; for (let index = 0; index < windowStorages.length; index++) { let s = windowStorages[index]; if (s.get('is_zone') as boolean && s.get('my_window_alias') as string == alias) { retur...
AST#export_declaration#Left export AST#function_declaration#Left function storage_of_zone AST#parameter_list#Left ( AST#parameter#Left alias : 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 { ...
export function storage_of_zone(alias: string) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; for (let index = 0; index < windowStorages.length; index++) { let s = windowStorages[index]; if (s.get('is_zone') as boolean && s.get('my_window_alias') as string == alias) { retur...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L269-L278
3618d7db8685b90f8894ad60f0c2caf5e98f28fb
gitee