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
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
setLoadingContent
更改全局默认loading的提示内容 @param content @returns
setLoadingContent(content: string): EfRcp { efRcpConfig.loading.content = content; return this; }
AST#method_declaration#Left setLoadingContent AST#parameter_list#Left ( AST#parameter#Left content : 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 EfRcp AST#primary_ty...
setLoadingContent(content: string): EfRcp { efRcpConfig.loading.content = content; return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L399-L402
c7e7fd45ff900ddf86981536cc8edfc59838c8c3
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets
arkts
updateAccountInput
更新账号输入 @param {string} value - 输入内容 @returns {void} 无返回值
updateAccountInput(value: string): void { this.accountInput = value; }
AST#method_declaration#Left updateAccountInput AST#parameter_list#Left ( AST#parameter#Left value : 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...
updateAccountInput(value: string): void { this.accountInput = value; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets#L30-L32
ac41351663b45f6180372dad2b470b2002590974
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
encodePKCS1
加密 @param str 待加密的字符串 @param pubKey RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static encodePKCS1(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
AST#method_declaration#Left static encodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static encodePKCS1(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L56-L59
788e212617e8b8f65991211f74b7509d2cb7a3e8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
算法类型枚举
export enum AlgorithmType { COLLABORATIVE_FILTERING = 'collaborative_filtering', CONTENT_BASED = 'content_based', HYBRID = 'hybrid', DEEP_LEARNING = 'deep_learning', KNOWLEDGE_BASED = 'knowledge_based', DEMOGRAPHIC = 'demographic' }
AST#export_declaration#Left export AST#enum_declaration#Left enum AlgorithmType AST#enum_body#Left { AST#enum_member#Left COLLABORATIVE_FILTERING = AST#expression#Left 'collaborative_filtering' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CONTENT_BASED = AST#expression#Left 'content_based' AST#expr...
export enum AlgorithmType { COLLABORATIVE_FILTERING = 'collaborative_filtering', CONTENT_BASED = 'content_based', HYBRID = 'hybrid', DEEP_LEARNING = 'deep_learning', KNOWLEDGE_BASED = 'knowledge_based', DEMOGRAPHIC = 'demographic' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L195-L202
6c7ce5f9112b364653a4ea952116f451b0ee4823
github
jiwangyihao/FlameChase.git
446275e6972bd5f92a3c5b7eba354ca83d504594
entry/src/main/ets/utils/DesignSystem.ets
arkts
rgbToHsl
Converts an RGB color object to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. @param color The RGB color object {r, g, b} with values from 0-255. @returns The HSL representation {h, s, l} with values from 0-1.
static rgbToHsl(color: ColorRGB): ColorHSL { let r = color.r; let g = color.g; let b = color.b; r /= 255; g /= 255; b /= 255; const max = Math.max(r, g, b); const min = Math.min(r, g, b); let h = 0, s = 0, l = (max + min) / 2; if (max === min) { // achromatic (grayscale) ...
AST#method_declaration#Left static rgbToHsl AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ColorRGB AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ColorHSL AST#primary_t...
static rgbToHsl(color: ColorRGB): ColorHSL { let r = color.r; let g = color.g; let b = color.b; r /= 255; g /= 255; b /= 255; const max = Math.max(r, g, b); const min = Math.min(r, g, b); let h = 0, s = 0, l = (max + min) / 2; if (max === min) { h = s = 0; } el...
https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/utils/DesignSystem.ets#L101-L131
ff4e33e9895fd749e98dd9a3961ec4df84241cb0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/constants/AppConstants.ets
arkts
日志相关常量
export class LogConstants { // 日志标签 static readonly TAG_APP = 'BirthdayReminder'; static readonly TAG_DATABASE = 'Database'; static readonly TAG_NETWORK = 'Network'; static readonly TAG_UI = 'UI'; static readonly TAG_NOTIFICATION = 'Notification'; static readonly TAG_AI = 'AI'; static readonly TAG_BACKU...
AST#export_declaration#Left export AST#class_declaration#Left class LogConstants AST#class_body#Left { // 日志标签 AST#property_declaration#Left static readonly TAG_APP = AST#expression#Left 'BirthdayReminder' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TAG_DATABASE =...
export class LogConstants { static readonly TAG_APP = 'BirthdayReminder'; static readonly TAG_DATABASE = 'Database'; static readonly TAG_NETWORK = 'Network'; static readonly TAG_UI = 'UI'; static readonly TAG_NOTIFICATION = 'Notification'; static readonly TAG_AI = 'AI'; static readonly TAG_BACKUP = 'Ba...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L288-L308
9ef5be58b23f2be0363fa4f32bbb0ef50cac3bee
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets
arkts
getJoinedTitleItemsByRemovingDuplications
/ 合并相同pos的翻译,并去重,返回 TitleItem 数组
static getJoinedTitleItemsByRemovingDuplications(srcTexts: string[], maxParts: number): TitleItem[] { const titleItems: TitleItem[] = []; for (const srcText of srcTexts) { const srcTextsSub = srcText.split("\n"); for (const srcTextSub of srcTextsSub) { if (srcTextSub.length === 0) continue;...
AST#method_declaration#Left static getJoinedTitleItemsByRemovingDuplications AST#parameter_list#Left ( AST#parameter#Left srcTexts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef...
static getJoinedTitleItemsByRemovingDuplications(srcTexts: string[], maxParts: number): TitleItem[] { const titleItems: TitleItem[] = []; for (const srcText of srcTexts) { const srcTextsSub = srcText.split("\n"); for (const srcTextSub of srcTextsSub) { if (srcTextSub.length === 0) continue;...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L180-L231
c5076ea9ced170811f4d36bfa86c678874b46ac1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
LunarCalendar_Fixed.ets
arkts
testFixedLunarCalculations
🧪 测试修复后的农历计算
public static testFixedLunarCalculations(): void { console.log("=== 🔧 修复后的农历计算测试 ==="); // 首先验证2025年数据一致性 console.log("\n📊 2025年数据验证:"); const isDataConsistent = AccurateLunarMonthDays.verify2025TotalDays(); if (!isDataConsistent) { console.error("❌ 数据不一致,需要进一步修正!"); return; ...
AST#method_declaration#Left public static testFixedLunarCalculations 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...
public static testFixedLunarCalculations(): void { console.log("=== 🔧 修复后的农历计算测试 ==="); console.log("\n📊 2025年数据验证:"); const isDataConsistent = AccurateLunarMonthDays.verify2025TotalDays(); if (!isDataConsistent) { console.error("❌ 数据不一致,需要进一步修正!"); return; } co...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L487-L541
e54a6ce048b78e60a564abb182de63fd56ec5ba7
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/pages/PersonInfo.ets
arkts
menuItem
分组菜单项
@Builder private menuItem(title: string) { Row() { Text(title) .fontSize(18) .fontWeight(FontWeight.Medium) .margin({ left: 16 }) Blank() Image($r('app.media.arrow_right')) .width(18).height(18) .margin({ right: 16 }) } .width("100%") .height(4...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private menuItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo...
@Builder private menuItem(title: string) { Row() { Text(title) .fontSize(18) .fontWeight(FontWeight.Medium) .margin({ left: 16 }) Blank() Image($r('app.media.arrow_right')) .width(18).height(18) .margin({ right: 16 }) } .width("100%") .height(4...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/PersonInfo.ets#L135-L150
e60939c2a3771bff8ef81015d7193f1ad50f3474
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropType.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export enum CropTouchState { /** * Crop state. */ NONE, /** * Move cropping frame. */ CROP_MOVE, /** * Move image. */ IMAGE_DRAG, /** * Scale image. */ IMAGE_SCALE }
AST#export_declaration#Left export AST#enum_declaration#Left enum CropTouchState AST#enum_body#Left { /** * Crop state. */ AST#enum_member#Left NONE AST#enum_member#Right , /** * Move cropping frame. */ AST#enum_member#Left CROP_MOVE AST#enum_member#Right , /** * Move image. */ AST#enum_member#Left IM...
export enum CropTouchState { NONE, CROP_MOVE, IMAGE_DRAG, IMAGE_SCALE }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropType.ets#L16-L36
5b5ca2a9af32c39167a34e7af52813ffa42373de
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets
arkts
getEntries
Returns the array of entries that this DataSet represents. @return
public getEntries(): JArrayList<T> { return this.mEntries; }
AST#method_declaration#Left public getEntries AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
public getEntries(): JArrayList<T> { return this.mEntries; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets#L153-L155
94f0ffb3fb3839c6e40966f02286e888049e79e9
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
importKey
模拟设备2导入设备1中的旧密钥
async importKey(): Promise<void> { let keyAlias = 'import_device_1_key_alias'; let importOptions: HuksProperties[] = new Array(); getImportKeyProperties(importOptions); let huksoptions: huks.HuksOptions = { properties: importOptions, inData: PLAIN_TEXT_SIZE_16 }; Logger.info(TAG, `ke...
AST#method_declaration#Left async importKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
async importKey(): Promise<void> { let keyAlias = 'import_device_1_key_alias'; let importOptions: HuksProperties[] = new Array(); getImportKeyProperties(importOptions); let huksoptions: huks.HuksOptions = { properties: importOptions, inData: PLAIN_TEXT_SIZE_16 }; Logger.info(TAG, `ke...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L532-L554
31f4ffc4b20cad87e14c354726edc6991d12cc00
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getSatisfactionStars
获取满意度星级显示
getSatisfactionStars(): string { return '★'.repeat(this.satisfactionScore) + '☆'.repeat(5 - this.satisfactionScore); }
AST#method_declaration#Left getSatisfactionStars AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expre...
getSatisfactionStars(): string { return '★'.repeat(this.satisfactionScore) + '☆'.repeat(5 - this.satisfactionScore); }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L237-L239
21cd08e08cdaaba205ef1b4342b01c21ae573802
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
getDateAfterDays
获取当前日期之后n天的日期
getDateAfterDays(days: number): CustomDate { return CustomDate.afterDays(days); }
AST#method_declaration#Left getDateAfterDays AST#parameter_list#Left ( AST#parameter#Left days : 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 CustomDate AST#primary_t...
getDateAfterDays(days: number): CustomDate { return CustomDate.afterDays(days); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L445-L447
32fbfbb3ad1c51bcd36f45104ec74955bb11365a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
buildEmptyView
构建空状态视图
@Builder buildEmptyView() { Column({ space: 12 }) { Image($r('app.media.ic_calendar_empty')) .width('48vp') .height('48vp') .fillColor($r('app.color.text_secondary')) Column({ space: 4 }) { Text(this.widgetData.emptyText || '本周无生日') .fontSize(14) .f...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para...
@Builder buildEmptyView() { Column({ space: 12 }) { Image($r('app.media.ic_calendar_empty')) .width('48vp') .height('48vp') .fillColor($r('app.color.text_secondary')) Column({ space: 4 }) { Text(this.widgetData.emptyText || '本周无生日') .fontSize(14) .f...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L171-L195
37f74f44ba16c5e9c178fce55f1d26fbf23b1ad3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollDetail.ets
arkts
refreshData
更新当前显示数据
refreshData() { const tempArr: number[] = []; for (let i = 0; i < DATA_CONFIG.NUMBER_LEN; i++) { tempArr.push(Math.floor(Math.random() * 10)); // 向数组添加随机数 } this.currentData = tempArr; // 更新当前数据 // 性能知识点:forEach场景下,每个列表项都会创建animateTo对象,要注意不能进行大数据量的遍历创建过多动画对象导致内存占用问题 this.currentData.forEac...
AST#method_declaration#Left refreshData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#pri...
refreshData() { const tempArr: number[] = []; for (let i = 0; i < DATA_CONFIG.NUMBER_LEN; i++) { tempArr.push(Math.floor(Math.random() * 10)); } this.currentData = tempArr; this.currentData.forEach((item: number, index: number) => { animateTo({ duration: Math.abs(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollDetail.ets#L46-L66
2cabf11d9be286978f9590890a7e03893ee68d33
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
arkts
onShowChanged
当侧滑返回时,恢复初始状态。 全屏模态窗口无法捕获返回键/右滑返回的事件, 所以监听全屏模态窗口显隐flag捕获返回事件
onShowChanged() { if (this.isShowSnapPopup === false) { this.closeSnapPopup(); } }
AST#method_declaration#Left onShowChanged 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_expression#Left AST#expression#Left this AST#expression#Rig...
onShowChanged() { if (this.isShowSnapPopup === false) { this.closeSnapPopup(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L306-L310
e8fe58ac9ac7b7f2c98ae47d918f47cbf10f1a57
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
repeal
撤销功能
async repeal(): Promise<void> { const pm: image.PixelMap = this.pixelMapQueue.pop() as PixelMap; if (pm !== null) { this.pixelMap = await copyPixelMap(pm); } }
AST#method_declaration#Left async repeal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments...
async repeal(): Promise<void> { const pm: image.PixelMap = this.pixelMapQueue.pop() as PixelMap; if (pm !== null) { this.pixelMap = await copyPixelMap(pm); } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L173-L178
e7136e1e0e5fdff3729bdac71c2237f706c921e1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets
arkts
rightAddressBuilder
右侧地址
@Builder rightAddressBuilder() { }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right rightAddressBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
@Builder rightAddressBuilder() { }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets#L64-L66
6577d9879b9993f7e25e3553870439bfdaab5702
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/FlowLocale.ets
arkts
from
Wraps a java.util.Locale and returns the FlorisLocale. @return The wrapped locale.
public static from(javaLocale: Locale): FlorisLocale { return new FlorisLocale(javaLocale); }
AST#method_declaration#Left public static from AST#parameter_list#Left ( AST#parameter#Left javaLocale : AST#type_annotation#Left AST#primary_type#Left Locale AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FlorisLocale AST...
public static from(javaLocale: Locale): FlorisLocale { return new FlorisLocale(javaLocale); }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L31-L33
7147bf6e4138529d59fe6f063074de5d880a0172
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/ImgSheetView.ets
arkts
ImgSheetBuilder
自定义半模态
@Builder export function ImgSheetBuilder(options: TISheetOptions) { ImgSheetView({ options: options }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ImgSheetBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TISheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
@Builder export function ImgSheetBuilder(options: TISheetOptions) { ImgSheetView({ options: options }) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/ImgSheetView.ets#L4-L7
03cd1d8cc5edc9526ee9d78dc991bb85ec321293
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
arkts
screenShotPopup
截图时预览小窗口弹窗。
@Builder screenShotPopup() { Column() { // 长截图未生成前显示提示语,生成后显示预览窗格 if (this.mergedImage) { this.previewWindow(); } else { // 提示截图中的弹窗 Text($r('app.string.web_page_snap_shot_web_snap_popup_prompt_snapshotting')) .backgroundColor($r('app.string.web_page_snap_shot_w...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right screenShotPopup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 长截图未生成前显示提...
@Builder screenShotPopup() { Column() { if (this.mergedImage) { this.previewWindow(); } else { Text($r('app.string.web_page_snap_shot_web_snap_popup_prompt_snapshotting')) .backgroundColor($r('app.string.web_page_snap_shot_web_snap_text_popup_backgroundcolor')...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L63-L95
5450468244c323bb6f568bfe30acc685716fa232
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/ColorUtils.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export namespace ColorUtils { export function red(color: number): number { return (color >> 16) & 0xFF; }
AST#export_declaration#Left export AST#ERROR#Left namespace ColorUtils { export AST#ERROR#Right AST#function_declaration#Left function red AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST...
export namespace ColorUtils { export function red(color: number): number { return (color >> 16) & 0xFF; }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/ColorUtils.ets#L15-L19
f2afd4cdef7e88646dc0479a36a095e89041c103
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets
arkts
FloorView
二楼滑动触发距离
@Component export struct FloorView { @Link mainPageOffsetY: number; // Y轴偏移量,下拉的距离 @State floorHeight: number = getScreenHeight(); // 二楼高度(初始值设置为屏幕高度) @Link immediatelyScale: Scale; // 设置动效组件缩放 @Link animationXLeft: number; // 左圆点平移距离 @Link animationXRight: number; // 右圆点平移距离 @Link roundSize: number; // 中心圆...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FloorView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mainPageOffsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a...
@Component export struct FloorView { @Link mainPageOffsetY: number; @State floorHeight: number = getScreenHeight(); @Link immediatelyScale: Scale; @Link animationXLeft: number; @Link animationXRight: number; @Link roundSize: number; @Link onShow: boolean; @Link miniAppScale: Scale; @State pack...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets#L30-L99
95f92f3dc45089f550b9aef7935c3164067d302a
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
drawMarkers
draws all MarkerViews on the highlighted positions
protected drawMarkers(canvas: CanvasRenderingContext2D): void { // if there is no marker view or drawing marker is disabled if (this.mMarker == null || !this.isDrawMarkersEnabled() || !this.valuesToHighlight() || !this.mIndicesToHighlight) return; for (let i: number = 0; i < this.mIndicesToHighlight...
AST#method_declaration#Left protected drawMarkers AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left...
protected drawMarkers(canvas: CanvasRenderingContext2D): void { if (this.mMarker == null || !this.isDrawMarkersEnabled() || !this.valuesToHighlight() || !this.mIndicesToHighlight) return; for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { let highlight: Highlight = this.mInd...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L248-L291
3a40f6906954055b066bab781dbc28737a43a7b6
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/recursive_function/recursive_function_001_T.ets
arkts
Introduction 递归函数
export function recursive_function_001_T(taint_src : string) { let t = recursiveFunc(taint_src,3); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function recursive_function_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stat...
export function recursive_function_001_T(taint_src : string) { let t = recursiveFunc(taint_src,3); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/recursive_function/recursive_function_001_T.ets#L6-L9
40d7bc172d9dbaa2b1dd681b4c1e83c91ce0b450
github
meltsama/Arkts_HarmonyOS_App.git
546adabde1c0f2e9abb988dd26c5722f4f0e2514
version_1/entry/src/main/ets/pages/manage.ets
arkts
aboutToAppear
<>泛型 生命周期函数
aboutToAppear(): void { for (let index = 1; index <= 2; index++) { //push表示在数组中添加元素 this.abc.push(index); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_...
aboutToAppear(): void { for (let index = 1; index <= 2; index++) { this.abc.push(index); } }
https://github.com/meltsama/Arkts_HarmonyOS_App.git/blob/546adabde1c0f2e9abb988dd26c5722f4f0e2514/version_1/entry/src/main/ets/pages/manage.ets#L11-L16
9c27982cb36ce169b9b3a4abb1657794ba39808c
github
huazheleyoushang/harmony_template.git
9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8
entry/src/main/ets/components/CustomDialog.ets
arkts
styleColumn
@title 标题 @description 自定义弹窗组件 @author Asren @message 文案描述
@Extend(Column) function styleColumn() { .padding({ top: 16 }) .width(280) .borderRadius(24) .backgroundColor("#fff") }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Column AST#expression#Right ) AST#decorator#Right function styleColumn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#obj...
@Extend(Column) function styleColumn() { .padding({ top: 16 }) .width(280) .borderRadius(24) .backgroundColor("#fff") }
https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/components/CustomDialog.ets#L9-L15
8a2374167862b6e535163047cfbb0b697e7c3947
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
getLastUIContext
获取当前应用内最上层的子窗口的UIContext @returns
static async getLastUIContext(): Promise<UIContext> { const lastWindow = await window.getLastWindow(DialogHelper.getUIAbilityContext()); return lastWindow.getUIContext(); }
AST#method_declaration#Left static async getLastUIContext 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 UIContext AST#primary_type#Right AST#type_annotation#Righ...
static async getLastUIContext(): Promise<UIContext> { const lastWindow = await window.getLastWindow(DialogHelper.getUIAbilityContext()); return lastWindow.getUIContext(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L111-L114
0622579674d6900684bb9703e70772b531abfa40
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
startNewConversation
开始新对话
async startNewConversation(userId: string = 'default'): Promise<string> { try { const sessionId = `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; const context: ConversationContext = { sessionId, userId, entities: {}, history: [], userPr...
AST#method_declaration#Left async startNewConversation AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'default' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
async startNewConversation(userId: string = 'default'): Promise<string> { try { const sessionId = `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; const context: ConversationContext = { sessionId, userId, entities: {}, history: [], userPr...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L316-L347
6e06967a08056bc54696cc769f3457e769fd2dac
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeader.d.ets
arkts
Declare type SymbolOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12 Declare type SymbolOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare class SymbolOptions { /** * The size of symbol icon. * @type { ?(number | string | Resource) }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * The size of symbol icon. * @type { ?(number | string | Resource) }. * @syscap SystemCapability.A...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class SymbolOptions AST#class_body#Left { /** * The size of symbol icon. * @type { ?(number | string | Resource) }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ /** * ...
export declare class SymbolOptions { fontSize?: number | string | Resource; fontColor?: Array<ResourceColor>; fontWeight?: number | FontWeight | string; effectStrategy?: SymbolEffectStrategy; renderingStrategy?: SymbolRenderingStrategy; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeader.d.ets#L374-L459
d31b48c2ab45af7f0cad38baad692d5d4c96d4a9
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
parseDate
解析日期字符串 YYYY-MM-DD
static parseDate(dateStr: string): Date { const parts = dateStr.split('-') return new Date(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2])) }
AST#method_declaration#Left static parseDate AST#parameter_list#Left ( AST#parameter#Left dateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type...
static parseDate(dateStr: string): Date { const parts = dateStr.split('-') return new Date(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2])) }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L129-L132
d7e078775f7a9499bfc679db80d7444b65ca1ff9
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
updateUserInfo
更新用户信息 @param {User} user - 新的用户信息 @returns {void} 无返回值 @example getUserState().updateUserInfo(new User({ nickName: "ArkUI" }));
updateUserInfo(user: User): void { this.userInfo = User.fromResponse(user); this.persist(); }
AST#method_declaration#Left updateUserInfo AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
updateUserInfo(user: User): void { this.userInfo = User.fromResponse(user); this.persist(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L57-L60
c7bcaf08fa8bedd94b1c7051bde4d563341e6cf9
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinCard/entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
onAddForm
添加卡片生命周期函数 router事件
onAddForm(want: Want) { // 获取当前添加到桌面的卡片id let formId: string = want.parameters![formInfo.FormParam.IDENTITY_KEY].toString() // 准备一个临时数据结构 存放formId 和数字 interface FromData { formId: string, count: number } // 准备初始化数据 let formData: FromData = { formId: formId, count: 1 ...
AST#method_declaration#Left onAddForm AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取当前添加到桌面的卡片id AST#statement#Left AST#variable_decla...
onAddForm(want: Want) { let formId: string = want.parameters![formInfo.FormParam.IDENTITY_KEY].toString() interface FromData { formId: string, count: number } let formData: FromData = { formId: formId, count: 1 } return formBindingData.createFormBindi...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinCard/entry/src/main/ets/entryformability/EntryFormAbility.ets#L7-L23
43bfb4617659ec85cb543b60628498f19530b661
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets
arkts
sendMsg2Server
发送数据到服务端
async sendMsg2Server(tcpSocket: socket.TCPSocket, msg: string) { let textEncoder = new util.TextEncoder(); let encodeValue = textEncoder.encodeInto(msg) let sendBuf = buffer.alloc(2 + encodeValue.byteLength) //写入固定包头中的长度信息 sendBuf.writeUInt16LE(encodeValue.byteLength) //写入可变包体信息 sendBuf.writ...
AST#method_declaration#Left async sendMsg2Server AST#parameter_list#Left ( AST#parameter#Left tcpSocket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPSocket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST...
async sendMsg2Server(tcpSocket: socket.TCPSocket, msg: string) { let textEncoder = new util.TextEncoder(); let encodeValue = textEncoder.encodeInto(msg) let sendBuf = buffer.alloc(2 + encodeValue.byteLength) sendBuf.writeUInt16LE(encodeValue.byteLength) sendBuf.write(msg, 2) await tcpS...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets#L122-L131
0d047bac9169734331f604e9fb1e5031cbc8add1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets
arkts
findClassIndex
根据二级列表索引值获取对应一级列表索引 @param {number} index - 二级列表索引值 @returns {number} 一级列表索引值
findClassIndex(index: number): number { let ans = 0; for (let i = 0; i < this.records.length; i++) { if (index >= this.records[i] && index < this.records[i + 1]) { ans = i; break; } } return ans; }
AST#method_declaration#Left findClassIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
findClassIndex(index: number): number { let ans = 0; for (let i = 0; i < this.records.length; i++) { if (index >= this.records[i] && index < this.records[i + 1]) { ans = i; break; } } return ans; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L231-L240
7cf6ae9bb0d05e19c6bd3b400a9c53d2d80872dc
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
allEmpty
判断所有消息是否都为空 @param messages 消息数组 @returns true 如果所有消息都为空 使用示例: ```typescript const people = [emptyPerson1, emptyPerson2] if (MessageUtils.allEmpty(people)) { console.log('All messages are empty') } ```
static allEmpty<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isEmpty()) }
AST#method_declaration#Left static allEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AS...
static allEmpty<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isEmpty()) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L272-L274
7254b64166261d39176d0cfa4e7d3dd72438c986
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人分组配置接口
export interface ContactGroupConfig { id: string; name: string; color: string; icon?: string; filter: ContactSearchParams; sortConfig?: SortConfig; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactGroupConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#L...
export interface ContactGroupConfig { id: string; name: string; color: string; icon?: string; filter: ContactSearchParams; sortConfig?: SortConfig; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L244-L251
618027aac423b05cd2530075b184af47b58ad239
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeTopBar.ets
arkts
HomeTopBar
@file 首页顶部标题栏组件 @author Joker.X
@ComponentV2 export struct HomeTopBar { /** * 搜索框点击回调 */ @Param onSearchTap: () => void = (): void => { }; /** * 左侧图标点击回调 */ @Param onLeftTap: () => void = (): void => { }; /** * 右侧图标点击回调 */ @Param onRightTap: () => void = (): void => { }; /** * 构建顶部标题栏 * @returns {voi...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeTopBar AST#component_body#Left { /** * 搜索框点击回调 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onSearchTap : AST#type_annotation#Left AST#function_type#Left AST#parameter_li...
@ComponentV2 export struct HomeTopBar { @Param onSearchTap: () => void = (): void => { }; @Param onLeftTap: () => void = (): void => { }; @Param onRightTap: () => void = (): void => { }; build() { IBestNavBar({ isShowRight: true, leftRightPadding: 12, isShowBorder:...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeTopBar.ets#L8-L95
5ee7ee77a0d6d25eec435bb4f97e5bcf64d3e4dc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets
arkts
评论数据类
export class Comment { id: number = 0; // 发布者名字 name: string = ""; // 发布者头像 avatar: ResourceStr = ""; // 发布时间 time: string = ""; // 发布的评论 comment: string = ""; // 发布的图片 images: ResourceStr[] = []; constructor(name: string, comment: string, avatar: ResourceStr, images: ResourceStr[], time: strin...
AST#export_declaration#Left export AST#class_declaration#Left class Comment AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 发布者...
export class Comment { id: number = 0; name: string = ""; avatar: ResourceStr = ""; time: string = ""; comment: string = ""; images: ResourceStr[] = []; constructor(name: string, comment: string, avatar: ResourceStr, images: ResourceStr[], time: string) { this.name = name; this.com...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets#L17-L37
2ec8b6a765243a3cd8306db6493d62a8009bafa1
gitee
queueit/harmony-sdk.git
ba7b4b38c03730bfbe305789acba6db0012d5f5c
entry/src/main/ets/pages/DemoPage.ets
arkts
initializeSdkEngine
--- End QueueListener ---
async initializeSdkEngine() { if (!this.validateAllInputs()) { promptAction.showToast({ message: "Please correct input fields." }); return false; } // Save inputs before initializing engine await this.saveDemoInputs(); const context = this.getUIContext()?...
AST#method_declaration#Left async initializeSdkEngine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! ...
async initializeSdkEngine() { if (!this.validateAllInputs()) { promptAction.showToast({ message: "Please correct input fields." }); return false; } await this.saveDemoInputs(); const context = this.getUIContext()?.getHostContext() as common.Context; ...
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/pages/DemoPage.ets#L178-L213
9b08a8639d8ba94a208222f56b84ff4ed386efc9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/MulticastWorker.ets
arkts
startMulticast
[Start application_transmits_data_via_multicast_socket]
function startMulticast(data: MulticastData) { let multicast: socket.MulticastSocket = socket.constructMulticastSocketInstance(); // 这里构造一个对象用于加入多播组 const multicastConfig: MulticastData = { address: data.address, port: data.port, family: data.family }; multicast.addMembership(multicastConfig).th...
AST#function_declaration#Left function startMulticast AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left MulticastData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variabl...
function startMulticast(data: MulticastData) { let multicast: socket.MulticastSocket = socket.constructMulticastSocketInstance(); const multicastConfig: MulticastData = { address: data.address, port: data.port, family: data.family }; multicast.addMembership(multicastConfig).then(() => { pos...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/MulticastWorker.ets#L42-L87
e7c27c2e5488976c2bd6f1ad56c142aea72dc236
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppColors.ets
arkts
深色模式颜色
export class DarkColors { // 主色 static readonly primary: string = '#2196F3'; static readonly primaryVariant: string = '#1976D2'; // 背景色 static readonly background: string = '#121212'; static readonly surface: string = '#1E1E1E'; static readonly surfaceVariant: string = '#2C2C2C'; // 文本色 static r...
AST#export_declaration#Left export AST#class_declaration#Left class DarkColors AST#class_body#Left { // 主色 AST#property_declaration#Left static readonly primary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2196F3' AST#expression#Right ;...
export class DarkColors { static readonly primary: string = '#2196F3'; static readonly primaryVariant: string = '#1976D2'; static readonly background: string = '#121212'; static readonly surface: string = '#1E1E1E'; static readonly surfaceVariant: string = '#2C2C2C'; static readonly onPrimary...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppColors.ets#L43-L77
ebf4db42ac041b725b94fb73309496bd15591672
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets
arkts
getNormalData
生成柱状图数据
private getNormalData(): BarData { const START: number = 0; const values: JArrayList<BarEntry> = new JArrayList<BarEntry>(); for (let i = START; i < this.calorieData.length; i++) { values.add(new BarEntry(i, this.calorieData[i])); } const dataSet: BarDataSet = new BarDataSet(values, CALORIE); ...
AST#method_declaration#Left private getNormalData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BarData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ...
private getNormalData(): BarData { const START: number = 0; const values: JArrayList<BarEntry> = new JArrayList<BarEntry>(); for (let i = START; i < this.calorieData.length; i++) { values.add(new BarEntry(i, this.calorieData[i])); } const dataSet: BarDataSet = new BarDataSet(values, CALORIE); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets#L144-L163
fa7a054b6e09f202b7cbf11b4428954bcbbddc2d
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
refreshNode
This interface is called when a secondaryTitle needs to be updated @param parentId ID of the parent node. @param parentSubTitle secondaryTitle of parent node. @param currentSubtitle secondaryTitle of current node. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 This interface is called when a secondaryTitle nee...
refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void;
AST#method_declaration#Left refreshNode AST#parameter_list#Left ( AST#parameter#Left parentId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left parentSubTitle : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#...
refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L580-L580
9f0a98433040492e5e902dea49d2b799c705143b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
init
构造方法,允许自定义参数
init() { if (this.totalSeconds && this.totalSeconds > 0) { this.currentSeconds = this.totalSeconds; this.getTimeDigits(this.currentSeconds); } }
AST#method_declaration#Left init 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_expression#Left AST#expression#Left AST#binary_expression#Left AST#e...
init() { if (this.totalSeconds && this.totalSeconds > 0) { this.currentSeconds = this.totalSeconds; this.getTimeDigits(this.currentSeconds); } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L43-L48
fb016fd947275ac91d4fa1783449814ce1f9794b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceSearch.d.ets
arkts
Events and styles supported by the search area. @typedef SearchParams @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export interface SearchParams { /** * Used to identify a unique search component. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ searchKey?: ResourceStr; /** * Indicates the background color of a component. * * @type { ?Resource...
AST#export_declaration#Left export AST#interface_declaration#Left interface SearchParams AST#object_type#Left { /** * Used to identify a unique search component. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#type_member#Left searchKey ? :...
export interface SearchParams { searchKey?: ResourceStr; componentBackgroundColor?: ResourceColor; pressedBackgroundColor?: ResourceColor; searchButton?: SearchButtonParams; placeholderColor?: ResourceColor; placeholderFont?: Font; textFont?: Font; textAlign?: TextAlign; cop...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L157-L531
5d1badd0dc26dc3c0d714f70b5224236358fbda6
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
getNumberByResourceId
get resource size @param resourceId resource id @param defaultValue default value @returns resource size
function getNumberByResourceId(resourceId: number, defaultValue: number, allowZero?: boolean): number { try { let sourceValue: number = resourceManager.getSystemResourceManager().getNumber(resourceId); if (sourceValue > 0 || allowZero) { return sourceValue; } else { return defaultValue; } ...
AST#function_declaration#Left function getNumberByResourceId AST#parameter_list#Left ( AST#parameter#Left resourceId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#...
function getNumberByResourceId(resourceId: number, defaultValue: number, allowZero?: boolean): number { try { let sourceValue: number = resourceManager.getSystemResourceManager().getNumber(resourceId); if (sourceValue > 0 || allowZero) { return sourceValue; } else { return defaultValue; } ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1617-L1631
1797757fe816cb6e8e831886858a5e4bf6d18efe
gitee
buqiuz/game-puzzle.git
605dc0fac0738466db308a8ba255b5e9094c52ac
entry/src/main/ets/pages/Login.ets
arkts
dealAllError
错误处理
dealAllError(error: BusinessError): void { hilog.error(this.domainId, this.logTag, `Failed to login, errorCode is ${error.code}, errorMessage is ${error.message}`); // TODO: 错误码处理,请参考API中的错误码根据实际情况处理 }
AST#method_declaration#Left dealAllError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError 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_typ...
dealAllError(error: BusinessError): void { hilog.error(this.domainId, this.logTag, `Failed to login, errorCode is ${error.code}, errorMessage is ${error.message}`); }
https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/pages/Login.ets#L217-L221
c6ba8748b5106c06380eccecdc43636727c9c0c8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/utils/CreateResourceConfig.ets
arkts
[Start inject_offline_resource] Call the offline resource injection cache interface
export async function injectOfflineResource(controller: WebviewController, resourceMapArr: Array<webview.OfflineResourceMap>): Promise<void> { try { controller.injectOfflineResources(resourceMapArr); } catch (err) { console.error("qqq injectOfflineResource error: " + err.code + " " + err.message); } }
AST#export_declaration#Left export AST#function_declaration#Left async function injectOfflineResource AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left WebviewController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resou...
export async function injectOfflineResource(controller: WebviewController, resourceMapArr: Array<webview.OfflineResourceMap>): Promise<void> { try { controller.injectOfflineResources(resourceMapArr); } catch (err) { console.error("qqq injectOfflineResource error: " + err.code + " " + err.message); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/utils/CreateResourceConfig.ets#L92-L98
595a80a4e51a3385431f6f2b52e052bb97dab8fd
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets
arkts
clearRecords
清除记录弹窗视图
@Builder clearRecords() { Row() { Text('确定要清空当前操作记录吗'); } .justifyContent(FlexAlign.Center) .width('100%'); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right clearRecords 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_elemen...
@Builder clearRecords() { Row() { Text('确定要清空当前操作记录吗'); } .justifyContent(FlexAlign.Center) .width('100%'); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L404-L411
df4f7826e775c4b45bc672ff0ef82187af31cc47
github
hackeris/HiSH
6485c7b24ee47727fe464dc3a69484f44689e85b
entry/src/main/ets/components/WebTerminal.ets
arkts
onData
60FPS (16.6ms)
private onData(ab: ArrayBuffer) { try { // 将收到的数据块加入队列 this.pendingChunks.push(new Uint8Array(ab)); // 如果没有正在等待的 Flush 任务,则调度一个 if (this.flushTimeoutID === undefined) { this.flushTimeoutID = setTimeout(() => { this.flushData(); }, this.FLUSH_INTERVAL); } ...
AST#method_declaration#Left private onData AST#parameter_list#Left ( AST#parameter#Left ab : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try...
private onData(ab: ArrayBuffer) { try { this.pendingChunks.push(new Uint8Array(ab)); if (this.flushTimeoutID === undefined) { this.flushTimeoutID = setTimeout(() => { this.flushData(); }, this.FLUSH_INTERVAL); } } catch (e) { hilog.error(DOMAIN, '...
https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/components/WebTerminal.ets#L342-L356
5515f3fbe6331129e96d9fd17589077403beaa2b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/ChatWithExpression.ets
arkts
dealImageResMsg
将聊天信息中的文字、表情分别解析为span、imageSpan @param strMessage 聊天内容, msgBase 聊天消息结构
dealImageResMsg(msgBase: MessageBase, strMessage: string): void { let strContent: string = ''; // 聊天内容 // TODO 知识点:循环解析聊天信息中的表情以及文字 let pos: number = strMessage.indexOf(EMOJI_RESOURCE); while (pos !== -1) { // 从pos后面找到.png所在位置 const posPng = strMessage.indexOf(EMOJI_SUFFIX, pos); // 获取...
AST#method_declaration#Left dealImageResMsg AST#parameter_list#Left ( AST#parameter#Left msgBase : AST#type_annotation#Left AST#primary_type#Left MessageBase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left strMessage : AST#type_annotation#Left AST#primary_type#Left string AST#p...
dealImageResMsg(msgBase: MessageBase, strMessage: string): void { let strContent: string = ''; let pos: number = strMessage.indexOf(EMOJI_RESOURCE); while (pos !== -1) { const posPng = strMessage.indexOf(EMOJI_SUFFIX, pos); strContent += strMessage.substring(0, pos); if...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/ChatWithExpression.ets#L159-L199
21a158631b1a9fb1e3712173446ebda6ced2a9ff
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
updateBindSheet
刷新自定义半模态
static updateBindSheet<T extends BaseSheetOptions>(dialogId: string, options: T, partialUpdate: boolean = false) { ActionBaseCore.getInstance().updateBindSheet(dialogId, options, partialUpdate); }
AST#method_declaration#Left static updateBindSheet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Le...
static updateBindSheet<T extends BaseSheetOptions>(dialogId: string, options: T, partialUpdate: boolean = false) { ActionBaseCore.getInstance().updateBindSheet(dialogId, options, partialUpdate); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L375-L377
2ea6eaa180a1b6e9831724b6c02d3cd02be30d10
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
notifyDataReload
通知控制器数据重新加载
notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); }
AST#method_declaration#Left notifyDataReload 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#express...
notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L85-L89
277dbf94f34852c2b189437eeb17f6142a89cb2f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets
arkts
univesal/properties/DisplaySample
export let locationTypes: ResourceObjectType[] = [ { value: $r('app.string.components_display_center') }, { value: $r('app.string.components_display_topstart') }, { value: $r('app.string.components_display_topend') }, { value: $r('app.string.components_display_top') }, { value: $r('app.string.comp...
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left locationTypes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceObjectType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [...
export let locationTypes: ResourceObjectType[] = [ { value: $r('app.string.components_display_center') }, { value: $r('app.string.components_display_topstart') }, { value: $r('app.string.components_display_topend') }, { value: $r('app.string.components_display_top') }, { value: $r('app.string.comp...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets#L271-L282
b2cfa3329013447b51d5332eac39f41eb2e4428f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PCProject/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
[Start available_area]
onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageCreate'); try { let mainWindow = windowStage.getMainWindowSync(); let displayId = mainWindow.getWindowProperties().di...
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
onWindowStageCreate(windowStage: window.WindowStage): void { hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageCreate'); try { let mainWindow = windowStage.getMainWindowSync(); let displayId = mainWindow.getWindowProperties().displayId; let displayClass = display.getDisplayByIdS...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PCProject/entry/src/main/ets/entryability/EntryAbility.ets#L41-L73
7f198497831fb4b316da03fa58c5e5f0ab413dba
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
IconGroupSuffix
Defines IconGroupSuffix. @interface IconGroupSuffix @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
@Component export declare struct IconGroupSuffix { /** * Suffix item. * * @type { Array<IconItemOptions | SymbolGlyphModifier> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ /** * Suffix item. * * @type { Arra...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct IconGroupSuffix AST#component_body#Left { /** * Suffix item. * * @type { Array<IconItemOptions | SymbolGlyphModifier> } * @syscap SystemCapability.ArkUI.ArkUI...
@Component export declare struct IconGroupSuffix { @Require @Prop items: Array<IconItemOptions | SymbolGlyphModifier | SymbolItemOptions>; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L561-L583
59a314a17ca770b4365eed327a76db47786e2008
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
arkts
signPKCS1
签名-PKCS1 @param str 需要签名的字符串 @param priKey 私钥 @returns string> 签名对象
static async signPKCS1(str: string, priKey: string): Promise<string> { return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024); }
AST#method_declaration#Left static async signPKCS1 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async signPKCS1(str: string, priKey: string): Promise<string> { return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L124-L126
4fb5dda604ee44e42e08fd8fb86b3b93da67d35c
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/viewModel/TimeBarModel.ets
arkts
set
Set the currently selected time and automatically clamp it within valid bounds. @param time New selected time (milliseconds).
set currentTime(time: number) { if (time <= 0) { return; } // ignore invalid time values const clampedTime = this.clampToBounds(time); if (this._currentTime === clampedTime) { return; } // do not trigger update if time hasn't changed this._currentTime = clampedTime; this.notify...
AST#method_declaration#Left set AST#ERROR#Left currentTime AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Le...
set currentTime(time: number) { if (time <= 0) { return; } const clampedTime = this.clampToBounds(time); if (this._currentTime === clampedTime) { return; } this._currentTime = clampedTime; this.notifyDataChange('currentTime'); }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L87-L99
becdab6882a8d5d197b6dcf199ced25ea4ef538e
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
ConfirmDialogBuilder
【系统】ConfirmDialog 确认弹窗 @param options
@Builder export function ConfirmDialogBuilder(options: IConfirmDialogOptions | IAlertDialogOptions) { if ((options as IConfirmDialogOptions).checkTips || (options as IConfirmDialogOptions).isChecked !== undefined || (options as IConfirmDialogOptions).onCheckedChange !== undefined) { ConfirmDialog(options as E...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ConfirmDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IConfirmDialogOptions AST#primary_type#Right | AST#primary_type#Left IAler...
@Builder export function ConfirmDialogBuilder(options: IConfirmDialogOptions | IAlertDialogOptions) { if ((options as IConfirmDialogOptions).checkTips || (options as IConfirmDialogOptions).isChecked !== undefined || (options as IConfirmDialogOptions).onCheckedChange !== undefined) { ConfirmDialog(options as E...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L91-L124
45799e898eb54f9e6edde1cb23a5cb97127002e5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets
arkts
实现页面加载所需要的对象,用于LazyForEach加载数据
export class KeyboardDataSource { private dataArray: string[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: string[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */...
AST#export_declaration#Left export AST#class_declaration#Left class KeyboardDataSource AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#express...
export class KeyboardDataSource { private dataArray: string[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: string[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } public getData(index: number): string { return this.da...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets#L20-L182
616f4d57e5eee5ec9a0456ec48500921e83aa865
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildJsonInput
构建JSON输入区域
@Builder buildJsonInput() { Column({ space: 12 }) { Text('粘贴JSON内容') .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) TextArea({ placeholder: '请粘贴JSON格式的联系人数据...', text: this.jsonContent }) .fontSize(14) .height('20...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildJsonInput AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para...
@Builder buildJsonInput() { Column({ space: 12 }) { Text('粘贴JSON内容') .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) TextArea({ placeholder: '请粘贴JSON格式的联系人数据...', text: this.jsonContent }) .fontSize(14) .height('20...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L438-L492
aa13cae6c7c426309d53323de8cca35807ec4ae2
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
@Author csx @DateTime 2024/3/19 21:42 @TODO CryptoUtil 加解密工具类
export class CryptoUtil { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @returns * @returns */ static async convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number) { let symKeyBlob: crypto.DataBlob = { data: S...
AST#export_declaration#Left export AST#class_declaration#Left class CryptoUtil AST#class_body#Left { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @returns * @returns */ AST#method_declaration#Left static async convertPubKeyFromStr AST#pa...
export class CryptoUtil { static async convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number) { let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.stringToByteArray(publicKey, keyName) }; let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = await aesGene...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L26-L407
55d7b836f91e336ecfaaead35908de818dead5ac
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/smartfill/src/main/ets/common/CommonConstants.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 CommonConstants { // toast停留时间 static readonly TOAST_DURATION: number = 2000; // 动画过渡时长 static readonly ANIMATION_DURATION = 200; // 分割线高度 static readonly DIVIDER_HEIGHT: number = 2; // 组件间距 static readonly SPACE_GAP_24 = 24; static readonly WIDTH_FULL = '100%'; static readonly HEIGHT_...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // toast停留时间 AST#property_declaration#Left static readonly TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2000 AST#expr...
export class CommonConstants { static readonly TOAST_DURATION: number = 2000; static readonly ANIMATION_DURATION = 200; static readonly DIVIDER_HEIGHT: number = 2; static readonly SPACE_GAP_24 = 24; static readonly WIDTH_FULL = '100%'; static readonly HEIGHT_FULL = '100%'; static readonl...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/smartfill/src/main/ets/common/CommonConstants.ets#L16-L78
d7c3da2d45242a4632c15f88953c8895a3caf9a0
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
getDate
年月日
getDate(): string { const DATETIME = new Date(); return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1, DATETIME.getDate()); }
AST#method_declaration#Left getDate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#...
getDate(): string { const DATETIME = new Date(); return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1, DATETIME.getDate()); }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L32-L35
408783a1d4f68330e5316f58d1e4c70812c8c714
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/anim/card/WaterFlowDataSource.ets
arkts
CardAttr
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Observed export class CardAttr { public isVisible: Visibility = Visibility.Visible; public alphaValue: number = 1; public scaleValue: number = 1; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class CardAttr AST#class_body#Left { AST#property_declaration#Left public isVisible : AST#type_annotation#Left AST#primary_type#Left Visibility AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member...
@Observed export class CardAttr { public isVisible: Visibility = Visibility.Visible; public alphaValue: number = 1; public scaleValue: number = 1; }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/anim/card/WaterFlowDataSource.ets#L16-L21
50b13850681ff9e0774b45331c3918f17f09e40d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
getNotificationStats
获取通知统计
public getNotificationStats(): NotificationStats { const stats: NotificationStats = { total: this.notifications.length, unread: 0, byType: {} as Record<NotificationType, number>, byPriority: {} as Record<NotificationPriority, number> }; this.notifications.forEach(notification => { ...
AST#method_declaration#Left public getNotificationStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NotificationStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_...
public getNotificationStats(): NotificationStats { const stats: NotificationStats = { total: this.notifications.length, unread: 0, byType: {} as Record<NotificationType, number>, byPriority: {} as Record<NotificationPriority, number> }; this.notifications.forEach(notification => { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L199-L217
d514ff8ce94497ab4368b633889d78efa5dc9365
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
save_tab_index_stats
Data statuses Saves current_main_tab_index and current_sub_tab_index to bunch_of_settings (lord) or disk (zone).
save_tab_index_stats(identifier: string) { let is_zone = this.my_storage!.get('is_zone') as boolean; let is_lord = (this.my_storage!.get('my_window_id') as string) == (AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string); // Store where am I if (is_zone) { sandbox_save(web_state_dir(this.my_stora...
AST#method_declaration#Left save_tab_index_stats AST#parameter_list#Left ( AST#parameter#Left identifier : 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_decl...
save_tab_index_stats(identifier: string) { let is_zone = this.my_storage!.get('is_zone') as boolean; let is_lord = (this.my_storage!.get('my_window_id') as string) == (AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string); if (is_zone) { sandbox_save(web_state_dir(this.my_storage!) + '/stat', thi...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L697-L712
3b44484eecc1c309ba5f038a5e096f8a184bfbf2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/patternlock/Index.ets
arkts
PatternLockMainPage
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { PatternLockMainPage } from './src/main/ets/components/PatternLockMainPage';
AST#export_declaration#Left export { PatternLockMainPage } from './src/main/ets/components/PatternLockMainPage' ; AST#export_declaration#Right
export { PatternLockMainPage } from './src/main/ets/components/PatternLockMainPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/patternlock/Index.ets#L15-L15
9dc080d8eb39bdcabd72ffecd12ead10efa52d52
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHA.ets
arkts
digest
SHA256摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digest(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA256'); }
AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
static async digest(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L50-L52
3e0019bf4a97b4297669ffcfe4259d28fc7ce45e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_lite.ets
arkts
index_from_index_month_file
Index from built index file. @param path the path of index file, for example, 'history-index/index_2002_12.txt'. @param context_filesDir getContext().filesDir.
static index_from_index_month_file(year: number, month: number, context_filesDir: string) { // Set year and month bunch_of_history_index_lite.this_year = year; bunch_of_history_index_lite.this_month = month; // Open the file let path = index_path_of_month(year, month); let imp = sandbox_read_te...
AST#method_declaration#Left static index_from_index_month_file 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...
static index_from_index_month_file(year: number, month: number, context_filesDir: string) { bunch_of_history_index_lite.this_year = year; bunch_of_history_index_lite.this_month = month; let path = index_path_of_month(year, month); let imp = sandbox_read_text_sync(path, context_filesDir); ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L70-L95
5e7ffa891d4166c86af73178d6dcc1970442bdc2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/PageRepository.ets
arkts
getGoodsDetail
获取商品详情 @param goodsId 商品ID @returns 商品详情
async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); }
AST#method_declaration#Left async getGoodsDetail AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/PageRepository.ets#L35-L37
64795743daced8c60909959e8efc50256ad3c1e5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AES.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param aesKey AES密钥 @returns
static async encodeECB(str: string, aesKey: string): Promise<string> { return CryptoUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256); }
AST#method_declaration#Left static async encodeECB 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async encodeECB(str: string, aesKey: string): Promise<string> { return CryptoUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L136-L138
5e6b1f5475ffe3df216bf36faf834e5011ab17e7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
物理配置接口
export interface PhysicsConfig { enabled: boolean; mass: number; friction: number; restitution: number; gravity: Vector3D; collisionShape: CollisionShape; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PhysicsConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left mass : AST#type_annotation#...
export interface PhysicsConfig { enabled: boolean; mass: number; friction: number; restitution: number; gravity: Vector3D; collisionShape: CollisionShape; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L155-L162
b6491200801dfabb8d74d3158ed551a21f52f32d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
registerDeviceListCallback
发现设备列表
function registerDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { localDeviceId = remoteDeviceModel.localDeviceId; deviceList.length = 0; for (var i = 0; i < remoteDeviceModel.deviceList.length; i++) { deviceList.push(remoteDeviceModel.deviceList[i].deviceId); } }); ...
AST#function_declaration#Left function registerDeviceListCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left remoteDeviceM...
function registerDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { localDeviceId = remoteDeviceModel.localDeviceId; deviceList.length = 0; for (var i = 0; i < remoteDeviceModel.deviceList.length; i++) { deviceList.push(remoteDeviceModel.deviceList[i].deviceId); } }); ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L29-L37
00cff143f5b23866378678f28523fdcf0ff7bd11
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FoldableGuilde/entry/src/main/ets/utils/WindowUtil.ets
arkts
getInstance
获取实例
static getInstance(): WindowUtil | undefined { if (!AppStorage.get<WindowUtil>('windowUtil')) { AppStorage.setOrCreate('windowUtil', new WindowUtil()); } return AppStorage.get<WindowUtil>('windowUtil'); }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left WindowUtil AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_f...
static getInstance(): WindowUtil | undefined { if (!AppStorage.get<WindowUtil>('windowUtil')) { AppStorage.setOrCreate('windowUtil', new WindowUtil()); } return AppStorage.get<WindowUtil>('windowUtil'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/utils/WindowUtil.ets#L26-L31
58bac5e86733b7a4f02d00a784cb812eada14e9c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/ArrayUtil.ets
arkts
setOrAppend
将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加 @param <T> 数组元素类型 @param buffer 已有数组 @param index 位置,大于长度追加,否则替换 @param value 新值 @return 新数组或原有数组
static setOrAppend<T>(buffer: T[], index: number, value: T): T[] { if (index < 0) { return [value, ...buffer]; } else if (index >= buffer.length) { return [...buffer, value]; } else { return buffer.map((item, i) => (i === index ? value : item)); } } /** * 将新元素插入到到已有数组中的某个位置<br>...
AST#method_declaration#Left static setOrAppend AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Ri...
static setOrAppend<T>(buffer: T[], index: number, value: T): T[] { if (index < 0) { return [value, ...buffer]; } else if (index >= buffer.length) { return [...buffer, value]; } else { return buffer.map((item, i) => (i === index ? value : item)); } } static replace<T>(buffer: T[...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ArrayUtil.ets#L101-L180
8a3963c1979c8e288d16e1d152078632b304e232
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/evenMoreLineCharts/RealtimePage.ets
arkts
menuCallback
标题栏菜单回调
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let barData = this.model.getLineData(); if (!bar...
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if ( AST#expression#Left ...
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let barData = this.model.getLineData(); if (!bar...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/evenMoreLineCharts/RealtimePage.ets#L46-L64
bf92bb2d518310e5cd016a88a428938df4933a09
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets
arkts
insertOrUpdateRecord
MARK: - 插入/更新操作 插入或更新录音记录 @param text - 录音文本 @param data - 录音数据(Uint8Array格式)
async insertOrUpdateRecord(text: string, data: Uint8Array): Promise<void> { if (!this.db || !text.trim()) return; // 1. 删除现有记录(如果存在) const sqlDelete = `DELETE FROM ${Tables.Record.name} WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1, LENGTH(${Tables.Record.Col.text}) - ${DB....
AST#method_declaration#Left async insertOrUpdateRecord AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#...
async insertOrUpdateRecord(text: string, data: Uint8Array): Promise<void> { if (!this.db || !text.trim()) return; const sqlDelete = `DELETE FROM ${Tables.Record.name} WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1, LENGTH(${Tables.Record.Col.text}) - ${DB.salt}) = ?`; ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L95-L117
8600e05afb8565eefe8e5b49992688d35d496b22
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/model/MenuType.ets
arkts
Copyright (c) 2022-2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
export interface MenuType { name: Resource; icon?: Resource; subController?: TabsController; subController_sm?: TabsController; subTitleList?: MenuType[]; menuContent?: string; isVisible?: boolean; parentNode?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MenuType AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left icon ? : AST#type_annotation#Left ...
export interface MenuType { name: Resource; icon?: Resource; subController?: TabsController; subController_sm?: TabsController; subTitleList?: MenuType[]; menuContent?: string; isVisible?: boolean; parentNode?: number; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/model/MenuType.ets#L16-L25
dd0a9d8bd9edc635e26f823c6433bf7336306033
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListExchangeCtrl.ets
arkts
onMove
ListItem移动函数 @param item @param offsetY
onMove(item: T, offsetY: number): void { try { const index: number = this.deductionData.indexOf(item); this.offsetY = offsetY - this.dragRefOffset; this.modifier[index].offsetY = this.offsetY; const direction: number = this.offsetY > 0 ? 1 : -1; // 触发拖动时,被覆盖子组件缩小与恢复的动画 const curv...
AST#method_declaration#Left onMove AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#typ...
onMove(item: T, offsetY: number): void { try { const index: number = this.deductionData.indexOf(item); this.offsetY = offsetY - this.dragRefOffset; this.modifier[index].offsetY = this.offsetY; const direction: number = this.offsetY > 0 ? 1 : -1; const curveValue: ICurve = curves...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/src/main/ets/model/ListExchangeCtrl.ets#L80-L117
608b68ca7b77f6cda16a53a49ab50c85081f5342
gitee
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/common/utils/windowManager.ets
arkts
enableFullScreen
开启沉浸式全屏模式
static async enableFullScreen() { const win = await window.getLastWindow(getContext()) //使用window这个API的getLastWindow方法获取页面 win.setWindowLayoutFullScreen(true) //使用setWindowLayoutFullScreen设置true开启沉浸式模式 const area = await win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM) //使用getWindowAvoidArea方法获取到安全区...
AST#method_declaration#Left static async enableFullScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left win = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left ...
static async enableFullScreen() { const win = await window.getLastWindow(getContext()) win.setWindowLayoutFullScreen(true) const area = await win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM) let vpHeight = px2vp(area.topRect.height) AppStorage.setOrCreate('topHeight', vpHeight) }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/windowManager.ets#L5-L11
a6bfa1cc9c98299731c6463ab9983f5b587a6f50
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
calculateHasMore
计算是否还有更多数据 @param {NetworkPageData<T>} pageData - 分页数据 @returns {boolean} 是否还有更多
protected calculateHasMore(pageData: NetworkPageData<T>): boolean { const pagination: NetworkPageMeta | null = pageData.pagination; return pagination !== null && pagination.total !== null && pagination.size !== null && pagination.page !== null && pagination.size * pagination.page < pagin...
AST#method_declaration#Left protected calculateHasMore AST#parameter_list#Left ( AST#parameter#Left pageData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right ...
protected calculateHasMore(pageData: NetworkPageData<T>): boolean { const pagination: NetworkPageMeta | null = pageData.pagination; return pagination !== null && pagination.total !== null && pagination.size !== null && pagination.page !== null && pagination.size * pagination.page < pagin...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L181-L188
0e841899f09e022a903c32acfbfec5f24645c78a
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/context_sensitive/multi_invoke/multi_invoke_001_T.ets
arkts
Introduction 多次调用
export function multi_invoke_001_T(taint_src : string) { let a = f(taint_src); let b = f("_"); taint.Sink(a); }
AST#export_declaration#Left export AST#function_declaration#Left function multi_invoke_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function multi_invoke_001_T(taint_src : string) { let a = f(taint_src); let b = f("_"); taint.Sink(a); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/context_sensitive/multi_invoke/multi_invoke_001_T.ets#L6-L10
8fb4aa12869a21e0e0087e13c4123b21a413b320
github
openharmony-sig/ohos_axios
75d72897982ea6e10fa99c62c62a65425af0a568
entry/src/main/ets/pages/Index.ets
arkts
get
get请求
get() { this.clear() this.showUrl = this.getUrl this.startTime = new Date().getTime(); axios.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxBodyLength, maxContentLength: this.maxCo...
AST#method_declaration#Left get AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expression#Righ...
get() { this.clear() this.showUrl = this.getUrl this.startTime = new Date().getTime(); axios.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxBodyLength, maxContentLength: this.maxCo...
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L422-L441
2fa614f78e6a82c5e6753cb0d83381f54d1fdf0b
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
deleteProp
Called when a property is deleted. @since 10
static deleteProp(key: string): void { throw new Error("PersistentStorage.deleteProp is not implemented") }
AST#method_declaration#Left static deleteProp AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri...
static deleteProp(key: string): void { throw new Error("PersistentStorage.deleteProp is not implemented") }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L396-L398
d6f813aba182d20fb0f0562aca640a85961b3bd7
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/pages/find/FindPage.ets
arkts
FindPage
发现页面
@Component export struct FindPage { @Provide findCurrentIndex: number = 0 private controller: TabsController = new TabsController() @Consume @Watch('onTabSelected') homeTabSelected: number aboutToAppear() { this.loadNet() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FindPage AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right findCurrentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat...
@Component export struct FindPage { @Provide findCurrentIndex: number = 0 private controller: TabsController = new TabsController() @Consume @Watch('onTabSelected') homeTabSelected: number aboutToAppear() { this.loadNet() }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/pages/find/FindPage.ets#L11-L19
d5b9ed0ae732429979ae144389ec33113500221b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/WindowModel.ets
arkts
窗口管理模型
export default class WindowModel { constructor() { } /** * 缓存的当前WindowStage实例 */ private windowStage?: window.WindowStage = undefined; /** * 缓存windowStage * @param windowStage 当前WindowStage实例 * @returns {void} */ setWindowStage(windowStage: window.WindowStage): void { this.windowStag...
AST#export_declaration#Left export default AST#class_declaration#Left class WindowModel AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right /** * 缓存的当前WindowSta...
export default class WindowModel { constructor() { } private windowStage?: window.WindowStage = undefined; setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; } setMainWindowImmersive(enable: boolean): void { if (this.windowStage === undefined) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/WindowModel.ets#L23-L92
f2debd87b5e76f3e77c9ff9fdb13dba681dccc5d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/backgroundblur/src/main/ets/pages/CustomTabsComponent.ets
arkts
CustomTabsComponent
功能介绍:自定义的Tabs实现 参数介绍: @params selectedIndex 初始化被选定的tabBar下标 @params tabsInfoList 入参的数据信息,包含TabBar的标题、选中前后的图片,TabContent的信息等 实现思路: 1、布局主要是一个Tab结构,实现了TabContent和自定义TabBar,通过TabInfo入参可以获取; 2、在TabBar中设置backgroundBrightness和backgroundBlurStyle属性,并且通过Stack布局,使TabContent和TabBar重叠, 通过TabBar的背景可以模糊看到TabContent的内容,实现了背景模糊的效果。 ...
@Component export struct CustomTabsComponent { @Provide selectedIndex: number = 0; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; controller: TabsController = new TabsController(); // 初始化Tab控制器 tabsInfoList: Array<TabInfo> = new Array(); // TabContent组件 build() { Stack({ ali...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabsComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right selectedIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
@Component export struct CustomTabsComponent { @Provide selectedIndex: number = 0; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; controller: TabsController = new TabsController(); tabsInfoList: Array<TabInfo> = new Array(); build() { Stack({ alignContent: Alignment.Bottom...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/backgroundblur/src/main/ets/pages/CustomTabsComponent.ets#L30-L97
4330b732429e9fa38fffc658f5f71e094f909502
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkItemModel.ets
arkts
排序
constructor(date: string = '', time: string = '', videoSrc: string = '', firstImage: ResourceStr = '', labels: ResourceStr = '', isTop: boolean = false, index: number = 0) { this.date = date; this.time = time; this.videoSrc = videoSrc; this.trimmerSrc = ''; this.firstImage = firstImage; ...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left time : AST#type_annotation#Left A...
constructor(date: string = '', time: string = '', videoSrc: string = '', firstImage: ResourceStr = '', labels: ResourceStr = '', isTop: boolean = false, index: number = 0) { this.date = date; this.time = time; this.videoSrc = videoSrc; this.trimmerSrc = ''; this.firstImage = firstImage; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkItemModel.ets#L31-L44
f457e53554077f428bf64cba6879be3766d1a612
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/CircleView.ets
arkts
======================= ENUM =======================
export enum CircleViewStyle { Pan = 0, Ring = 1, Ring3D = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum CircleViewStyle AST#enum_body#Left { AST#enum_member#Left Pan = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Ring = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Ring3D ...
export enum CircleViewStyle { Pan = 0, Ring = 1, Ring3D = 2 }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/CircleView.ets#L11-L15
8ae54755eef212d4f1512e31f1a8348d06b715bf
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
documentViewPickerSave
封装后的documentViewPicker的Save方法,需要被注册到native侧 @param uiContext:调用本方法的UIContext @param options:拉起picker时的options参数 @param thenWrapper:开发者自定义的then回调 @param catchWrapper:开发者自定义的catch回调
function documentViewPickerSave(uiContext: UIContext, options: picker.DocumentSaveOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { //... }
AST#function_declaration#Left function documentViewPickerSave AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Le...
function documentViewPickerSave(uiContext: UIContext, options: picker.DocumentSaveOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L82-L85
66ef4f0f1272061b8cff79739f3166a5d9cb461e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/NotificationOptions.ets
arkts
描述模板的通知。
export interface NotificationTemplateOptions extends NotificationBasicOptions { // title: string; //通知标题 和 下载标题,共用一个字段。 fileName: string; //表示下载文件名。必填字段,值为字符串类型。 progressValue: 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 { // title: string; //通知标题 和 下载标题,共用一个字段。 AST#type_member#Left fileName : AST#type_annotation#Left AST#primary_ty...
export interface NotificationTemplateOptions extends NotificationBasicOptions { fileName: string; progressValue: number; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationOptions.ets#L97-L101
b54bfd4898ad59de40ca194693a3e16d0f7f884d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
getInstance
获取单例实例
static getInstance(): AppRouter { if (!AppRouter.instance) { AppRouter.instance = new AppRouter(); } return AppRouter.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppRouter AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#...
static getInstance(): AppRouter { if (!AppRouter.instance) { AppRouter.instance = new AppRouter(); } return AppRouter.instance; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L74-L79
9493c6e4f9d603b3706ecc55af8bb189447740b3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
checkReminderPermission
检查提醒权限
public async checkReminderPermission(context?: common.UIAbilityContext): Promise<boolean> { try { // 通过尝试获取现有提醒来验证权限 // 如果权限不足,此方法会抛出异常 const reminders = await this.getActiveReminders(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TimedReminderService] Current active ...
AST#method_declaration#Left public async checkReminderPermission 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#p...
public async checkReminderPermission(context?: common.UIAbilityContext): Promise<boolean> { try { const reminders = await this.getActiveReminders(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[TimedReminderService] Current active reminders: ${reminders.length}, perm...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L244-L267
6696c6137b7e8daf142cc4923357e741db2e8cc0
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets
arkts
getPoemText
获取随机的单句诗词
async getPoemText() { let res = await http.createHttp().request('https://v1.jinrishici.com/all.txt') return res.result }
AST#method_declaration#Left async getPoemText AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression...
async getPoemText() { let res = await http.createHttp().request('https://v1.jinrishici.com/all.txt') return res.result }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L20-L23
10eb742a6f42d1360b713ad39f6e952642ffb890
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/ListItemGroupView.ets
arkts
ListItemGroupView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct ListItemGroupView { @Link _position: Position; private componentKey: string = ''; private parentWidth: number = 0; private parentHeight: number = 0; private parentComponentKey: string = ''; private referenceComponentKey: string = ''; private projects: string[] = ['item1', 'item2',...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#ty...
@Component export struct ListItemGroupView { @Link _position: Position; private componentKey: string = ''; private parentWidth: number = 0; private parentHeight: number = 0; private parentComponentKey: string = ''; private referenceComponentKey: string = ''; private projects: string[] = ['item1', 'item2',...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/ListItemGroupView.ets#L16-L84
2224ee3aedb8f99f96bb6c2a9cdcff9936996520
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
Binds data to components and provides interfaces.
export class PageViewModel { /** * Get data sources required by the LazyForEach interface. * * @return {ListDataSource} new ListDataSource(listItems) */ getListDataSource(): ListDataSource { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.LIST_SIZE; i++) { let ...
AST#export_declaration#Left export AST#class_declaration#Left class PageViewModel AST#class_body#Left { /** * Get data sources required by the LazyForEach interface. * * @return {ListDataSource} new ListDataSource(listItems) */ AST#method_declaration#Left getListDataSource AST#parameter_list#Left ( ) AST#pa...
export class PageViewModel { getListDataSource(): ListDataSource { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.LIST_SIZE; i++) { let itemInfo: ListItemData = new ListItemData(); itemInfo.image = $r("app.media.ic_normal"); itemInfo.title = $r('app.string.li...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets#L9-L61
d5f7c3053d3fb6d7905b7f2bcc7c212910fe01bf
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VisibleComponent/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
Method 1: use aboutToAppear to register a setOnVisibleAreaApproximateChange
aboutToAppear(): void { this.uid = this.getUniqueId(); hilog.info(0x0000, 'testTag', `getUniqueId in ImageAnimatorTest aboutAppear is ${this.uid}`); let node = this.getUIContext().getFrameNodeByUniqueId(this.uid); node?.commonEvent.setOnVisibleAreaApproximateChange( { ratios: [0], expectedUpdateIn...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb...
aboutToAppear(): void { this.uid = this.getUniqueId(); hilog.info(0x0000, 'testTag', `getUniqueId in ImageAnimatorTest aboutAppear is ${this.uid}`); let node = this.getUIContext().getFrameNodeByUniqueId(this.uid); node?.commonEvent.setOnVisibleAreaApproximateChange( { ratios: [0], expectedUpdateIn...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VisibleComponent/entry/src/main/ets/pages/Index.ets#L103-L114
849ae134f0830bfceb9f206c92d9f84cdef2b3a9
gitee