nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Matrix.ets
arkts
仅用于translate 和 scale,rotate、skew未移植
export default class Matrix { public static MSCALE_X: number = 0; //!< use with getValues/setValues public static MSKEW_X: number = 1; //!< use with getValues/setValues public static MTRANS_X: number = 2; //!< use with getValues/setValues public static MSKEW_Y: number = 3; //!< use with getValues/setVal...
AST#export_declaration#Left export default AST#class_declaration#Left class Matrix AST#class_body#Left { AST#property_declaration#Left public static MSCALE_X : 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#proper...
export default class Matrix { public static MSCALE_X: number = 0; public static MSKEW_X: number = 1; public static MTRANS_X: number = 2; public static MSKEW_Y: number = 3; public static MSCALE_Y: number = 4; public static MTRANS_Y: number = 5; public static MPERSP_0: number = 6; pub...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Matrix.ets#L21-L57
1a65df5ed591e5c5b31afd74e5cfabed06a243b0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/MenuLayout.ets
arkts
MenuLayout
自定义底部菜单组件
@Preview @ComponentV2 export struct MenuLayout { @Require @Param options: MenuOptions; @Event onItemClick: Callback<MenuBean>; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.options.backgroundBlurStyle = this.options.backgroun...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MenuLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right opt...
@Preview @ComponentV2 export struct MenuLayout { @Require @Param options: MenuOptions; @Event onItemClick: Callback<MenuBean>; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.options.backgroundBlurStyle = this.options.backgroun...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/MenuLayout.ets#L16-L100
5c7e55ac63d636ff5a615e79475d9ecbeadbbc57
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
aboutToAppear
页面出现时加载数据 @returns {void} 无返回值
aboutToAppear(): void { // 先加载缓存数据 this.loadOrderCache(); // 再执行网络请求 super.aboutToAppear(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 先加载缓存数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST...
aboutToAppear(): void { this.loadOrderCache(); super.aboutToAppear(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L98-L103
b0f7687e920966efb5093c786a57973c8f457785
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/DiskStatus.ets
arkts
getAvailableBytesForDataDirectorySync
同步检查内部存储空间(单位:字节)
static getAvailableBytesForDataDirectorySync(context: common.Context): number { try { return statfs.getFreeSizeSync(context.filesDir); } catch (err) { const error = err as BusinessError; console.error(`内部存储检查失败[code:${error.code}]: ${error.message}`); return 0 } }
AST#method_declaration#Left static getAvailableBytesForDataDirectorySync AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para...
static getAvailableBytesForDataDirectorySync(context: common.Context): number { try { return statfs.getFreeSizeSync(context.filesDir); } catch (err) { const error = err as BusinessError; console.error(`内部存储检查失败[code:${error.code}]: ${error.message}`); return 0 } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/DiskStatus.ets#L8-L16
3f71e83acf8f76ca83585057fa5e34ed155acfdc
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets
arkts
[Start Case4]
export interface UserData { id: string; username: string; description: string; // 1. Add a list of resources in the user's collection on the user information UserData id Information Type Definition collectedIds: string[]; // ... }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserData 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 username : AST#type_annotation#Left AS...
export interface UserData { id: string; username: string; description: string; collectedIds: string[]; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets#L47-L55
a67b51c9caee5908736eb9dad88723bb067d0ca0
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onPinchStart
Pinch start. @param x @param y @param scale
onPinchStart(x: number, y: number, scale: number): void { Logger.debug(TAG, `onPinchStart: event[x: ${x}, y: ${y}]`); this.splitLineShow = true; this.state = CropTouchState.IMAGE_SCALE; this.pinchPoint.set(x, y); this.scale = scale; }
AST#method_declaration#Left onPinchStart AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t...
onPinchStart(x: number, y: number, scale: number): void { Logger.debug(TAG, `onPinchStart: event[x: ${x}, y: ${y}]`); this.splitLineShow = true; this.state = CropTouchState.IMAGE_SCALE; this.pinchPoint.set(x, y); this.scale = scale; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L278-L284
ae36186ce4e1f96eb918d2971c90a133dd8308b5
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
getHomeName
获取家庭名称
getHomeName(): string { return `${this.userInfo.nickname}的家`; }
AST#method_declaration#Left getHomeName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Le...
getHomeName(): string { return `${this.userInfo.nickname}的家`; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L190-L192
039882b6f845258ef65c871cbe51e53f284e4bf3
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets
arkts
readData
3-读取数据
readData(): Promise<Sport[]> { if (dataPreferences) { //Preferences实例是否存在 let promise = dataPreferences.getAll();//获取对象中首选项的所有键和值 return promise.then((value: Object) => { arr = Object.values(value); return arr; // 返回 arr 数组 }).catch((err: BusinessError) => { return Promise....
AST#method_declaration#Left readData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Sport [ ] AST#array_type#Right AST#primary_type#Right AST#...
readData(): Promise<Sport[]> { if (dataPreferences) { let promise = dataPreferences.getAll(); return promise.then((value: Object) => { arr = Object.values(value); return arr; }).catch((err: BusinessError) => { return Promise.reject("读取数据失败 =" + err.code + ", message =" + ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets#L65-L80
33d195ef3ad1e10ded9703309cf49530c0e9f92e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets
arkts
AES解密 @param encryptedMessage 已经加密的数据 @param aesKey AES密钥 @returns 解密后的数据
export async function aesGcmDecrypt(encryptedMessage: string, aesKey: string): Promise<string> { let encryptionData: EncryptionData = JSON.parse(encryptedMessage); try { // 创建对称密钥生成器实例 let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256'); // 将AES密钥字符串转换为...
AST#export_declaration#Left export AST#function_declaration#Left async function aesGcmDecrypt AST#parameter_list#Left ( AST#parameter#Left encryptedMessage : 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_...
export async function aesGcmDecrypt(encryptedMessage: string, aesKey: string): Promise<string> { let encryptionData: EncryptionData = JSON.parse(encryptedMessage); try { let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256'); let symKeyBlob: cryptoFr...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets#L53-L84
02b2eaad744ea45bd4909159773c498d042de6ec
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildCsvPreview
构建CSV预览
@Builder buildCsvPreview() { if (this.csvParseResult && this.showCsvPreview) { Column({ space: 12 }) { Row() { Text('解析预览') .fontSize(16) .fontColor('#333333') .layoutWeight(1) Button(this.showCsvPreview ? '收起' : '展开') .type(ButtonType.No...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCsvPreview 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#member_expression#Left AST#expression#Left AST#binary_expressi...
@Builder buildCsvPreview() { if (this.csvParseResult && this.showCsvPreview) { Column({ space: 12 }) { Row() { Text('解析预览') .fontSize(16) .fontColor('#333333') .layoutWeight(1) Button(this.showCsvPreview ? '收起' : '展开') .type(ButtonType.No...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L287-L384
027a029251cd45454bb1da67670c9a5a9122b0a5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
exit
主动退出整个应用;调用该方法后,任务中心的任务默认不会清理,如需清理,需要配置removeMissionAfterTerminate为true。
static async exit(): Promise<void> { await AppUtil.getContext().terminateSelf(); await AppUtil.killAllProcesses(); }
AST#method_declaration#Left static async exit 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_argu...
static async exit(): Promise<void> { await AppUtil.getContext().terminateSelf(); await AppUtil.killAllProcesses(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L247-L250
9edd933474cd1106780523c542237c90f97624ae
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageRegistry.ets
arkts
size
获取注册表大小 @returns 已注册类型的数量 使用示例: ```typescript const count = MessageRegistry.size() console.log(`${count} types registered`) ```
static size(): number { return MessageRegistry.types.size }
AST#method_declaration#Left static size AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
static size(): number { return MessageRegistry.types.size }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L257-L259
0621685e557a2a0394ef1450660584b998f3cf1f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LrcUtils.ets
arkts
The angle is converted into radians. Because the trigonometric function of Math needs to pass in the radian system instead of the angle value, the angle needs to be converted into radians. Angle / 180 * π @param angle @returns
export function angleToRadian(angle: number): number { return angle * Math.PI / 180; }
AST#export_declaration#Left export AST#function_declaration#Left function angleToRadian AST#parameter_list#Left ( AST#parameter#Left angle : 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 AS...
export function angleToRadian(angle: number): number { return angle * Math.PI / 180; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LrcUtils.ets#L145-L147
9222d85e7e727e7ff1bc97dd8ed1bacd1a8a9a21
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/WindowUtil.ets
arkts
closeWindow
关闭窗口 @returns
static async closeWindow(): Promise<void> { if (WindowUtil.cacheWindow) { await WindowUtil.cacheWindow.destroyWindow(); } }
AST#method_declaration#Left static async closeWindow 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#ty...
static async closeWindow(): Promise<void> { if (WindowUtil.cacheWindow) { await WindowUtil.cacheWindow.destroyWindow(); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/WindowUtil.ets#L79-L83
45b64d143d957c421d12730128c5effa136170f2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
TODO DES加解密 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class DES { /** * 加密(ECB模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。 * @...
AST#export_declaration#Left export AST#class_declaration#Left class DES AST#class_body#Left { /** * 加密(ECB模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @param transformation 待生成Cipher的...
export class DES { static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = '3DES192|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return DES.encrypt(data, symKey, null, transformation); } static encryptECBSync(data: cryptoFramework.DataBl...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L24-L205
294af3951eb7b5c7b58c0dfc9a8df4aa1bf7873a
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets
arkts
renderOrderItem
渲染不同状态的订单内容
@Builder renderOrderItem(item: OrderItem) { Column() { // 通用头部:店铺名称 + 状态标签 Row({ space: 20 }) { Text(item.shopName) .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) .flexGrow(1); Text(item.status) .fontSize(14) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right renderOrderItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left OrderItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b...
@Builder renderOrderItem(item: OrderItem) { Column() { Row({ space: 20 }) { Text(item.shopName) .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) .flexGrow(1); Text(item.status) .fontSize(14) .fontColor(this.ge...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L201-L322
c8dc4d978a07690614b39ab3264d29f1e357a064
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/AccountData.ets
arkts
getAllAccounts
获取所有账户
static async getAllAccounts(): Promise<AccountItem[]> { try { if (!AccountDataManager.preferencesStore) { console.error('存储未初始化'); return []; } const data = await AccountDataManager.preferencesStore.get(AccountDataManager.ACCOUNT_KEY, '[]') as string; const accounts = JSON.p...
AST#method_declaration#Left static async getAllAccounts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AccountItem [ ] AST#array_type#Right AS...
static async getAllAccounts(): Promise<AccountItem[]> { try { if (!AccountDataManager.preferencesStore) { console.error('存储未初始化'); return []; } const data = await AccountDataManager.preferencesStore.get(AccountDataManager.ACCOUNT_KEY, '[]') as string; const accounts = JSON.p...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L66-L81
e1d9cde33382e3f72c31ee017ced52718cd5093b
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultAxisValueFormatter.ets
arkts
Constructor that specifies to how many digits the value should be formatted. @param digits
constructor(digits: number) { this.digits = digits; let b: string = ''; for (var i = 0; i < digits; i++) { if (i == 0) { b += '.'; } b += '0'; } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left digits : 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#Left AST#expression_statement#...
constructor(digits: number) { this.digits = digits; let b: string = ''; for (var i = 0; i < digits; i++) { if (i == 0) { b += '.'; } b += '0'; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultAxisValueFormatter.ets#L31-L41
d33da421d849f67ecabe03d9a42e89cac460e1cd
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/SubItemArrow.ets
arkts
SubItemArrow
Copyright (c) 2021-2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
@Component export struct SubItemArrow { private title: string | Resource = '' private tag: string | Resource = '' @State isTouched: boolean = false build() { Row() { Text(this.title) .fontSize($r('sys.float.ohos_id_text_size_body1')) .fontColor($r('sys.color.ohos_id_color_text_primary...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SubItemArrow AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AS...
@Component export struct SubItemArrow { private title: string | Resource = '' private tag: string | Resource = '' @State isTouched: boolean = false build() { Row() { Text(this.title) .fontSize($r('sys.float.ohos_id_text_size_body1')) .fontColor($r('sys.color.ohos_id_color_text_primary...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/SubItemArrow.ets#L16-L59
c6eb3ef2bd304c64aac559b0a03e2e4ae6b27f54
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/CircleView.ets
arkts
drawCanvas
========== 绘制主入口 ==========
private drawCanvas() { if (!this.ctx) return; try { const width = this.ctx.width > 0 ? this.ctx.width : 200; const height = this.ctx.height > 0 ? this.ctx.height : 200; const diameter= Math.min(width, height); const radius = diameter / 2; const cx = radius; const ...
AST#method_declaration#Left private drawCanvas AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expres...
private drawCanvas() { if (!this.ctx) return; try { const width = this.ctx.width > 0 ? this.ctx.width : 200; const height = this.ctx.height > 0 ? this.ctx.height : 200; const diameter= Math.min(width, height); const radius = diameter / 2; const cx = radius; const ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/CircleView.ets#L82-L103
792238c050a4cb9ff9948c8702e30d2503b6989f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets
arkts
itemGeneratorFunc
Execute time-consuming asynchronous functions elsewhere Simulate time-consuming operations
itemGeneratorFunc() { let temp: number = 0; for (let index = 0; index < 1000000; index++) { temp += 1; } this.timeConsumingValue = temp; }
AST#method_declaration#Left itemGeneratorFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = ...
itemGeneratorFunc() { let temp: number = 0; for (let index = 0; index < 1000000; index++) { temp += 1; } this.timeConsumingValue = temp; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets#L61-L67
568697684f31de27b88091e9685739b5956612db
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isWeakSet
检查是否为WeakSet类型。 @param value @returns
static isWeakSet(value: Object): boolean { return new util.types().isWeakSet(value); }
AST#method_declaration#Left static isWeakSet AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
static isWeakSet(value: Object): boolean { return new util.types().isWeakSet(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L125-L127
bf30bb2a76bfbc6355c1e304b72b0982779994aa
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
arkts
getRecentFootprints
获取指定数量的最新足迹记录 @param {number} limit 限制数量 @returns {Promise<Footprint[]>} 足迹列表
async getRecentFootprints(limit: number): Promise<Footprint[]> { const all: Footprint[] = await this.getAllFootprints(); return all.slice(0, limit); }
AST#method_declaration#Left async getRecentFootprints AST#parameter_list#Left ( AST#parameter#Left limit : 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_ty...
async getRecentFootprints(limit: number): Promise<Footprint[]> { const all: Footprint[] = await this.getAllFootprints(); return all.slice(0, limit); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L89-L92
c6aa7d828cc18a9299d09d29500ce8a2ad25b004
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets
arkts
memberBanner
会员和权益中心栏目
@Builder memberBanner() { Row() { Column() { Text($r('app.string.slidetohideanddisplace_member')) .fontSize($r('app.integer.slidetohideanddisplace_font_size_mid')) .fontColor($r('app.color.slidetohideanddisplace_member1')) Text($r('app.string.slidetohideanddisplace_get_of...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right memberBanner 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 memberBanner() { Row() { Column() { Text($r('app.string.slidetohideanddisplace_member')) .fontSize($r('app.integer.slidetohideanddisplace_font_size_mid')) .fontColor($r('app.color.slidetohideanddisplace_member1')) Text($r('app.string.slidetohideanddisplace_get_of...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets#L156-L194
f5ef0ef86a42d39a3b36ec5ce8069800c10ad415
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘88%’
export const THOUSANDTH_900: string = '90%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_900 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar...
export const THOUSANDTH_900: string = '90%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L61-L61
a49eb41e6e1ab21e470c1119ec0ccb14a9093725
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
getSize
获取大小
getSize(): number { return this.size; }
AST#method_declaration#Left getSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left ...
getSize(): number { return this.size; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L124-L126
94a2e26893f65b497aa8877c355a0f00d4da51e8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
即将到来的生日接口
export interface UpcomingBirthday { contact: Contact; daysUntil: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UpcomingBirthday AST#object_type#Left { AST#type_member#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left daysUntil : AST#type_ann...
export interface UpcomingBirthday { contact: Contact; daysUntil: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L43-L46
57429dcec578fe0152ac02b3ff3d814cb176d0c1
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample7/LightArt.ets
arkts
fromJson
[StartExclude LightArt] [EndExclude LightArt]
public fromJson(jsonObj: object) { // [StartExclude LightArt] // [EndExclude LightArt] }
AST#method_declaration#Left public fromJson AST#parameter_list#Left ( AST#parameter#Left jsonObj : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // [StartExclude LightArt] // [EndExcl...
public fromJson(jsonObj: object) { }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/LightArt.ets#L46-L49
16d825e18fd9fbda0ac6f156d2f05687b4fb648b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/entity/Goods.ets
arkts
@param {Partial<Goods>} init - 初始化数据 @returns {void} 无返回值
constructor(init?: Partial<Goods>) { if (!init) { return; } this.id = init.id ?? this.id; this.typeId = init.typeId ?? this.typeId; this.title = init.title ?? this.title; this.subTitle = init.subTitle ?? this.subTitle; this.mainPic = init.mainPic ?? this.mainPic; this.pics = init.p...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
constructor(init?: Partial<Goods>) { if (!init) { return; } this.id = init.id ?? this.id; this.typeId = init.typeId ?? this.typeId; this.title = init.title ?? this.title; this.subTitle = init.subTitle ?? this.subTitle; this.mainPic = init.mainPic ?? this.mainPic; this.pics = init.p...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Goods.ets#L75-L95
325ba6b89cf298c1e62f6832045415e9f65a7bbe
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/CsvParser.ets
arkts
parseCsvContent
解析CSV内容为联系人导入数据 @param csvContent CSV文件内容 @returns 解析结果
static parseCsvContent(csvContent: string): CsvParseResult { const result: CsvParseResult = { success: false, data: [], errors: [], totalRows: 0, validRows: 0 }; try { if (!csvContent || csvContent.trim().length === 0) { result.errors.push('CSV内容为空'); ret...
AST#method_declaration#Left static parseCsvContent AST#parameter_list#Left ( AST#parameter#Left csvContent : 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 CsvParseResu...
static parseCsvContent(csvContent: string): CsvParseResult { const result: CsvParseResult = { success: false, data: [], errors: [], totalRows: 0, validRows: 0 }; try { if (!csvContent || csvContent.trim().length === 0) { result.errors.push('CSV内容为空'); ret...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/CsvParser.ets#L28-L87
25a05f5a384833cdd5358b83f2815e78d3725a16
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactEditPage.ets
arkts
createBirthdayInfo
创建生日信息
private createBirthdayInfo(): BirthdayInfo { const birthday: BirthdayInfo = { date: this.birthdayType === 'solar' ? (this.hasYear ? `${this.birthdayYear}-${this.birthdayMonth.toString().padStart(2, '0')}-${this.birthdayDay.toString().padStart(2, '0')}` : `${this.birthdayMonth.toString().padS...
AST#method_declaration#Left private createBirthdayInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BirthdayInfo AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declar...
private createBirthdayInfo(): BirthdayInfo { const birthday: BirthdayInfo = { date: this.birthdayType === 'solar' ? (this.hasYear ? `${this.birthdayYear}-${this.birthdayMonth.toString().padStart(2, '0')}-${this.birthdayDay.toString().padStart(2, '0')}` : `${this.birthdayMonth.toString().padS...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L289-L303
60a06a7cef2b60e0317a51eae3764f8590d70d3d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets
arkts
constant about refresh feature
export class RefreshConstants { /** * refresh state tag */ static readonly REFRESH_STATE_TAG = 'refresh_state_tag'; /** * refresh default header height */ static readonly REFRESH_HEADER_HEIGHT = 50; /** * refresh effective height */ static readonly REFRESH_EFFECTIVE_HEIGHT = 1.2 * Refre...
AST#export_declaration#Left export AST#class_declaration#Left class RefreshConstants AST#class_body#Left { /** * refresh state tag */ AST#property_declaration#Left static readonly REFRESH_STATE_TAG = AST#expression#Left 'refresh_state_tag' AST#expression#Right ; AST#property_declaration#Right /** * refresh def...
export class RefreshConstants { static readonly REFRESH_STATE_TAG = 'refresh_state_tag'; static readonly REFRESH_HEADER_HEIGHT = 50; static readonly REFRESH_EFFECTIVE_HEIGHT = 1.2 * RefreshConstants.REFRESH_HEADER_HEIGHT; static readonly REFRESH_LAYOUT_EXTRA_HEIGHT = 0.1; static readonly R...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets#L19-L45
e3bf6fbac1f2c545f6a34dd326723dbcb82a3e74
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/CookiesInterceptor.ets
arkts
@author open_9527 @date 2025/5/15 @desc 描述信息
export class CookiesInterceptor implements rcp.Interceptor { async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> { Logger.debug(`CookiesInterceptor: intercept`) try { //获取响应结果 const response = await next.handle(context) let headers = response.heade...
AST#export_declaration#Left export AST#class_declaration#Left class CookiesInterceptor AST#implements_clause#Left implements AST#implements_clause#Right AST#ERROR#Left AST#qualified_type#Left rcp . Interceptor AST#qualified_type#Right AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left async intercept AST...
export class CookiesInterceptor implements rcp.Interceptor { async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> { Logger.debug(`CookiesInterceptor: intercept`) try { const response = await next.handle(context) let headers = response.headers ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/CookiesInterceptor.ets#L13-L32
cbac869f5552b370fb63a23d3ed8b54841b41cea
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/guide/GuideService.ets
arkts
isGuideShown
检查引导是否已显示
async isGuideShown(key: string): Promise<boolean> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getBoolean(guideKey, false); } catch (error) { Logger.error('GuideService', `Failed to check guide shown: ${String(error)}`); return false; } }
AST#method_declaration#Left async isGuideShown AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left P...
async isGuideShown(key: string): Promise<boolean> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getBoolean(guideKey, false); } catch (error) { Logger.error('GuideService', `Failed to check guide shown: ${String(error)}`); return false; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L50-L58
8b62505b0a39eb249d957a55c362c1feaa164c24
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Logistics.ets
arkts
@file 物流信息实体类 @author Joker.X
export class Logistics { /** * 物流单号 */ number?: string | null = null; /** * 物流公司类型 */ type?: string | null = null; /** * 物流轨迹列表 */ list?: LogisticsItem[] | null = null; /** * 配送状态 */ deliverystatus?: string | null = null; /** * 是否签收 */ issign?: string | null = null; /...
AST#export_declaration#Left export AST#class_declaration#Left class Logistics AST#class_body#Left { /** * 物流单号 */ AST#property_declaration#Left number ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_...
export class Logistics { number?: string | null = null; type?: string | null = null; list?: LogisticsItem[] | null = null; deliverystatus?: string | null = null; issign?: string | null = null; expName?: string | null = null; expSite?: string | null = null; expPhone?: string | nul...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Logistics.ets#L7-L79
c471f79cbf60a87fb1f489c8718a49e97554686e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/pages/MusicPlayerPage.ets
arkts
MusicPlayerPage
音乐播放器页面 实现步骤: 1.通过display的isFoldable接口区分折叠屏和非折叠屏 2.通过监听display的foldStatusChange,将折叠屏状态分发给各子组件 3.折叠屏设备使用FolderStack容器组件实现,指定子组件在折叠屏悬停态,移到上屏的能力
@Component export struct MusicPlayerPage { // 窗口管理model private windowModel: WindowModel = new WindowModel(); // 当前页面的vm实例 @Provide('musicPlayerViewModel') viewModel: MusicPlayerViewModel = new MusicPlayerViewModel(); // 当前折叠屏状态(若当前为折叠屏设备才有效) @State curFoldStatus: display.FoldStatus = display.getFoldStatus(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MusicPlayerPage AST#component_body#Left { // 窗口管理model AST#property_declaration#Left private windowModel : AST#type_annotation#Left AST#primary_type#Left WindowModel AST#primary_type#Right AST#type_annotation#Right = ...
@Component export struct MusicPlayerPage { private windowModel: WindowModel = new WindowModel(); @Provide('musicPlayerViewModel') viewModel: MusicPlayerViewModel = new MusicPlayerViewModel(); @State curFoldStatus: display.FoldStatus = display.getFoldStatus(); @Styles stackStyle() { .height('1...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/pages/MusicPlayerPage.ets#L36-L116
58be3fee25a48d2d800a9333f5d9756ebf1e11db
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets
arkts
获取存过的百诗斩的 收藏数组
export function getColl(fieldName: string): Array<PoemFromApi> { // API9 // return (AppStorage.Get(fieldName) || []) as PoemFromApi[] // API11 return (AppStorage.get(fieldName) || []) as PoemFromApi[] }
AST#export_declaration#Left export AST#function_declaration#Left function getColl AST#parameter_list#Left ( AST#parameter#Left fieldName : 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#...
export function getColl(fieldName: string): Array<PoemFromApi> { return (AppStorage.get(fieldName) || []) as PoemFromApi[] }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets#L39-L44
bdad6c42c592551fc069229d6a70eac1dafbdb9f
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/common/conts.ets
arkts
5MB
export const FAKE_OTP_CODE = '******';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left FAKE_OTP_CODE = AST#expression#Left '******' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const FAKE_OTP_CODE = '******';
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L19-L19
1dcdf98ad8c5bc743f8000a590aa162e36078597
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/auth/LoginPage.ets
arkts
navigateToHome
跳转到首页
private navigateToHome() { router.replaceUrl({ url: 'pages/Index' }); }
AST#method_declaration#Left private navigateToHome 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 router AST#expression#Right . replaceUrl ...
private navigateToHome() { router.replaceUrl({ url: 'pages/Index' }); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/auth/LoginPage.ets#L75-L79
61b2aa0f07fb829d9e62f7107214fe466cf65ba0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildTodayBirthdays
今日生日卡片
@Builder buildTodayBirthdays() { Column({ space: 16 }) { Row() { Text('🎉 今日生日') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看全部') .fontSize(14) .fontColor(this.COLORS.pr...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTodayBirthdays 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...
@Builder buildTodayBirthdays() { Column({ space: 16 }) { Row() { Text('🎉 今日生日') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看全部') .fontSize(14) .fontColor(this.COLORS.pr...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1438-L1492
d3e4c75f5cba3fdc3ae05d08b740c3e9e903701f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
hideCancelModal
隐藏取消原因选择弹窗 @returns {void} 无返回值
hideCancelModal(): void { this.cancelModalVisible = false; }
AST#method_declaration#Left hideCancelModal 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#me...
hideCancelModal(): void { this.cancelModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L214-L216
35d2409a70fa92ed50a751b2d2b429e75b883fb9
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_014_F.ets
arkts
Introduction 库函数-string_split
export function string_lib_func_014_F(taint_src : string) { let clean = "clean"; let t = clean.split("f"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_014_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_014_F(taint_src : string) { let clean = "clean"; let t = clean.split("f"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_014_F.ets#L7-L11
7147d367ade666ff0ca1fcf613cbf4e5bedf5eab
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkView.ets
arkts
buildMenuItems
Nav Menu for Create
buildMenuItems(): CustomNavigationMenuItem[] { return [ {value: "more", icon: $r('app.media.moreh'), isSvg: true, action: () => { ///更多 this.actionPopMenu() } } ] }
AST#method_declaration#Left buildMenuItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomNavigationMenuItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return...
buildMenuItems(): CustomNavigationMenuItem[] { return [ {value: "more", icon: $r('app.media.moreh'), isSvg: true, action: () => { this.actionPopMenu() } } ] }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkView.ets#L89-L97
0e0a383a3d9d5d3752b75e55e8a9078f3e880210
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnStart
纵向起始 + 水平起始
@ComponentV2 export struct ColumnStart { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Para...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnStart AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#L...
@ComponentV2 export struct ColumnStart { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | L...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L225-L300
95a912cf2281dc00e4dbe3b3446be341a9761f9e
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/InterThreadCommunication2.ets
arkts
getAddress
[EndExclude store]
@Concurrent function getAddress() { let address = singleton.getAddress(); hilog.info(0x0000, 'TAG', '%{public}s', 'taskpool:: address is ' + address); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function getAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left address = AST#expression#Left AST#call_express...
@Concurrent function getAddress() { let address = singleton.getAddress(); hilog.info(0x0000, 'TAG', '%{public}s', 'taskpool:: address is ' + address); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/InterThreadCommunication2.ets#L30-L34
77987c9d8bc942b887e9a4d211f18f7b525d0b61
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
addToFavorites
添加到收藏夹
async addToFavorites(type: 'greeting' | 'gift', content: string, contentId?: string, contactId?: string, tags: string[] = []): Promise<Favorite> { const favorite: Favorite = { id: this.generateId(), type, contentId: contentId || this.generateId(), content, contactId, tags, ...
AST#method_declaration#Left async addToFavorites AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'greeting' | 'gift' AST#ERROR#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#...
async addToFavorites(type: 'greeting' | 'gift', content: string, contentId?: string, contactId?: string, tags: string[] = []): Promise<Favorite> { const favorite: Favorite = { id: this.generateId(), type, contentId: contentId || this.generateId(), content, contactId, tags, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L51-L67
a480078df37c2a327f094e9cf290e7f23b1b5019
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets
arkts
onCurrentIndexChange
TODO:知识点:监听currentIndex的变化,视频播放卡片切换新闻和点击列表项切换新闻时修改currentIndex,根据下标计算列表的滚动偏移
onCurrentIndexChange() { // 选中的列表项下标大于3时,列表向上滚动,滚动到与列表显示区域内上方间隔3个列表项或列表尾部时停止。 if (this.currentIndex > Constants.NEWS_LIST_SCROLL_TO_INDEX) { this.scroller.scrollTo({ yOffset: Constants.NEWS_LIST_ITEM_HEIGHT * (this.currentIndex - Constants.NEWS_LIST_SCROLL_TO_INDEX), xOffset: 0 }); ...
AST#method_declaration#Left onCurrentIndexChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 选中的列表项下标大于3时,列表向上滚动,滚动到与列表显示区域内上方间隔3个列表项或列表尾部时停止。 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary...
onCurrentIndexChange() { if (this.currentIndex > Constants.NEWS_LIST_SCROLL_TO_INDEX) { this.scroller.scrollTo({ yOffset: Constants.NEWS_LIST_ITEM_HEIGHT * (this.currentIndex - Constants.NEWS_LIST_SCROLL_TO_INDEX), xOffset: 0 }); } else { this.scroller.scrollTo({ yO...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets#L383-L394
0f8e1e67451b54c8ca23e632ce43e19956edd527
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets
arkts
if
视频加载完成 在屏幕中间的视频开始播放
if (this.centerIndex === this.index) { this.avPlayer.play(); }
AST#method_declaration#Left if AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . centerIndex === this . in dex AST#ERROR#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A...
if (this.centerIndex === this.index) { this.avPlayer.play(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L238-L240
86395f48ac0665657e7a8f5b68d9ae0075cf80b0
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/StatisticalCardComponent.ets
arkts
StatisticalCardComponent
定义统计卡组件
@Component export default struct StatisticalCardComponent { // 使用@Link和@Watch修饰属性,监视accounts属性的变化 @Link @Watch('onAccountsChange') accounts: Array<Account>; // // 使用@State修饰属性,声明一些状态变量 // @State dayPay: number = dayStatistics(this.accounts, 0); // 今日支出 // @State dayEarn: number = dayStatistics(this.accounts,...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct StatisticalCardComponent AST#component_body#Left { // 使用@Link和@Watch修饰属性,监视accounts属性的变化 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#...
@Component export default struct StatisticalCardComponent { @Link @Watch('onAccountsChange') accounts: Array<Account>; @State monthPay: number = monthStatistics(this.accounts, 0); @State monthEarn: number = monthStatistics(this.accounts, 1); onAccountsChange() { this.monthP...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/StatisticalCardComponent.ets#L7-L103
30104fe369efb8cfe51bd806ce9fec888d58c75d
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
arkts
daysBetween
计算两个日期之间的天数差 @param date1 第一个日期 @param date2 第二个日期 @returns 天数差
static daysBetween(date1: Date, date2: Date): number { const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 const diffTime = Math.abs(date2.getTime() - date1.getTime()); return Math.round(diffTime / oneDay); }
AST#method_declaration#Left static daysBetween AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#R...
static daysBetween(date1: Date, date2: Date): number { const oneDay = 24 * 60 * 60 * 1000; const diffTime = Math.abs(date2.getTime() - date1.getTime()); return Math.round(diffTime / oneDay); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L195-L199
3f864352a953252606921b915843c09f78e7f75f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Internationalnation/International/entry/src/main/ets/components/OperationView.ets
arkts
OperationView
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 default struct OperationView { private mKey: string | Resource = ''; private showArrow: boolean = true; private handleClick: () => void = () => {}; @Prop value: string; build() { Row() { Text(this.mKey) .fontSize(22) .margin({ top: 20, bottom: 20 }) Blank() ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct OperationView AST#component_body#Left { AST#property_declaration#Left private mKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Res...
@Component export default struct OperationView { private mKey: string | Resource = ''; private showArrow: boolean = true; private handleClick: () => void = () => {}; @Prop value: string; build() { Row() { Text(this.mKey) .fontSize(22) .margin({ top: 20, bottom: 20 }) Blank() ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Internationalnation/International/entry/src/main/ets/components/OperationView.ets#L15-L46
daab427a342b03ac8368eea20879ee4d81df90f8
gitee
CMoments/HarmonOS-arkTS-YunShangChuanDa.git
895985b9b6013c906bf88eaea6e32e03ddf2a9db
project code/entry/src/main/ets/api/API.ets
arkts
请求获取组织数据
export const departments = ():Promise<http.HttpResponse> => get ("/index.php");
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left departments = AST#expression#Left AST#arrow_function#Left 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#...
export const departments = ():Promise<http.HttpResponse> => get ("/index.php");
https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/api/API.ets#L6-L6
bdcaaae6799282e35f94e5ea9023a3197935c274
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/types/RaisedCircleTypes.ets
arkts
修改 定位的x和y
export interface RaisedCircleSetPostionXYType { x?: number, y?: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface RaisedCircleSetPostionXYType AST#object_type#Left { AST#type_member#Left x ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left y ? : AST#type_an...
export interface RaisedCircleSetPostionXYType { x?: number, y?: number }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/types/RaisedCircleTypes.ets#L21-L24
810825d8740cf92a8ec416cf00d53ec5f0aa5d9f
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
delService
删除服务 @param serviceId 服务id
public delService(serviceId: string): void { this.services.delete(serviceId); }
AST#method_declaration#Left public delService AST#parameter_list#Left ( AST#parameter#Left serviceId : 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_t...
public delService(serviceId: string): void { this.services.delete(serviceId); }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L96-L98
190f466cb0ca7d69ea601025c36a3978521b2caa
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets
arkts
待删除的目录结构
export interface DeletedData { path: string; type: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DeletedData AST#object_type#Left { AST#type_member#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left A...
export interface DeletedData { path: string; type: number; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets#L60-L63
06ab57ef04ea38aa069a22f0e703db7a10527505
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets
arkts
Construct parameter types for ExpandedMenuOptions. @extends MenuItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Construct parameter types for ExpandedMenuOptions. @extends MenuItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ExpandedMenuOptions extends MenuItemOptions { /** * Callback function when click the option. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Callback function when click the option. * * @typ...
AST#export_declaration#Left export AST#interface_declaration#Left interface ExpandedMenuOptions AST#extends_clause#Left extends MenuItemOptions AST#extends_clause#Right AST#object_type#Left { /** * Callback function when click the option. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkU...
export interface ExpandedMenuOptions extends MenuItemOptions { action?: () => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets#L107-L126
a5acc56d2bcdda5e85934bfa1b63bd029b8bf48e
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/ImageAnimate.ets
arkts
getImgCoefficients
Get the image offset coefficients. @param index @returns offset coefficients
getImgCoefficients(index: number) { let coefficient = this.imageId - index; let tempCoefficient = Math.abs(coefficient); if (tempCoefficient <= Const.HALF_COUNT) { return coefficient; } let dataLength = this.introductionData.imageList.length; let tempOffset = dataLength - tempCoefficient; ...
AST#method_declaration#Left getImgCoefficients 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#block_statement#Left { AST#statement#Left AST#variable_declaration...
getImgCoefficients(index: number) { let coefficient = this.imageId - index; let tempCoefficient = Math.abs(coefficient); if (tempCoefficient <= Const.HALF_COUNT) { return coefficient; } let dataLength = this.introductionData.imageList.length; let tempOffset = dataLength - tempCoefficient; ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/ImageAnimate.ets#L42-L57
2f4f74f02badd3367d7a51ce60888a70f9cb3ddd
github
youfrweb/harmonyProject.git
c95207f5ef319719a960c9e9a75b0c14a24842eb
entry/src/main/ets/pages/home/main/HomeHeader.ets
arkts
aboutToDisappear
组件销毁
aboutToDisappear(): void { clearInterval(this.timer) }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left cle...
aboutToDisappear(): void { clearInterval(this.timer) }
https://github.com/youfrweb/harmonyProject.git/blob/c95207f5ef319719a960c9e9a75b0c14a24842eb/entry/src/main/ets/pages/home/main/HomeHeader.ets#L35-L37
c6602ec887657582553900e40a1e75e0983a679c
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
arkts
queryRowNames
获取数据表的所有列名 @param tableName 表名 @returns string[]
queryRowNames(tableName: string): Promise<string[]> { return new Promise<string[]>((resolve, reject) => { this.rdbStore?.querySql(`PRAGMA table_info(${tableName})`) .then((result) => { let rowNames: string[] = []; if (result.rowCount <= 0) { Logger.debug('无结果'); ...
AST#method_declaration#Left queryRowNames AST#parameter_list#Left ( AST#parameter#Left tableName : 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 ...
queryRowNames(tableName: string): Promise<string[]> { return new Promise<string[]>((resolve, reject) => { this.rdbStore?.querySql(`PRAGMA table_info(${tableName})`) .then((result) => { let rowNames: string[] = []; if (result.rowCount <= 0) { Logger.debug('无结果'); ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L98-L120
19732a9d027589c2682a9f93f2bc328939815207
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/LogUtil.ets
arkts
TODO 日志工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class LogUtil { private static logSize: number = 2048; private static domain: number = 0x0000; private static tag: string = 'HarmonyUtilsLog'; //日志Tag private static showLog: boolean = true; //是否显示打印日志 private static isHilog: boolean = true; //true-hilog、false-console /** * 初始化日志参数(该方法建议在Abilit...
AST#export_declaration#Left export AST#class_declaration#Left class LogUtil AST#class_body#Left { AST#property_declaration#Left private static logSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2048 AST#expression#Right ; AST#property_d...
export class LogUtil { private static logSize: number = 2048; private static domain: number = 0x0000; private static tag: string = 'HarmonyUtilsLog'; private static showLog: boolean = true; private static isHilog: boolean = true; static init(domain: number = LogUtil.domain, tag: string = LogUtil.ta...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/LogUtil.ets#L27-L210
a09b903bbc12abccab9c2bd6caa76da395ce720b
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
自定义绘制装饰器基类 -- 推荐继承此类
export abstract class BaseAxisDecorator { // private _invalidateCallback: (() => void) | null = null; // /** // * 内部方法:由AxisRender设置刷新回调 // * @internal 开发者不应调用此方法 // */ // _setInvalidateCallback(callback: () => void): void { // this._invalidateCallback = callback; // } /** ...
AST#export_declaration#Left export AST#class_declaration#Left abstract class BaseAxisDecorator AST#class_body#Left { // private _invalidateCallback: (() => void) | null = null; // /** // * 内部方法:由AxisRender设置刷新回调 // * @internal 开发者不应调用此方法 // */ // _setInvalidateCallback(callback: () => void): void { // this._inva...
export abstract class BaseAxisDecorator { protected requestInvalidate(): void { const callback = decoratorInvalidateMap.get(this); if (callback) { callback(); } } update(_: number): void { } abstract onDra...
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L143-L175
e78b5cd4cf271ce3a4161e732917a4383b570a19
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
@description It is used for formatting time and displayed in the form of HH: mm @param value
export const formatTime = (value: TimePickerResult) => { let hour = value?.hour ? value?.hour : 8; let minute = value?.minute ? value?.minute : 0; return `${padTo2Digits(hour)}:${padTo2Digits(minute)}`; } /** * @description Range of generated drinking water 0.25 - 5 L * @return Array<string> */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left formatTime = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left TimePickerResult AST#primary_type#Right AST#type_annotation#Rig...
export const formatTime = (value: TimePickerResult) => { let hour = value?.hour ? value?.hour : 8; let minute = value?.minute ? value?.minute : 0; return `${padTo2Digits(hour)}:${padTo2Digits(minute)}`; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets#L207-L216
b4b9abc5fa4f5e135ce78e0f78599ef2183def67
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/model/ImageKnifeData.ets
arkts
缓存策略
export enum CacheStrategy { // 默认-写入/读取内存和文件缓存 Default = 0, // 只写入/读取内存缓存 Memory = 1, // 只写入/读取文件缓存 File = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum CacheStrategy AST#enum_body#Left { // 默认-写入/读取内存和文件缓存 AST#enum_member#Left Default = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , // 只写入/读取内存缓存 AST#enum_member#Left Memory = AST#expression#Left 1 AST#expression#Right AST#enum_member...
export enum CacheStrategy { Default = 0, Memory = 1, File = 2 }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L88-L95
d272dce6e30febee7c01afdd66552c448b7053b2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/response/DictDataResponse.ets
arkts
@file 字典数据响应 @author Joker.X
export class DictDataResponse { /** * 订单取消原因字典 */ orderCancelReason?: DictItem[] | null = null; /** * 订单退款原因字典 */ orderRefundReason?: DictItem[] | null = null; /** * 反馈类型字典 */ feedbackType?: DictItem[] | null = null; constructor(init?: Partial<DictDataResponse>) { if (!init) { ...
AST#export_declaration#Left export AST#class_declaration#Left class DictDataResponse AST#class_body#Left { /** * 订单取消原因字典 */ AST#property_declaration#Left orderCancelReason ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left DictItem [ ] AST#array_type#Right AST#primary_type...
export class DictDataResponse { orderCancelReason?: DictItem[] | null = null; orderRefundReason?: DictItem[] | null = null; feedbackType?: DictItem[] | null = null; constructor(init?: Partial<DictDataResponse>) { if (!init) { return; } this.orderCancelReason = init.orderCancelReason ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/response/DictDataResponse.ets#L7-L35
2226e218f5fc2a190aba26358b4f351035d25328
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets
arkts
Ensures that this month has an index file. If there doesn't exist such, then create one.
export function ensure_this_month_index_file() { // Create this month index const current_year: number = new Date().getUTCFullYear(); const current_month: number = new Date().getUTCMonth() + 1; const this_month_file_path = index_path_of_month(current_year, current_month); if (!fileIo.accessSync(meowContext()....
AST#export_declaration#Left export AST#function_declaration#Left function ensure_this_month_index_file AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // Create this month index AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left current_year : AST#type_an...
export function ensure_this_month_index_file() { const current_year: number = new Date().getUTCFullYear(); const current_month: number = new Date().getUTCMonth() + 1; const this_month_file_path = index_path_of_month(current_year, current_month); if (!fileIo.accessSync(meowContext().filesDir + '/' + this_mont...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L316-L328
13b0eeaf4cd5780658f6c69730d0a956abef60f4
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/an0n-chat-lib/0.1.5/package/build/service/service.ets
arkts
tokens
添加调试Token
tokens.add(new Token(this, TokenType.MFA, "mfa.gZ3ga7RSOLslnH5MEWC5O8-VsX5xvWswilndBYCbUy6gQhG4NYVr4fES14P9AsHgKN7-2LIzRyw3YhQNGP-g"));
AST#method_declaration#Left tokens AST#ERROR#Left . add ( new Token AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right , AST#parameter#Left TokenType AST#parameter#Right AST#ERROR#Left . MFA , "mfa.gZ3ga7RSOLslnH5MEWC5O8-VsX5xvWswilndBYCbUy6gQhG4NYVr4fES14P9AsHgKN7-2LIzRyw3YhQNGP-g" A...
tokens.add(new Token(this, TokenType.MFA, "mfa.gZ3ga7RSOLslnH5MEWC5O8-VsX5xvWswilndBYCbUy6gQhG4NYVr4fES14P9AsHgKN7-2LIzRyw3YhQNGP-g"));
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/service.ets#L50-L50
3ec08b314f694e3ab9f76a5468abc8c8fdeea98c
github
westinyang/f-oh
0b3022f69a2b7f8331b92ed18851050c1639f2c9
entry/src/main/ets/components/AppListItem.ets
arkts
openApp
打开应用
openApp() { // 检查应用是否已经安装,并获取指定包名应用的启动Ability名 let bundleName = this.appInfo.packageName; let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY; let userId = 100; try { bundleManager.getBundleInfo(bundleName, bundleFl...
AST#method_declaration#Left openApp AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 检查应用是否已经安装,并获取指定包名应用的启动Ability名 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleName = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#mem...
openApp() { let bundleName = this.appInfo.packageName; let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY; let userId = 100; try { bundleManager.getBundleInfo(bundleName, bundleFlags, userId, (err, data) => { ...
https://github.com/westinyang/f-oh/blob/0b3022f69a2b7f8331b92ed18851050c1639f2c9/entry/src/main/ets/components/AppListItem.ets#L249-L286
467a9fbd5acf1206c7dbc74fbadc87e8a3670e31
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/HMenuItem.ets
arkts
首页目录信息单元配置类 @author 却家庭 @version 1.0 @date 2024.10.10
export interface HMenuItem { /** * 编号 */ id: number; /** * 背景图片 */ bgImg: Resource; /** * 名称 */ title: Resource | string; /** * 名称 */ desc: Resource | string; /** * 跳转路径 */ url:string; /** * 欢迎提示词 */ welcomeMessage:string; /** * 输入框提示词 */ inp...
AST#export_declaration#Left export AST#interface_declaration#Left interface HMenuItem AST#object_type#Left { /** * 编号 */ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 背景图片 */ AST#type_member#Left...
export interface HMenuItem { id: number; bgImg: Resource; title: Resource | string; desc: Resource | string; url:string; welcomeMessage:string; inputTextPlaceHolder:string; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/HMenuItem.ets#L8-L44
292a08fe0356a90c33ee5fab26cc22cbd3807691
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/pages/MultiScene.ets
arkts
onPortrait
监听横竖屏
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { // 若设备为横屏状态,更改相应的页面布局 this.isVertical = true this.barWidth = 100 this.barHeight = 200 } else { this.isVertical = false this.barWidth = -1 this.barHeight = -1 } }
AST#method_declaration#Left onPortrait AST#parameter_list#Left ( AST#parameter#Left mediaQueryResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaquery . MediaQueryResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R...
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { this.isVertical = true this.barWidth = 100 this.barHeight = 200 } else { this.isVertical = false this.barWidth = -1 this.barHeight = -1 } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/pages/MultiScene.ets#L31-L41
fdc0469fb9c5f4aeac58fb95e0a908f56eb666ea
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
AddressRecognize
场景描述: 本示例使用CoreVisionKit智能识别图片中的文字,并使用NaturalLanguageKit自然语言处理工具集将识别的文字智能转换为姓名、手机、地址等信息 推荐场景: 扫描图片获取图片内文字场景,如:文本扫描、快递地址识别等 核心组件: 1. AddressRecognize.addressPanel 实现步骤: 1. 点击【从相册选择】打开图库,选择一张带有地址信息的照片,选择完照片打开照片裁剪弹窗界面。也可以选择拍照获取带地址的图片 2. 加载选择的图片,使用Cavas绘制蒙层、裁剪框等 3. 点击完成。调用pixelMap.crop完成图片裁剪,将裁剪后的pixelMap返回到主页面进行识别 4. 调...
@Component export struct AddressRecognize { @State bottomHeight: number = 0; // 底部系统导航栏高度 context: common.UIAbilityContext | undefined = (getContext(this) as common.UIAbilityContext); savePath: string = getContext().filesDir; dialogId: string = '1'; //显示 @State showMenu: boolean = false; loadingId: number...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AddressRecognize AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bottomHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t...
@Component export struct AddressRecognize { @State bottomHeight: number = 0; context: common.UIAbilityContext | undefined = (getContext(this) as common.UIAbilityContext); savePath: string = getContext().filesDir; dialogId: string = '1'; @State showMenu: boolean = false; loadingId: number = -1; @State ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L52-L319
484189bc1deadd051fa1cbfd693a49dd28442b49
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/CropCircleTransformation.ets
arkts
CropCircleTransformation
图片变换:圆形裁剪效果
@Sendable export class CropCircleTransformation extends PixelMapTransformation { private mCenterX: number = 0; private mCenterY: number = 0; private mRadius: number = 0; constructor() { super(); } getName(): string { return this.constructor.name + ';mCenterX:' + this.mCenterX + ';mCenterY:' + this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class CropCircleTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private mCenter...
@Sendable export class CropCircleTransformation extends PixelMapTransformation { private mCenterX: number = 0; private mCenterY: number = 0; private mRadius: number = 0; constructor() { super(); } getName(): string { return this.constructor.name + ';mCenterX:' + this.mCenterX + ';mCenterY:' + this...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/CropCircleTransformation.ets#L22-L89
645d55f604c9f84f577ae1417d810ae0c0322161
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setShadowColor
Sets shadow color for all entries @param shadowColor
public setShadowColor(shadowColor: number): void { this.mShadowColor = shadowColor; }
AST#method_declaration#Left public setShadowColor AST#parameter_list#Left ( AST#parameter#Left shadowColor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pri...
public setShadowColor(shadowColor: number): void { this.mShadowColor = shadowColor; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L269-L271
eebeee9c02bd20fa459f6d75d14abc9e64e1f3b8
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * FontWeight bolder. */ static readonly FONT_WEIGHT_BOLDER: number = 500; /** * Weight of 100%. */ static readonly FULL_WIDTH: string = '100%'; /** * Height of 100%. */ static readonly FULL_HEIGHT: string = '100%'; /** * Music list page. */ stat...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * FontWeight bolder. */ AST#property_declaration#Left static readonly FONT_WEIGHT_BOLDER : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expr...
export class CommonConstants { static readonly FONT_WEIGHT_BOLDER: number = 500; static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; static readonly PAGE_MUSIC_LIST: string = 'pages/MusicList'; static readonly PAGE_PLAY: string = 'pages/Play'; static ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L181
a12c4fada853f86c6cdc0be0a2452a0f556f88fd
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/ConfigService.ets
arkts
getMaskedApiKey
获取脱敏的API密钥(用于显示) @returns 脱敏后的密钥
async getMaskedApiKey(): Promise<string> { if (!this.dataPreferences) { return ''; } try { const apiKey = await this.dataPreferences.get(ConfigService.KEY_API_KEY, '') as string; if (apiKey.length === 0) { return ''; } // 只显示前4位和后4位 if (apiKey.length <= 8) { ...
AST#method_declaration#Left async getMaskedApiKey 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 string AST#primary_type#Right AST#type_annotation#Right > AST#typ...
async getMaskedApiKey(): Promise<string> { if (!this.dataPreferences) { return ''; } try { const apiKey = await this.dataPreferences.get(ConfigService.KEY_API_KEY, '') as string; if (apiKey.length === 0) { return ''; } if (apiKey.length <= 8) { return '...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L231-L253
e2589405aa05f9e754722bbb955870423600c0d7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/lottieview/Index.ets
arkts
LottieView
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 { LottieView } from './src/main/ets/view/LottieView'
AST#export_declaration#Left export { LottieView } from './src/main/ets/view/LottieView' AST#export_declaration#Right
export { LottieView } from './src/main/ets/view/LottieView'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/lottieview/Index.ets#L15-L15
61b294afcf25f82356871ac9b04cac56c14659ab
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
load_string_array
Loads a string array as a key combination, OVERWRITING whatever this combination was. @param combination A string[], containing the keys. e.g. ['a', 'ctrl', 'shift']
load_string_array(combination: string[]) { if (combination.length == 0) { return; } // clear keys this.clear_combination(); // Determine new keys let new_modifiers: Array<ModifierKey> = []; let new_main_key: string | FunctionKey = ''; for (let index = 0; index < combination.length...
AST#method_declaration#Left load_string_array AST#parameter_list#Left ( AST#parameter#Left combination : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
load_string_array(combination: string[]) { if (combination.length == 0) { return; } this.clear_combination(); let new_modifiers: Array<ModifierKey> = []; let new_main_key: string | FunctionKey = ''; for (let index = 0; index < combination.length; index++) { let key_str = c...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L192-L221
b802ee47b31857e0ce62dd89a73f9d00bf7e1f88
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
entry/src/main/ets/dialog/DialogStyle.ets
arkts
设置组件 navigation模式弹窗 全局样式
export class DialogStyle { /** * 初始化全局样式 */ static init() { DialogHub.init((config) => { // ------------ 弹窗通用样式 ------------ config.maxWidth = 280 //弹窗最大宽度 config.borderRadius = 20 //弹窗 圆角 config.maskColor = 'rgba(0, 0, 0, 0.7)' //背景遮罩颜色覆盖 // ------------ 组件样式 ------------...
AST#export_declaration#Left export AST#class_declaration#Left class DialogStyle AST#class_body#Left { /** * 初始化全局样式 */ AST#method_declaration#Left static init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression...
export class DialogStyle { static init() { DialogHub.init((config) => { config.maxWidth = 280 config.borderRadius = 20 config.maskColor = 'rgba(0, 0, 0, 0.7)' config.pickerSpecifyOptions.canLoop = false config.pickerSpecifyOptions.style.buttonFontColorPrim...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/dialog/DialogStyle.ets#L36-L116
95e70e6868c9486c2ebcb0cde5a8fe378101b21a
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/DailySummary.ets
arkts
getMoodTrendDisplayName
Get mood trend display name
getMoodTrendDisplayName(): string { switch (this.moodTrend) { case 'positive': return '积极'; case 'negative': return '低落'; default: return '平稳'; } }
AST#method_declaration#Left getMoodTrendDisplayName 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component...
getMoodTrendDisplayName(): string { switch (this.moodTrend) { case 'positive': return '积极'; case 'negative': return '低落'; default: return '平稳'; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/DailySummary.ets#L106-L115
0dbd59a13cde1de6745a6148b611fdf9ab30c55c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/Index.ets
arkts
ChatListDisplayView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { ChatListDisplayView } from './src/main/ets/pages/ChatListPage'
AST#export_declaration#Left export { ChatListDisplayView } from './src/main/ets/pages/ChatListPage' AST#export_declaration#Right
export { ChatListDisplayView } from './src/main/ets/pages/ChatListPage'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/Index.ets#L16-L16
04d103eeb110a80cdfb9b8b40941c7c9eb387bec
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
markSuggestionAsRead
标记建议为已读
markSuggestionAsRead(suggestionId: string): void { const suggestion = this.smartSuggestions.find(s => s.id === suggestionId); if (suggestion) { suggestion.read = true; } }
AST#method_declaration#Left markSuggestionAsRead AST#parameter_list#Left ( AST#parameter#Left suggestionId : 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#pri...
markSuggestionAsRead(suggestionId: string): void { const suggestion = this.smartSuggestions.find(s => s.id === suggestionId); if (suggestion) { suggestion.read = true; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L553-L558
973c2c0496b370fc1ebe97ef0d1cb0e408ed0a02
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getWeekDay
确定给的日期是星期几 @param year 年 @param month 月 @param day 日 @returns 周几
static getWeekDay(year: number, month: number, day: number): number { const DATE = new Date(year, month - 1, day); return DATE.getDay(); }
AST#method_declaration#Left static getWeekDay AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
static getWeekDay(year: number, month: number, day: number): number { const DATE = new Date(year, month - 1, day); return DATE.getDay(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L33-L36
b819cf0f47ac66932aab819343373c5350a93fb5
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/LocalStoragePage.ets
arkts
LocalStorageContent
本地存储示例页内容视图 @returns {void} 无返回值
@Builder private LocalStorageContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { this.InputSection(); SpaceVerticalLarge(); this.ActionSection(); SpaceVerticalLarge(); this.ResultSection(); }; }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LocalStorageContent 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 MediumPaddingVerticalScroll ( ) AST#container_...
@Builder private LocalStorageContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { this.InputSection(); SpaceVerticalLarge(); this.ActionSection(); SpaceVerticalLarge(); this.ResultSection(); }; }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/LocalStoragePage.ets#L37-L48
8cc831f602b38c28920bda1bfc0563c9fb1a05fb
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
构建数据库示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_database_title"), viewModel: this.vm }) { this.DatabaseContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_dat...
build() { AppNavDestination({ title: $r("app.string.demo_database_title"), viewModel: this.vm }) { this.DatabaseContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L43-L50
e7572eadf0f21aa1dd0b79c005d046945d91f7d6
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/SettingsPage.ets
arkts
loadLogContent
加载日志内容
private async loadLogContent(fileName: string): Promise<void> { this.logService.info('SettingsPage', `开始加载日志内容: ${fileName}`); try { this.logContent = await this.logService.readLogFile(fileName); this.logService.info('SettingsPage', `日志内容加载成功,长度: ${this.logContent.length}`); } catch (error) { ...
AST#method_declaration#Left private async loadLogContent AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
private async loadLogContent(fileName: string): Promise<void> { this.logService.info('SettingsPage', `开始加载日志内容: ${fileName}`); try { this.logContent = await this.logService.readLogFile(fileName); this.logService.info('SettingsPage', `日志内容加载成功,长度: ${this.logContent.length}`); } catch (error) { ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L139-L150
c501af4bbf957bfacbeea225811155a3cf850612
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/experiment/AbilityKit/DeepLink/StartApplication/entry/src/main/ets/pages/Index.ets
arkts
openLinkTargetApplication
openLink方式拉起目标应用
openLinkTargetApplication(){ let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; let link: string = "http://www.example.com/path1"; let openLinkOptions: OpenLinkOptions = { appLinkingOnly: false }; try { context.openLink(link, openLinkOptions) .the...
AST#method_declaration#Left openLinkTargetApplication AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityConte...
openLinkTargetApplication(){ let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; let link: string = "http://www.example.com/path1"; let openLinkOptions: OpenLinkOptions = { appLinkingOnly: false }; try { context.openLink(link, openLinkOptions) .the...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/DeepLink/StartApplication/entry/src/main/ets/pages/Index.ets#L29-L45
6237da04ae8f3d53531d29daa327c572fb545a08
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.advertising.AutoAdComponent.d.ets
arkts
The method to build auto ad component. @syscap SystemCapability.Advertising.Ads @since 11 The method to build auto ad component. @syscap SystemCapability.Advertising.Ads @atomicservice @since 12
build(): void; } export { AutoAdComponent }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ; } export AST#ERROR#Right AST#build_body#Left { AST#expression_statement#Left AST#expression#Left AutoAdComponent AST#expression#Right AST#expression_statement#Right } A...
build(): void; } export { AutoAdComponent }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.advertising.AutoAdComponent.d.ets#L100-L102
1ecbf39b7f79038342569e8a0b017d78f971e8ed
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/Range.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class Range { public myfrom: number = 0.0; public to: number = 0.0; constructor(myfrom: number, to: number) { this.myfrom = myfrom; this.to = to; } /** * Returns true if this range contains (if the value is in between) the given value, false if not. * * @param value * @ret...
AST#export_declaration#Left export default AST#class_declaration#Left class Range AST#class_body#Left { AST#property_declaration#Left public myfrom : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.0 AST#expression#Right ; AST#property_decla...
export default class Range { public myfrom: number = 0.0; public to: number = 0.0; constructor(myfrom: number, to: number) { this.myfrom = myfrom; this.to = to; } public contains(value: number): boolean { if (value > this.myfrom && value <= this.to) return true; else return f...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/Range.ets#L16-L46
b9bded646a0bcaf25a649853ff6306202e2a1c62
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getCorrectedWords
获取正确回答的单词
getCorrectedWords(): WordUser[] { const correctedWords: WordUser[] = []; const aliveUnits = this.getAliveUnits(); aliveUnits.forEach(unit => { correctedWords.push(...unit.correctedWords); }); return correctedWords; }
AST#method_declaration#Left getCorrectedWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio...
getCorrectedWords(): WordUser[] { const correctedWords: WordUser[] = []; const aliveUnits = this.getAliveUnits(); aliveUnits.forEach(unit => { correctedWords.push(...unit.correctedWords); }); return correctedWords; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L465-L474
2b37c0d9ee2949011cb926157dc4063416a300dc
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
getMinAngleForSlices
The minimum angle slices on the chart are rendered with, default is 0f. @return minimum angle for slices
public getMinAngleForSlices(): number { return this.mMinAngleForSlices; }
AST#method_declaration#Left public getMinAngleForSlices AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#mem...
public getMinAngleForSlices(): number { return this.mMinAngleForSlices; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L829-L831
23cb9dcec31611ac5b258e51a12b5a3d66c7d9e9
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/CommonConstaint.ets
arkts
The x location to be changed.
export const XLocationEnum: XLocationEnumInterface = { XLeft: 0, XRight: 1, noChange: -1 } /** * The y location to be changed. */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left XLocationEnum : AST#type_annotation#Left AST#primary_type#Left XLocationEnumInterface AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#prop...
export const XLocationEnum: XLocationEnumInterface = { XLeft: 0, XRight: 1, noChange: -1 }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/CommonConstaint.ets#L31-L39
73e4e1831d59e192ae1597c4fdce19aa846b4c37
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets
arkts
VideoListAutoplayComponent
视频列表权重 功能描述: 利用onScrollIndex获取List显示区域内中间子组件索引值的能力来判断播放,利用懒加载场景会预加载List显示区域外cachedCount的内容的能力来实现视频连续播放的功能。 推荐场景:视频列表滑动到屏幕中间自动播放场景 核心组件: 1. XComponentVideo 实现步骤: 1.首先加载图片,使用Stack将Image覆盖在XComponent上,并使用visibility来控制图片的显示。 2.使用LoadingProgress来表示视频正在加载中,当AVPlayer走到playing隐藏LoadingProgress。 3.使用onScrollIndex来获取List显示区域...
@Component export struct VideoListAutoplayComponent { @State currentIndex: TabBarType = TabBarType.DISCOVER; // Tab组件当前选中index值 private newsList: NewsListDataSource = new NewsListDataSource(); // 视频信息集合 @Provide isLoading: boolean = true; // 视频是否加载中 @State centerIndex: number = -1; // List显示区域内中间子组件索引值 about...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoListAutoplayComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_ty...
@Component export struct VideoListAutoplayComponent { @State currentIndex: TabBarType = TabBarType.DISCOVER; private newsList: NewsListDataSource = new NewsListDataSource(); @Provide isLoading: boolean = true; @State centerIndex: number = -1; aboutToAppear(): void { NEWS_LIST_DATA.forEach((news:...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets#L42-L153
484aa61adf30a8ca9b95a7a5ae7cc778297c9900
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets
arkts
beforeSnapshot
截图开始前的操作。 - 保存滚动组件当前位置,用于恢复状态 - 截图当前页面作为遮罩层,避免用户察觉组件的滚动,提高用户体验 - 滚动组件页面滚动到顶部,准备开始截图 - 设置截图后小弹窗的位置,提示用户暂时不要操作,等待截图 - 开启提示小弹窗
async beforeSnapshot() { // 保存组件当前位置,用于恢复 this.xOffsetBefore = this.curXOffset; this.yOffsetBefore = this.curYOffset; this.snapHeight = this.curYOffset + Math.ceil(this.listComponentHeight); // TODO: 知识点: 使用componentSnapshot.get接口直接获取组件的渲染结果,而不需要将屏幕截图 this.componentMaskImage = await componentSn...
AST#method_declaration#Left async beforeSnapshot AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 保存组件当前位置,用于恢复 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xOffsetBefor...
async beforeSnapshot() { this.xOffsetBefore = this.curXOffset; this.yOffsetBefore = this.curYOffset; this.snapHeight = this.curYOffset + Math.ceil(this.listComponentHeight); this.componentMaskImage = await componentSnapshot.get(Constants.COMPONENT_ID); this.componentMaskImageZIndex = Cons...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets#L397-L420
e13a536a6e03fab1bf3ae18db277efcd2916b431
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/feedback/src/main/ets/navigation/FeedbackListNav.ets
arkts
FeedbackListNav
@file 反馈列表页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function FeedbackListNav(): void { FeedbackListPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function FeedbackListNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custo...
@Builder export function FeedbackListNav(): void { FeedbackListPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/navigation/FeedbackListNav.ets#L8-L11
e5c64afafcc3689b0344339a2a94d0222aac8616
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets
arkts
自定义浏览器对象
export class Browser { inputValue: string = ""; progress: number = 0; isRegistered: boolean = false; hideProgress: boolean = true; tabsController: TabsController = new TabsController(); webController: WebviewController = new web_webview.WebviewController(); // 跳转页面 loadUrl(addr: string | Resource) { ...
AST#export_declaration#Left export AST#class_declaration#Left class Browser AST#class_body#Left { AST#property_declaration#Left inputValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Rig...
export class Browser { inputValue: string = ""; progress: number = 0; isRegistered: boolean = false; hideProgress: boolean = true; tabsController: TabsController = new TabsController(); webController: WebviewController = new web_webview.WebviewController(); loadUrl(addr: string | Resource) { if (a...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets#L18-L53
3ae8df877fc8b680e9ab78f828f54c16b9b3f66a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey SM2公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns 验签结果,其中Msg为验签结果
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false); }
AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L84-L88
bb255ecd7465265c89c1c7cfa894cead49028aee
gitee
youfrweb/harmonyProject.git
c95207f5ef319719a960c9e9a75b0c14a24842eb
entry/src/main/ets/pages/activity/Activity.ets
arkts
TabEachBuilder
加载菜单对应的组件
@Builder TabEachBuilder(index: number) { if (index === 0) { NewProduct() } else if (index === 1) { Text(index.toString()) } else if (index === 2) { Text(index.toString()) } else { Text(index.toString()) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabEachBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body...
@Builder TabEachBuilder(index: number) { if (index === 0) { NewProduct() } else if (index === 1) { Text(index.toString()) } else if (index === 2) { Text(index.toString()) } else { Text(index.toString()) } }
https://github.com/youfrweb/harmonyProject.git/blob/c95207f5ef319719a960c9e9a75b0c14a24842eb/entry/src/main/ets/pages/activity/Activity.ets#L36-L47
25dd4fde89fd236c68c489c3d76849fe5ded3bb2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/view/ProductView.ets
arkts
GoodViewStruct
文字和图片之间的间距
@Component export default struct GoodViewStruct { @Link model: FistGoodsModel; // 与父组件VariableWatchView建立双向数据同步 build() { Column() { SecondViews({ data: this.model.itemList}) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct GoodViewStruct AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right model : AST#type_annotation#Left AST#primary_type#Left FistGoodsModel AST#primary_type#Right...
@Component export default struct GoodViewStruct { @Link model: FistGoodsModel; build() { Column() { SecondViews({ data: this.model.itemList}) } } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/view/ProductView.ets#L20-L29
58a5565cef3f7c0ed5dbfa7f68ad6160ea154978
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/entry/src/main/ets/pages/Index.ets
arkts
myAsyncFunction
[Start async_operation_error_handling_with_try_catch] async function myAsyncFunction(): Promise<void> { try { const result: string = await new Promise((resolve: Function) => { resolve('Hello, world!'); }); } catch (e) { console.error(`Get exception: ${e}`); } } [End async_operation_error_handling_with_try_catch] [Star...
async function myAsyncFunction(): Promise<string> { const result: string = await new Promise((resolve: Function) => { setTimeout(() => { resolve('Hello, world!'); }, 3000); }); console.info(result); // 输出: Hello, world! return result; }
AST#function_declaration#Left async function myAsyncFunction 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 string AST#primary_type#Right AST#type_annotation#Righ...
async function myAsyncFunction(): Promise<string> { const result: string = await new Promise((resolve: Function) => { setTimeout(() => { resolve('Hello, world!'); }, 3000); }); console.info(result); return result; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/AsyncConcurrencyOverview/entry/src/main/ets/pages/Index.ets#L56-L64
a0c5ff7061e53b60c68a82a3c9f68bf1b9c9f89c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineRadarDataSet.ets
arkts
setLineWidth
set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE: thinner line == better performance, thicker line == worse performance @param width
public setLineWidth(width: number): void { if (width < 0.0) width = 0.0; if (width > 10.0) width = 10.0; this.mLineWidth = width; }
AST#method_declaration#Left public setLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
public setLineWidth(width: number): void { if (width < 0.0) width = 0.0; if (width > 10.0) width = 10.0; this.mLineWidth = width; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineRadarDataSet.ets#L118-L125
edf56701879aa9e53ebbf6e5d724ba3d1b5ba4f3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
getSolarFestivals
获取公历节日
public static getSolarFestivals(): FestivalInfo[] { return SOLAR_FESTIVALS; }
AST#method_declaration#Left public static getSolarFestivals AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FestivalInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#r...
public static getSolarFestivals(): FestivalInfo[] { return SOLAR_FESTIVALS; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L200-L202
f202d9f4be2688eb6757e3c4b9fe8584fae3e584
github