nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
common/uicomponent/Index.ets
arkts
CustomDialog_Warning
Copyright (c) 2024 Yang He TickAuth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be...
export { CustomDialog_Warning } from './src/main/ets/pages/Warning'
AST#export_declaration#Left export { CustomDialog_Warning } from './src/main/ets/pages/Warning' AST#export_declaration#Right
export { CustomDialog_Warning } from './src/main/ets/pages/Warning'
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/common/uicomponent/Index.ets#L18-L18
e101dcc4722b80dfe7f5f7b2eed9412ed3ee70b2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
initialize
初始化存储管理器 @param context 应用上下文
static async initialize(context: common.UIAbilityContext): Promise<boolean> { try { this.context = context; // 初始化默认存储 const defaultPrefs = await dataPreferences.getPreferences(context, AppConstants.STORAGE_NAME); this.preferences.set(AppConstants.STORAGE_NAME, defaultPrefs); /...
AST#method_declaration#Left static async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R...
static async initialize(context: common.UIAbilityContext): Promise<boolean> { try { this.context = context; const defaultPrefs = await dataPreferences.getPreferences(context, AppConstants.STORAGE_NAME); this.preferences.set(AppConstants.STORAGE_NAME, defaultPrefs); cons...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L43-L62
5bc61c59abbe094e69ce1415cf5a9b8873155e40
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
strToBuffer
字符串转ArrayBuffer @param str @returns
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { let buf = buffer.from(src, encoding); return buf.buffer }
AST#method_declaration#Left static strToBuffer AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L...
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { let buf = buffer.from(src, encoding); return buf.buffer }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L251-L254
8efd4ececd026de66d44f56bbf462022ed41d703
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Callback for OnLoadIntercept @typedef { function } OnLoadIntercept Function. @param { OnLoadInterceptEvent } event - the load intercept event when the resources loading is intercepted. @returns { boolean } True if the load is intercepted else false. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export type OnLoadInterceptCallback = (event: OnLoadInterceptEvent) => boolean;
AST#export_declaration#Left export AST#type_declaration#Left type OnLoadInterceptCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnLoadInterceptEvent AST#primary_type#Right AST#type_annotation#Right AST#parame...
export type OnLoadInterceptCallback = (event: OnLoadInterceptEvent) => boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L513-L513
b58c3c65087ec5bfddd117dcd7f4c043548ecbca
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getFavourite
获取收藏列表 @param includeItemTypes @returns
public getFavourite(includeItemTypes?: Array<FinItemType>): Promise<Array<FinItem>> { return this.requireApi().getFavourite(includeItemTypes) }
AST#method_declaration#Left public getFavourite AST#parameter_list#Left ( AST#parameter#Left includeItemTypes ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItemType AST#primary_type#Right AST#type_annotation#Rig...
public getFavourite(includeItemTypes?: Array<FinItemType>): Promise<Array<FinItem>> { return this.requireApi().getFavourite(includeItemTypes) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L134-L136
0b36c33ea56affebbd973f04ee5fd4126b6c1358
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets
arkts
defaultDeleteBuilder
删除按钮 @param item: 删除的列表项
@Builder defaultDeleteBuilder(item: Object) { Image($r("app.media.list_exchange_icon_delete")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .margin({ right: $r('app.integer.list_exchange_delete_icon_margin_r...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right defaultDeleteBuilder AST#parameter_list#Left ( AST#parameter#Left item : 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...
@Builder defaultDeleteBuilder(item: Object) { Image($r("app.media.list_exchange_icon_delete")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .margin({ right: $r('app.integer.list_exchange_delete_icon_margin_r...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L106-L118
563e8666d8a43e1477e801d27d1fabbe8bac2e00
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Form/FormHost/entry/src/main/ets/pages/Index.ets
arkts
getAllBundleFormsInfo
将所有卡片信息存入formHapRecordMap中。
getAllBundleFormsInfo() { this.formCardHashMap.clear(); this.showFormPicker = false; let formHapRecordMap: HashMap<string, formInfo.FormInfo[]> = new HashMap(); this.formInfoRecord = []; formHost.getAllFormsInfo().then((formList: Array<formInfo.FormInfo>) => { console.log('getALlFormsInfo size...
AST#method_declaration#Left getAllBundleFormsInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AS...
getAllBundleFormsInfo() { this.formCardHashMap.clear(); this.showFormPicker = false; let formHapRecordMap: HashMap<string, formInfo.FormInfo[]> = new HashMap(); this.formInfoRecord = []; formHost.getAllFormsInfo().then((formList: Array<formInfo.FormInfo>) => { console.log('getALlFormsInfo size...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Form/FormHost/entry/src/main/ets/pages/Index.ets#L178-L212
e6f6d674ae6594704843c569e3da5df1807167e8
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/TransitionAnimation/entry/src/main/ets/pages/page/BottomTransition.ets
arkts
pageTransition
页面转场通过全局transition方法进行配置转场参数
pageTransition() { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) // 页面退场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideEff...
AST#method_declaration#Left pageTransition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionEnter ( AST#component_parameters#Left {...
pageTransition() { PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/TransitionAnimation/entry/src/main/ets/pages/page/BottomTransition.ets#L33-L42
840de684e197df4f3aabf1beafe714ad62253177
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceBetween
纵向两端分布 + 水平居中
@ComponentV2 export struct ColumnSpaceBetween { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceBetween 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...
@ComponentV2 export struct ColumnSpaceBetween { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padd...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L385-L460
2c51f1a091da2874bb7464d61775ef08eb24f9fb
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
clear
清除所有数据
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to clear prefer...
AST#method_declaration#Left async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to clear prefer...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L266-L276
afb4d96d832f40317cd235b62969e68b2383a1cf
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/widget/ToolBarComponent.ets
arkts
底部工具栏动作接口
export interface ToolbarActions { /** * 颜色选择回调接口 * @param color 16进制字符串颜色 * @param rgbColor rgb颜色模型 */ onPickColor: (color: string, rgbColor: RgbColor) => void; /** * 旋转回调 * @param angle 旋转角度 */ onRotate: (angle: number) => void; /** * 选择的尺寸回调 * @param size 大小 */ onPickSize: (s...
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolbarActions AST#object_type#Left { /** * 颜色选择回调接口 * @param color 16进制字符串颜色 * @param rgbColor rgb颜色模型 */ AST#type_member#Left onPickColor : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Le...
export interface ToolbarActions { onPickColor: (color: string, rgbColor: RgbColor) => void; onRotate: (angle: number) => void; onPickSize: (size: number) => void; onPickBrushSize: (size: number) => void; }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/widget/ToolBarComponent.ets#L27-L49
d2b1c24c33009c573b6466582ef62926941ebfea
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets
arkts
searchClassificationSelection
搜索添加分类选项
@Builder searchClassificationSelection() { Column() { Column() { Text($r('app.string.search_component_search_classify_fixed_words')) .fontColor($r('app.color.search_classify_fixed_words_color')) } .width('100%') .alignItems(HorizontalAlign.Start) .margin({ bottom: $...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right searchClassificationSelection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left {...
@Builder searchClassificationSelection() { Column() { Column() { Text($r('app.string.search_component_search_classify_fixed_words')) .fontColor($r('app.color.search_classify_fixed_words_color')) } .width('100%') .alignItems(HorizontalAlign.Start) .margin({ bottom: $...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L175-L218
b72332635428b803c934d079fbdacef296860378
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/AddCityPage.ets
arkts
构建页面内容。
build() { Column() { BackContainer({ header: "添加城市" }); List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) { ForEach(WorldClockViewModel.mainCities, (city: CityItem) => { ListItem() { Column() { Text(`${city.city},...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left BackContainer ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expressio...
build() { Column() { BackContainer({ header: "添加城市" }); List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) { ForEach(WorldClockViewModel.mainCities, (city: CityItem) => { ListItem() { Column() { Text(`${city.city},...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/AddCityPage.ets#L32-L67
514394ce6fb4d8a8c321e93d42604ecaaa1547ff
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets
arkts
Generic categorical data, second menu data
export const UNIVERSAL_CATEGORIES: SecondLevelCategory[] = [ { title: $r('app.string.common_events'), childNodes: COMMON_EVENTS }, { title: $r('app.string.common_properties'), childNodes: GRAPHIC_TRANSFORMATION }, { title: $r('app.string.gesture_process'), childNodes: GESTURE } ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left UNIVERSAL_CATEGORIES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SecondLevelCategory [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_lite...
export const UNIVERSAL_CATEGORIES: SecondLevelCategory[] = [ { title: $r('app.string.common_events'), childNodes: COMMON_EVENTS }, { title: $r('app.string.common_properties'), childNodes: GRAPHIC_TRANSFORMATION }, { title: $r('app.string.gesture_process'), childNodes: GESTURE } ];
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets#L263-L268
571890cafa5fb5ddd7e1d10ac3eda28a55a7d031
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareFile
分享任意文件类型 @param filePath - 文件路径 @param title - 分享标题(可选) @param summary - 分享描述(可选) @param customUtd - 自定义UTD类型(可选)
static shareFile( filePath: string, title?: string, summary?: string, customUtd?: string ): void { // 转换文件路径为URI格式 const uri = fileUri.getUriFromPath(filePath); // 自动检测文件类型(基于扩展名) const extension = filePath.split('.').pop() || ''; const detectedUtd = utd.getUniformDataTypeByFilena...
AST#method_declaration#Left static shareFile AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static shareFile( filePath: string, title?: string, summary?: string, customUtd?: string ): void { const uri = fileUri.getUriFromPath(filePath); const extension = filePath.split('.').pop() || ''; const detectedUtd = utd.getUniformDataTypeByFilenameExtension( '.' + extensio...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L87-L126
09be98c8abb0d028421534ddd6f3e7f546dbd9ce
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
isNotificationEnabled
查询通知是否授权
static async isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); //查询通知是否授权。 }
AST#method_declaration#Left static async isNotificationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#R...
static async isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L58-L60
2941edf029b3b3538d85dfe6eecb8e10cc5e80c1
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param iv iv偏移量字符串 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @returns
static async encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { //转换key let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建加密器 ...
AST#method_declaration#Left static async encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static async encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto.create...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L124-L141
c81f2dace6b3a2a484d6b3a017b52cd91a273b7b
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
消息工具函数类 提供批量操作、过滤、分组等实用功能 所有方法都是静态方法,无需实例化
export class MessageUtils { // ========== 批量操作 ========== /** * 批量序列化消息为二进制 * * @param messages 消息数组 * @returns 二进制数据数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const binaries = MessageUtils.toBinaryBatch(people) * ``` */ static toBinaryBatch<T ext...
AST#export_declaration#Left export AST#class_declaration#Left class MessageUtils AST#class_body#Left { // ========== 批量操作 ========== /** * 批量序列化消息为二进制 * * @param messages 消息数组 * @returns 二进制数据数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const binaries = MessageU...
export class MessageUtils { static toBinaryBatch<T extends Message>(messages: T[]): Uint8Array[] { return messages.map(m => m.toBinary()) } static toJsonBatch<T extends Message>(messages: T[]): Record<string, Object>[] { return messages.map(m => m.toJson()) } static cloneBatch<T extends...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L26-L418
459ebfc6d8b72fd504e8197df44683c426873909
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/modalwindow/src/main/ets/model/OtherWaysToLogin.ets
arkts
OtherWaysToLogin
其他账号登录:主要提供短信验证码登录方式,以及其他三方应用登录方式
@Component export struct OtherWaysToLogin { // 发送验证码按钮的颜色 @State buttonColor: ResourceColor = Color.Grey; // 发送验证码按钮的内容 @State buttonContent: ResourceStr = $r('app.string.modalwindow_verify'); // 手机号是否可用 phoneNumberAvailable: boolean = false; // 可发送验证码的倒计时秒数 countdownSeconds: number = 0; // 是否勾选阅读并同意服...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct OtherWaysToLogin AST#component_body#Left { // 发送验证码按钮的颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#prim...
@Component export struct OtherWaysToLogin { @State buttonColor: ResourceColor = Color.Grey; @State buttonContent: ResourceStr = $r('app.string.modalwindow_verify'); phoneNumberAvailable: boolean = false; countdownSeconds: number = 0; isAgree: boolean = false; loginIcons: Resource[] = [$r('app...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/modalwindow/src/main/ets/model/OtherWaysToLogin.ets#L27-L150
bf15702d78bf924e00b9bfee68cfefb200553343
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Unlink (delete) a file. @param file_name A string, the path of the file.
export function sandbox_unlink(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlink(full_file_directory).catch((err: BusinessError) => { console.error(`[sandbox_unlink] Cau...
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_unlink AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : AST#type_...
export function sandbox_unlink(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlink(full_file_directory).catch((err: BusinessError) => { console.error(`[sandbox_unlink] Cau...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L340-L352
872082ad3ff2b04b44245654780d37a1ff602ed5
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/FoldersList.ets
arkts
pageTransition
页面跳转动画。
public pageTransition(): void { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); }
AST#method_declaration#Left public pageTransition 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#Lef...
public pageTransition(): void { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/FoldersList.ets#L121-L126
891e9325eeb6f29e58720b332fdf5422df11cab6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
modifyAllData
改变数组数据 @param data:新数组
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WaterFlowModule [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno...
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L262-L265
3e44965ad3b7f37fd21c229b2ef00b34158ea326
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/model/Constants.ets
arkts
通用常量
export default class Constants { // 扩展后标题继续下拉阈值 public static readonly CONTINUE_PULL_THRESHOLD: number = 90; // 图标下拉的最大距离 public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; // 标题下拉的最大距离 public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; // 标题缩放的最大值 public static readonly TITLE_SCALE_MAX...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 扩展后标题继续下拉阈值 AST#property_declaration#Left public static readonly CONTINUE_PULL_THRESHOLD : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export default class Constants { public static readonly CONTINUE_PULL_THRESHOLD: number = 90; public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; public static readonly TITLE_SCALE_MAX_VALUE: number = 1.2; public static readonly...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/model/Constants.ets#L19-L66
656cc838a6dedbd5f13581180dd813767d323a8e
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
DeleteButton
删除按钮
@Builder DeleteButton(entry: CommandEntryViewModel) { Row() { Button() { Image($r("app.media.trash")) .objectFit(ImageFit.Cover) .width(StyleConstants.SIXTY_PERCENT) .height(StyleConstants.SIXTY_PERCENT) } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteButton AST#parameter_list#Left ( AST#parameter#Left entry : AST#type_annotation#Left AST#primary_type#Left CommandEntryViewModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_...
@Builder DeleteButton(entry: CommandEntryViewModel) { Row() { Button() { Image($r("app.media.trash")) .objectFit(ImageFit.Cover) .width(StyleConstants.SIXTY_PERCENT) .height(StyleConstants.SIXTY_PERCENT) } ...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L222-L242
8cdf07773bfdbb272423dd106814b0e488b214f6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets
arkts
LimitedHeightBottomDialogComponent
功能描述: 本示例介绍了如何实现一个限制高度的底部弹窗,以购物应用的“我的”页面来呈现。当给一个底部弹窗的可滚动区域设置最大高度后, 如果弹窗内部视图的高度超过了这个最大高度,弹窗可滚动区域的高度就是这个最大高度,视图内容不会展示完全,需要滚动查看; 如果弹窗内部视图的高度没有超过这个最大高度,弹窗可滚动区域高度就是视图的高度,视图内容展示完全。 推荐场景: 需要出现底部弹窗 核心组件: LimitedHeightBottomDialog 实现步骤: 1. 创建一个限制高度的底部弹窗,这个弹窗内部视图和可滚动区域的最大高度可以通过外部传入。 2. 创建常用设置底部弹窗的视图和安全设置底部弹窗的视图。 3. 创建常用设置底部弹窗...
@Component export struct LimitedHeightBottomDialogComponent { popPage: (() => void) | undefined = undefined; private firstSectionActionItems: ActionItem[] = [{ id: '0', title: $r('app.string.limited_height_bottom_dialog_my_order'), subTitle: '' }, { id: '1', title: $r('app.string.limited_height_bottom_di...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LimitedHeightBottomDialogComponent AST#component_body#Left { AST#property_declaration#Left popPage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation...
@Component export struct LimitedHeightBottomDialogComponent { popPage: (() => void) | undefined = undefined; private firstSectionActionItems: ActionItem[] = [{ id: '0', title: $r('app.string.limited_height_bottom_dialog_my_order'), subTitle: '' }, { id: '1', title: $r('app.string.limited_height_bottom_di...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets#L57-L138
b6839b114505c7a9d3811ee63ff3950f1c0a251c
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/conditional_stmt/conditional_if_001_T.ets
arkts
Introduction 条件语句-if
export function conditional_if_001_T(taint_src : string) { if (true) { taint.Sink(taint_src) } else {} }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen...
export function conditional_if_001_T(taint_src : string) { if (true) { taint.Sink(taint_src) } else {} }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_001_T.ets#L6-L10
d0b50bbe3791e6b8812a92f9528431fbab008d01
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_004_F.ets
arkts
Introduction 参数传递-参数位置
export function argument_passing_002_F(taint_src : string) { f(taint_src,"_"); }
AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_002_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_statem...
export function argument_passing_002_F(taint_src : string) { f(taint_src,"_"); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_004_F.ets#L6-L8
51978d61c78a27d1354c229b9437a1b6f8150d53
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DatabaseService.ets
arkts
init
初始化数据库
async init(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: Constants.DB_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); // 检查并执行数据库迁移 await ...
AST#method_declaration#Left async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async init(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: Constants.DB_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); await this.checkAnd...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L49-L65
2b53e75f114ca415e037becefa1ba05f62880b7e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/TextPrompts.ets
arkts
TextPopupExample
[Start text_popup]
@Entry @Component export struct TextPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions') .margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePop...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct TextPopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#primary...
@Entry @Component export struct TextPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions') .margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePop...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/TextPrompts.ets#L17-L45
cdc04079771d8a645d8a9c47a933050ef0fbc42e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PickerController
The class for PickerController @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
@Observed export declare class PickerController { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setData(dataType: DataType, data:...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class PickerController AST#class_body#Left { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap Syst...
@Observed export declare class PickerController { setData(dataType: DataType, data: Object): void; addData(dataType: DataType, data: Object): void; deleteData(dataType: DataType, data: Object): void; setMaxSelected(maxSelected: MaxSelected): void; setPhotoBrowserItem(uri: string, photoBrows...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L225-L326
5d0801e128ad08f45f8105cc94df5f0c9cf90ab2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets
arkts
XComponentVideo
视频渲染页面
@Builder XComponentVideo() { Stack(this.player.isLoading ? { alignContent: Alignment.Center } : { alignContent: Alignment.Bottom }) { /** * 视频播放组件 * url:视频源(本案例仅支持使用在线视频) */ XComponentView({ url: this.url }) /** * 音量面板,掉起系统面板将面板通过定位隐藏,使用自定义图标 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right XComponentVideo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#ERROR#Left Stack ( this AST#ERROR#Right AST#modifier_chain_expression#Left . player AST#modifier_chain_expression#Left . isLoading AST#modifier_chain_exp...
@Builder XComponentVideo() { Stack(this.player.isLoading ? { alignContent: Alignment.Center } : { alignContent: Alignment.Bottom }) { XComponentView({ url: this.url }) AVVolumePanel({ volumeLevel: this.volume, volumeParameter: { posi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets#L179-L227
25f8b1f91d591b083c12bc1abc67f977b6f58185
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/util/IOUtils.ets
arkts
getPixelMapFromResource
从resource中取出pixelMap @param resource 指定资源 @returns pixelMap
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> { // 通过资源管理器获取资源的字节数组 const array = await getContext().resourceManager.getMediaContent(resource); // 利用字节数组创建图像源并从中创建 PixelMap return await image.createImageSource(array.buffer).createPixelMap(); }
AST#method_declaration#Left public static async getPixelMapFromResource AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t...
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> { const array = await getContext().resourceManager.getMediaContent(resource); return await image.createImageSource(array.buffer).createPixelMap(); }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/IOUtils.ets#L18-L24
db616a69ebeb8045b461942b2ee64547af0f1e0c
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
日历日期项接口
export interface CalendarDay { day: number isCurrentMonth: boolean date: Date }
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarDay AST#object_type#Left { AST#type_member#Left day : 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 isCurrentMonth : AST#type_annotation...
export interface CalendarDay { day: number isCurrentMonth: boolean date: Date }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L2-L6
9bf2a7886809ee66824cc2ef71ef4e0bb95fe192
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
aboutToDisappear
Call back when the NodeContainer corresponding to the controller is Disappear.
aboutToDisappear(): void { console.info('aboutToDisappear'); }
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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express...
aboutToDisappear(): void { console.info('aboutToDisappear'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L74-L76
449ec76117fad05b117ee3dce02ee3d7c51ddbab
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPictureUI/entry/src/main/ets/view/PreviewList.ets
arkts
PreviewList
图片预览列表
@Component export struct PreviewList { build() { Column() { Text('图片预览列表') .fontSize('24fp') } .height('47vp') .borderColor(Color.Black) .borderWidth('2vp') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PreviewList AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left...
@Component export struct PreviewList { build() { Column() { Text('图片预览列表') .fontSize('24fp') } .height('47vp') .borderColor(Color.Black) .borderWidth('2vp') } }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/view/PreviewList.ets#L4-L16
475e66f7ec0f6c1a27d68865fa7845400628d60a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
goContactEdit
跳转到联系人编辑页面 @param contactId 联系人ID
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId } : {}; const options: RouteOptions = { params }; await this.push(path, options); }
AST#method_declaration#Left async goContactEdit AST#parameter_list#Left ( AST#parameter#Left contactId ? : 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_ty...
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId } : {}; const options: RouteOptions = { params }; await this.push(path, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L277-L283
fd33022b8d5e28fc42a6544d59cccb5f0e572959
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets
arkts
【系统】单选弹窗代理
export class SelectBuilderProxy extends BaseModalBuilderProxy<ISelectDialogOptions, SelectDialog> { constructor(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext) { super(uiContext) this.builderOptions.title = title; this.builderOptions.confirm = confirm; ...
AST#export_declaration#Left export AST#class_declaration#Left class SelectBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseModalBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotati...
export class SelectBuilderProxy extends BaseModalBuilderProxy<ISelectDialogOptions, SelectDialog> { constructor(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext) { super(uiContext) this.builderOptions.title = title; this.builderOptions.confirm = confirm; ...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L9-L60
97a9337b31c9f459bbb886c4e050ebddd0a3bd2d
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/utils/GestureUtils.ets
arkts
shouldTriggerSwipe
判断是否应该触发滑动 @param state - 手势状态 @param threshold - 滑动阈值 @returns 是否应该滑动
static shouldTriggerSwipe(state: GestureState, threshold: number): boolean { const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY); return distance >= threshold; }
AST#method_declaration#Left static shouldTriggerSwipe AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left GestureState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left threshold : AST#type_annotation#Left AST#primary_type#Left numb...
static shouldTriggerSwipe(state: GestureState, threshold: number): boolean { const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY); return distance >= threshold; }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L88-L91
471fe28b1dd031b96c984be42f5a1b772362bc5f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/StateManagementPage.ets
arkts
构建状态管理示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_state_management_title"), viewModel: this.vm }) { this.StateManagementContent(); } }
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_sta...
build() { AppNavDestination({ title: $r("app.string.demo_state_management_title"), viewModel: this.vm }) { this.StateManagementContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/StateManagementPage.ets#L24-L31
e614ee5b7a454538f306ed1b90c5bbe4a03afb34
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
getStatisticsData
获取完整统计数据
async getStatisticsData(): Promise<StatisticsData> { try { const results = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); const overview = results[0]; ...
AST#method_declaration#Left async getStatisticsData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left StatisticsData AST#primary_type#Right AST#type_annotation#Right...
async getStatisticsData(): Promise<StatisticsData> { try { const results = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); const overview = results[0]; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L344-L371
b2ad8ce2b264e1bac55a1b58b4c8b3eab18594a5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
请求公共传参
export class commonParams { /** * 基础请求前缀地址 */ baseURL?: string; /** * 请求路径 必填 */ url: string = ''; /** * 当次请求需要设置的请求头 */ headers?: Record<string, string>; /** * 当次请求需要设置的cookies */ cookies?: Record<string, string>; /** * 当次请求需要设置的loading文本...
AST#export_declaration#Left export AST#class_declaration#Left class commonParams AST#class_body#Left { /** * 基础请求前缀地址 */ AST#property_declaration#Left baseURL ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * ...
export class commonParams { baseURL?: string; url: string = ''; headers?: Record<string, string>; cookies?: Record<string, string>; loadingTxt?: string; loading?: boolean; loadingColor?: string; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L235-L264
4b33d25994f5884dac0626ebd11e630591b8eafe
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets
arkts
initWantAgentNotificationRequest
init wantAgent NotificationRequest @param notificationContent @param notificationWantAgent @return return the created NotificationRequest
initWantAgentNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationWantAgent: WantAgent): notificationManager.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, // 通知id,默认为1 content: notificationContent, wantAgen...
AST#method_declaration#Left initWantAgentNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#p...
initWantAgentNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationWantAgent: WantAgent): notificationManager.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, content: notificationContent, wantAgent: notificat...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets#L42-L49
b0fc1d9f451da9ad0ad4d0821432901dab15e42e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/pages/ZoomChangeColumnPage.ets
arkts
getSize
[StartExclude quick_start]
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } setItemSizeArray(): void { for (let i: number = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
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#variable_declaration#Left let AST#variable_declarator#Left ret : AST#type_an...
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } setItemSizeArray(): void { for (let i: number = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/ZoomChangeColumnPage.ets#L75-L84
b506de20f1ba1f715e0068663c1b25d5bedec41c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
表示商品模型的类型,是嵌套类的首层 @class
export class FistGoodsModel { itemList: SecondGoodsItemList; constructor(itemList: SecondGoodsItemList) { this.itemList = itemList; } }
AST#export_declaration#Left export AST#class_declaration#Left class FistGoodsModel AST#class_body#Left { AST#property_declaration#Left itemList : AST#type_annotation#Left AST#primary_type#Left SecondGoodsItemList AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declarati...
export class FistGoodsModel { itemList: SecondGoodsItemList; constructor(itemList: SecondGoodsItemList) { this.itemList = itemList; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L50-L56
14319d0cb62f01855af40d92730a4619ca6a87f8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
getSafeAreaPadding
获取安全区内边距 @returns {Padding} 安全区内边距
private getSafeAreaPadding(): Padding { return { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, bottom: this.windowSafeAreaState.bottomInset, right: this.windowSafeAreaState.rightInset }; }
AST#method_declaration#Left private getSafeAreaPadding AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Padding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#obj...
private getSafeAreaPadding(): Padding { return { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, bottom: this.windowSafeAreaState.bottomInset, right: this.windowSafeAreaState.rightInset }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L145-L152
8dee193c389a2b2e88f77072c88b09bb405f25a2
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
gpu_transform/index.ets
arkts
GPUImage3x3TextureSamplingFilter
Copyright (C) 2021 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 { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter'
AST#export_declaration#Left export { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter' AST#export_declaration#Right
export { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter'
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/gpu_transform/index.ets#L16-L16
0c956cd89ed327babcf7ed4d3500734f39dda6db
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
customPlugin/library/src/main/ets/components/MainPage.ets
arkts
MainPage
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Preview @Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) }.height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left...
@Preview @Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) }.height('100%') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/customPlugin/library/src/main/ets/components/MainPage.ets#L16-L28
f04da6ffd7968f77bc651c9dcd387ace69e9c130
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/MorePage.ets
arkts
LoadingContent
导入时显示 阻止用户操作
@Builder LoadingContent() { Stack() { Column() .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LoadingContent 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 Stack ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder LoadingContent() { Stack() { Column() .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/MorePage.ets#L166-L200
194ee5711b2551342b8a0b21ee4f9a8c551648fa
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getVersionName
获取应用版本名。
static getVersionName(): string { return AppUtil.getBundleInfoSync().versionName; }
AST#method_declaration#Left static getVersionName 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#member_ex...
static getVersionName(): string { return AppUtil.getBundleInfoSync().versionName; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L521-L523
d4b13f80233949fe1308619dd5d7ac1420f4aaf0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
arkts
英式发音
export const pronUs = "item3";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left pronUs = AST#expression#Left "item3" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const pronUs = "item3";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L24-L24
8ef822deb4363d580d30034b23cbb0c814e1e5c4
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets
arkts
showAlert
根据参数创建窗口 @param options @returns
static async showAlert(options?: efAlertOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { //当前窗口的编码 let winName = 'efDialog' + RandomUtil.randomNumber(1000, 1000000); //创建存储 let efStorage = new LocalStorage(); //存储 efStorage.setOrCreate('efDia...
AST#method_declaration#Left static async showAlert AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left efAlertOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g...
static async showAlert(options?: efAlertOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { let winName = 'efDialog' + RandomUtil.randomNumber(1000, 1000000); let efStorage = new LocalStorage(); efStorage.setOrCreate('efDialogName', winName);...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets#L45-L91
2e75e75f7645d07bc9be7e4e2b793cae9949ae22
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
init
提供一个异步初始化方法
public async init(): Promise<void> { // 等待 preferences 初始化完成 await this.initPreferences(); if (this.currentPlanId != null) { this.plan = await PlanManager.getPlanByPlanId(this.currentPlanId); } }
AST#method_declaration#Left public async init 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...
public async init(): Promise<void> { await this.initPreferences(); if (this.currentPlanId != null) { this.plan = await PlanManager.getPlanByPlanId(this.currentPlanId); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L92-L99
89848eb72f156527e1d71c0dfdad85a25788577c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsDetailPage.ets
arkts
GoodsDetailLargeLayout
大屏商品详情布局(左右等分) @returns {void} 无返回值
@Builder private GoodsDetailLargeLayout(): void { RowStartTop({ fillMaxSize: true }) { ColumnStart({ widthValue: P50, heightValue: P100 }) { GoodsBanner({ bannerList: this.vm.data?.goodsInfo?.pics ?? [], autoPlay: false, loop: false, imageFit: ImageFit.Cover, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GoodsDetailLargeLayout 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#Le...
@Builder private GoodsDetailLargeLayout(): void { RowStartTop({ fillMaxSize: true }) { ColumnStart({ widthValue: P50, heightValue: P100 }) { GoodsBanner({ bannerList: this.vm.data?.goodsInfo?.pics ?? [], autoPlay: false, loop: false, imageFit: ImageFit.Cover, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsDetailPage.ets#L120-L142
13f424a178b5ac3864e6cd0f8dbca2029a87b82c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets
arkts
createCigenWordFromRs
============================================================ ResultSet -> CigenWord ============================================================
private createCigenWordFromRs(rs: relationalStore.ResultSet): CigenWord { const word = new CigenWord(); word.idx = rs.getLong(rs.getColumnIndex('CWord_idx')); word.cid = rs.getLong(rs.getColumnIndex('CWord_cid')); word.vid = rs.getLong(rs.getColumnIndex('Cgcz_vid')); word.titleEn = ...
AST#method_declaration#Left private createCigenWordFromRs AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis...
private createCigenWordFromRs(rs: relationalStore.ResultSet): CigenWord { const word = new CigenWord(); word.idx = rs.getLong(rs.getColumnIndex('CWord_idx')); word.cid = rs.getLong(rs.getColumnIndex('CWord_cid')); word.vid = rs.getLong(rs.getColumnIndex('Cgcz_vid')); word.titleEn = ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L169-L180
9c24669290a36a3d763a2f9376b2e5909585ee4f
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getWeekDates
获取本周的日期数组 @returns 本周7天的日期数组
static getWeekDates(): Date[] { const weekStart = DateUtils.getWeekStart(); const dates: Date[] = []; for (let i = 0; i < 7; i++) { const date = new Date(weekStart); date.setDate(weekStart.getDate() + i); dates.push(date); } return dates; }
AST#method_declaration#Left static getWeekDates AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Date [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#...
static getWeekDates(): Date[] { const weekStart = DateUtils.getWeekStart(); const dates: Date[] = []; for (let i = 0; i < 7; i++) { const date = new Date(weekStart); date.setDate(weekStart.getDate() + i); dates.push(date); } return dates; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L161-L172
66342490a8b73707e1f849d43a4342c4f660a161
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Global Data Exports everything, ALL USER DATA.
export async function export_everything() { bunch_of_settings.save_to_disk(); // sandbox_save('kv_store.json.browsercatstore.txt', await export_json_kv_store()); sandbox_unlink_sync('kv_store.json.browsercatstore.txt'); sandbox_unlink_sync('profile.zip'); sandbox_rmdir_sync('temp'); let inFile = meowContex...
AST#export_declaration#Left export AST#function_declaration#Left async function export_everything AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left A...
export async function export_everything() { bunch_of_settings.save_to_disk(); sandbox_unlink_sync('kv_store.json.browsercatstore.txt'); sandbox_unlink_sync('profile.zip'); sandbox_rmdir_sync('temp'); let inFile = meowContext().filesDir; let outFile = meowContext().filesDir + '/profile.zip'; let optio...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L822-L856
4a618dd8ff1a94b0c0417294424bd24ea2bcf4da
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets
arkts
HistoryItem
获取当前页面的上下文
@Component export default struct HistoryItem { // 下载历史的数据 @ObjectLink fileInfo: downloadFilesData; // 文件名称 @State fileName: string = ''; // 待下载任务数量 @Link downloadCount: number; // 下载历史列表 @Link historyArray: downloadFilesData[]; // 下载列表 @Link downloadFileArray: downloadFilesData[]; // 文件下载状态 @Sta...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HistoryItem AST#component_body#Left { // 下载历史的数据 AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right fileInfo : AST#type_annotation#Left AST#primary_type#Left downloadFilesData AS...
@Component export default struct HistoryItem { @ObjectLink fileInfo: downloadFilesData; @State fileName: string = ''; @Link downloadCount: number; @Link historyArray: downloadFilesData[]; @Link downloadFileArray: downloadFilesData[]; @State fileStatus: number = -1; aboutToAppear(): void...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets#L27-L209
3566d0a6ad2aaa5a52da418a4cd8c4b3066d40cf
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
HTTP工具类(完全静态方法)
export class Http { /** * 发送HTTP请求的快捷方法 * @param url 请求地址 * @param method 请求方法,默认GET * @param params 请求参数,默认null * @param callback 回调函数,返回成功状态和错误信息 */ static send( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, // 默认GET请求 params: HttpUtils.HttpParams = null, // 可选参数 ...
AST#export_declaration#Left export AST#class_declaration#Left class Http AST#class_body#Left { /** * 发送HTTP请求的快捷方法 * @param url 请求地址 * @param method 请求方法,默认GET * @param params 请求参数,默认null * @param callback 回调函数,返回成功状态和错误信息 */ AST#method_declaration#Left static send AST#parameter_list#Left ( AST#parame...
export class Http { static send( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null) => void ) { Http.request(url, method, params, (succeed: boolean, msg: string | null, data: Object[] | nul...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L11-L267
ed3e66f35be036d9e1b15268be91da7a7aba4deb
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisLineDashedLine
Enables the axis line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance. @param effect the DashPathEffect
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
AST#method_declaration#Left public setAxisLineDashedLine AST#parameter_list#Left ( AST#parameter#Left effect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left vo...
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L647-L649
566325b92ad9153bd16b2b9bba4cc3fb87ffe78e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets
arkts
PicturePreviewImage
PicturePreviewImage 图片绘制组件 实现步骤: - 1. 使用matrix实现图片的缩放 - 2. 使用offset实现组件的偏移 - 3. 提前计算图片属性以便对组件属性进行设置 - 4. Image.objectFile使用Cover以便图片能够超出其父组件显示(而不撑大父组件) @param { Color } listBGColor - 图片背景色 @param { string } imageUrl - 图片预览地址 @param { Axis } listDirection - 图片预览的主轴方向 @param { number } [TogglePercent] - 图片滑动多大距离需要切...
@Reusable @Component export struct PicturePreviewImage { // 当前背景色 @Link listBGColor: Color; // 图片显示的地址 @Require @Prop imageUrl: string = ''; // 图片滑动方向 @Require @Prop listDirection: Axis; // 图片滑动多大距离需要切换图片 @Prop togglePercent: number = 0.2; // 当前图片下标 @Prop imageIndex: number = 0; // 最多几张图片 @Prop ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct PicturePreviewImage AST#component_body#Left { // 当前背景色 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right listBGColor : AST#type_annotation#Le...
@Reusable @Component export struct PicturePreviewImage { @Link listBGColor: Color; @Require @Prop imageUrl: string = ''; @Require @Prop listDirection: Axis; @Prop togglePercent: number = 0.2; @Prop imageIndex: number = 0; @Prop imageMaxLength: number = 0; setListOffset: (offset: numbe...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L48-L521
6a99bf919b45c221d3978e87a4d00245136befd0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
需要更新的商品数据
export let targetItemList: ThirdGoodsItem[] = [ new ThirdGoodsItem($r("app.media.variablewatch_strawberry"), '价格5'), new ThirdGoodsItem($r("app.media.variablewatch_banana"), '价格6'), new ThirdGoodsItem($r("app.media.variablewatch_apple"), '价格7'), new ThirdGoodsItem($r("app.media.variablewatch_mango"), '价格8') ] ...
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left targetItemList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ThirdGoodsItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AS...
export let targetItemList: ThirdGoodsItem[] = [ new ThirdGoodsItem($r("app.media.variablewatch_strawberry"), '价格5'), new ThirdGoodsItem($r("app.media.variablewatch_banana"), '价格6'), new ThirdGoodsItem($r("app.media.variablewatch_apple"), '价格7'), new ThirdGoodsItem($r("app.media.variablewatch_mango"), '价格8') ]
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L61-L70
d04b5eeff5baeaf6c2dcb758489aac26b7ec69bb
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Performance/ConcurrentModule/entry/src/main/ets/fileFs/MyWorker.ets
arkts
readyFilesToWorker
worker file
readyFilesToWorker(): void { let content = CONTENT + CONTENT + new Date() + '\n'; let workerDir = this.baseDir + '/workerDir'; try { if (!fs.accessSync(workerDir)) { fs.mkdirSync(workerDir); } Logger.info(TAG, 'readyFilesToWorker dpath = ' + workerDir); for (let i = 0; i < F...
AST#method_declaration#Left readyFilesToWorker AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content ...
readyFilesToWorker(): void { let content = CONTENT + CONTENT + new Date() + '\n'; let workerDir = this.baseDir + '/workerDir'; try { if (!fs.accessSync(workerDir)) { fs.mkdirSync(workerDir); } Logger.info(TAG, 'readyFilesToWorker dpath = ' + workerDir); for (let i = 0; i < F...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Performance/ConcurrentModule/entry/src/main/ets/fileFs/MyWorker.ets#L53-L78
4e2f16e2d83cf9275bf5cf02e9f620f676f8de55
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
getData
获取索引对应的数据
public getData(index: number): number { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
public getData(index: number): number { return this.dataArray[index]; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L28-L30
7bdf207297e922a8b86244c399c6bed9e4da72c9
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Application.ets
arkts
Current partial update context or undefined. @returns current partial update context
export function currentPartialUpdateContext<T>(): T | undefined { return _currentPartialUpdateContext as (T | undefined) }
AST#export_declaration#Left export AST#function_declaration#Left function currentPartialUpdateContext AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_...
export function currentPartialUpdateContext<T>(): T | undefined { return _currentPartialUpdateContext as (T | undefined) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Application.ets#L76-L78
7e7c20b8fb9f666e5c76258a4851c0eb0a096003
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawGridLinesBehindData
If this is set to false, the grid lines are draw on top of the actual data, otherwise behind. Default: true @param enabled
public setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
AST#method_declaration#Left public setDrawGridLinesBehindData AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi...
public setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L509-L511
037d9041311ab10b3c4536789c386bf9a2dfc98d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/FeatureComponent.ets
arkts
CustomAnimationTabPage
仅用于项目调试,单独使用可删除代码内容
@AppRouter({ name: "customanimationtab/CustomAnimationTabPage" }) @Component export struct CustomAnimationTabPage { build() { CustomAnimationTabView() .height($r("app.string.custom_animation_tab_one_hundred_percent")) .width($r("app.string.custom_animation_tab_one_hundred_percent")); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "customanimationtab/CustomAnimationTabPage" AST#expression#Right AST#property_assignment#Right } AST...
@AppRouter({ name: "customanimationtab/CustomAnimationTabPage" }) @Component export struct CustomAnimationTabPage { build() { CustomAnimationTabView() .height($r("app.string.custom_animation_tab_one_hundred_percent")) .width($r("app.string.custom_animation_tab_one_hundred_percent")); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/FeatureComponent.ets#L21-L30
d49873d0999405377dbfdceb8ba1f88b3c6d6951
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/pages/Index.ets
arkts
toDeleteComment
删除评论 TODO
async toDeleteComment(key: string) { //先删除数据 await KVManager.deleteData(key)//等待deleteData执行完成 //再读取数据 let result=await KVManager.queryData(key);//等待queryData执行完成 this.commentContent=result.toString()//此时因为键值被删,无法查询数据,返回空字符串 this.isShowComment=!this.isShowComment//评论被删除,隐藏评论框 this.isComment=...
AST#method_declaration#Left async toDeleteComment 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#block_statement#Left { //先删除数据 AST#statement#Left AST#expression_...
async toDeleteComment(key: string) { await KVManager.deleteData(key) let result=await KVManager.queryData(key); this.commentContent=result.toString() this.isShowComment=!this.isShowComment this.isComment=!this.isComment KVManager.showToastMessage($r('app.string.delete_comment_notice'))...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/pages/Index.ets#L134-L143
087e6fee264aaa66de7e490a66e036c3416380d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
requestRepository
重写请求方法来实现网络请求 @return 商品分类
protected requestRepository(): Promise<NetworkResponse<Category[]>> { return this.goodsRepository.getGoodsTypeList(); }
AST#method_declaration#Left protected requestRepository 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#generic_type#Left NetworkResponse AST#type_arguments#Le...
protected requestRepository(): Promise<NetworkResponse<Category[]>> { return this.goodsRepository.getGoodsTypeList(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L50-L52
b32b168085d6abcc4b02e5834cc3ad868312cf8f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
buyNow
立即购买 @param {SelectedGoods} selectedGoods - 已选商品信息 @returns {Promise<void>} Promise<void>
async buyNow(selectedGoods: SelectedGoods): Promise<void> { // 保存已选商品列表到本地存储(存储为数组格式) await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); // 关闭规格选择弹窗 this.dismissSpecModal(); // 跳转到订单确认页面 OrderNavigator.toConfirm(); }
AST#method_declaration#Left async buyNow AST#parameter_list#Left ( AST#parameter#Left selectedGoods : AST#type_annotation#Left AST#primary_type#Left SelectedGoods 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_...
async buyNow(selectedGoods: SelectedGoods): Promise<void> { await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); this.dismissSpecModal(); OrderNavigator.toConfirm(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L172-L179
df4015536973267d70b06bfcd9e495688ffa38d9
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
exitSystem
#ffffff'; 退出系统。 @param context UIAbilityContext上下文对象
static exitSystem(context: common.UIAbilityContext) { // let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; context.terminateSelf(); }
AST#method_declaration#Left static exitSystem AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A...
static exitSystem(context: common.UIAbilityContext) { context.terminateSelf(); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L35-L38
d32f972b0ab520764323b8f4c95633b38c75b661
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets
arkts
computeTask
[EndExclude cold_start_speed_optimization]
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
AST#method_declaration#Left computeTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count : AST#typ...
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets#L44-L49
530e72dd62a6952f54f97e2864e7f7f2d05c47cf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
Basic implementation of IDataSource to handle data listener @implements {IDataSource}
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; /** * 获取数组长度 */ public totalCount(): number { return this.originDataArray.length; } /** * 获取索引对应的数据 * @param index 数组索引 */ public getData(index: nu...
AST#export_declaration#Left export AST#class_declaration#Left class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left ...
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; public totalCount(): number { return this.originDataArray.length; } public getData(index: number): T { return this.originDataArray[index]; } public ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets#L20-L135
bd8fbe68254005ab825ae2118e2f3adca32d18c8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/ColumnAttribute.ets
arkts
获取纵向居中 + 水平起始的 Column 对齐修饰器 @returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器 @example Column() { Text("Hi"); }.attributeModifier(columnCenterStart());
export function columnCenterStart(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.Start); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function columnCenterStart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribu...
export function columnCenterStart(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.Start); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L72-L79
d26c0700bcc26f0d6ce61eff70a435f6ea68a2b4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/NoteDataModel.ets
arkts
Copyright (c) 2020-2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
export class NoteModel { title: string content: string constructor
AST#export_declaration#Left export AST#ERROR#Left class NoteModel { title : string content : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class NoteModel { title: string content: string constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/NoteDataModel.ets#L16-L20
37fd61bc6ffe6b487600596540d350107c81db15
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/OnlineLunarService.ets
arkts
网络农历数据接口
export interface OnlineLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; lunarYear: number; lunarMonth: number; lunarDay: number; zodiac: string; ganzhi: string; solarTerms?: string; festivals?: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OnlineLunarDate AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left month : AST#type_annotation#L...
export interface OnlineLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; lunarYear: number; lunarMonth: number; lunarDay: number; zodiac: string; ganzhi: string; solarTerms?: string; festivals?: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L13-L25
760bad90a58ac44c036a3451cd954ad863f988f4
github
qwerguai/ArkTSComponents.git
58ac77d9686670d79ba7421d71e68f31870aacd5
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
Get swiper image data. @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.aaaaaaaa'), $r('app.media.bbbbbb'), $r('app.media.cccccc'), $r('app.media.ddddddd') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.aaaaaaaa'), $r('app.media.bbbbbb'), $r('app.media.cccccc'), $r('app.media.ddddddd') ]; return swiperImages; }
https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/viewmodel/MainViewModel.ets#L28-L36
a99e24d9b94366f515f54894d8ac74a5e272257c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
getModifier
获取当前gridItem的modifier @param item 网格元素 @returns 属性对象
getModifier(item: T): GridItemModifier { logger.info(`getModifier start, item:${JSON.stringify(item)}`); const index: number = this.gridData.indexOf(item); if (index === -1) { return new GridItemModifier(); } else { return this.modifier[index]; } }
AST#method_declaration#Left getModifier AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GridItemModifier AST#primary_type#...
getModifier(item: T): GridItemModifier { logger.info(`getModifier start, item:${JSON.stringify(item)}`); const index: number = this.gridData.indexOf(item); if (index === -1) { return new GridItemModifier(); } else { return this.modifier[index]; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L59-L67
eb20d316b777668d80cbd79cc2ad19ab8ce88e61
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/toggle/toggleNormal.ets
arkts
ToggleBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function ToggleBuilder(name: string, param: Object) { ToggleExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param :...
@Builder export function ToggleBuilder(name: string, param: Object) { ToggleExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleNormal.ets#L16-L19
87294185a0ac63f5b51fac16b34db055563012c7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/CsvParser.ets
arkts
splitCsvLines
分割CSV行,处理多行字段
private static splitCsvLines(content: string): string[] { const lines: string[] = []; let currentLine = ''; let inQuotes = false; for (let i = 0; i < content.length; i++) { const char = content[i]; if (char === '"') { inQuotes = !inQuotes; currentLine += char; ...
AST#method_declaration#Left private static splitCsvLines AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array...
private static splitCsvLines(content: string): string[] { const lines: string[] = []; let currentLine = ''; let inQuotes = false; for (let i = 0; i < content.length; i++) { const char = content[i]; if (char === '"') { inQuotes = !inQuotes; currentLine += char; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/CsvParser.ets#L92-L121
fe31e64b45111e5cf987ed400689c7e9b2621fbf
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines ChipItemStyle. @interface ChipItemStyle @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipItemStyle { /** * Chip size. * * @type { ?(ChipSize | SizeOptions) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ size?: ChipSize | SizeOptions; /** * ChipItem background color. * * ...
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipItemStyle AST#object_type#Left { /** * Chip size. * * @type { ?(ChipSize | SizeOptions) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#L...
export interface ChipItemStyle { size?: ChipSize | SizeOptions; backgroundColor?: ResourceColor; fontColor?: ResourceColor; selectedFontColor?: ResourceColor; selectedBackgroundColor?: ResourceColor; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L283-L339
ab6d8fe8885eb1cb1a1090ecb297db1a464231da
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/ability/NaturalLanguageExtract.ets
arkts
========== 类型定义 ==========
export interface HuaweiLinkParseResult { packageName: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface HuaweiLinkParseResult AST#object_type#Left { AST#type_member#Left packageName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface...
export interface HuaweiLinkParseResult { packageName: string; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/ability/NaturalLanguageExtract.ets#L4-L6
34e2a9a7b2a8472de6178f10c4059e751d56fc85
github
hushenghao/ArkTS-RelativeContainerExtend.git
8df722220a15be576736c7a58a8ed30820c3a1ea
entry/src/main/ets/utils/SpaceExtend.ets
arkts
垂直方向边距 @param size @returns
export function vertical(size: Length): Padding { return { top: size, bottom: size } }
AST#export_declaration#Left export AST#function_declaration#Left function vertical AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
export function vertical(size: Length): Padding { return { top: size, bottom: size } }
https://github.com/hushenghao/ArkTS-RelativeContainerExtend.git/blob/8df722220a15be576736c7a58a8ed30820c3a1ea/entry/src/main/ets/utils/SpaceExtend.ets#L15-L17
b8890d4aacb78e2bf7b3410b742e684c7ebcc62a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets
arkts
getDistanceSquare
根据圆心,以及纵坐标拿到水位线两个端点的距离的平方 @param ordinate 纵坐标 @returns 端点间距离的平方
getDistanceSquare(ordinate: number): number { return Constants.RADIUS_IN_PX * Constants.RADIUS_IN_PX - (ordinate - Constants.RADIUS_IN_PX) * (ordinate - Constants.RADIUS_IN_PX); }
AST#method_declaration#Left getDistanceSquare AST#parameter_list#Left ( AST#parameter#Left ordinate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
getDistanceSquare(ordinate: number): number { return Constants.RADIUS_IN_PX * Constants.RADIUS_IN_PX - (ordinate - Constants.RADIUS_IN_PX) * (ordinate - Constants.RADIUS_IN_PX); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L76-L78
6bb150d9eafeb9912e6565daa605afedbe435538
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets
arkts
Draw screen
build() { Column() { if (this.targetView == 'MenuItem') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItem({ start...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expre...
build() { Column() { if (this.targetView == 'MenuItem') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItem({ start...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets#L83-L597
3fed98754d7a0df502ac8f9d16a1bf0b0bd091e5
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/util/MosaicPixelMapHelper.ets
arkts
compress
对输入的像素图压缩到合理尺寸用于后续生成马赛克图 WARNING:调用者不能在子线程调用此接口,会导致原始输入像素图被修改,业务再访问修改后的输入像素图属性方法会抛异常 @param pixelMap 输入的像素图 @returns Promise<PixelMap | undefined>
static async compress(pixelMap: PixelMap): Promise<PixelMap | undefined> { let start = Date.now() let compressPixelMap: PixelMap | undefined let imgSrc: image.ImageSource | undefined try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'compress ' + JSON.stringify(img...
AST#method_declaration#Left static async compress AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
static async compress(pixelMap: PixelMap): Promise<PixelMap | undefined> { let start = Date.now() let compressPixelMap: PixelMap | undefined let imgSrc: image.ImageSource | undefined try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'compress ' + JSON.stringify(img...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/MosaicPixelMapHelper.ets#L93-L134
60f522cc9f5eef447368cd92fd8f71ebed291785
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/TextConstants.ets
arkts
@author 2008 @datetime 2024/6/28 22:36 @className: TextConstants
export default class TextConstants { //文本LinHeight高度 static readonly TEXT_LINE_HEIGHT_18: number = 18; static readonly TEXT_LINE_HEIGHT_20: number = 20; static readonly TEXT_LINE_HEIGHT_22: number = 22; static readonly TEXT_LINE_HEIGHT_24: number = 24; static readonly TEXT_LINE_HEIGHT_26: number = 26; sta...
AST#export_declaration#Left export default AST#class_declaration#Left class TextConstants AST#class_body#Left { //文本LinHeight高度 AST#property_declaration#Left static readonly TEXT_LINE_HEIGHT_18 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export default class TextConstants { static readonly TEXT_LINE_HEIGHT_18: number = 18; static readonly TEXT_LINE_HEIGHT_20: number = 20; static readonly TEXT_LINE_HEIGHT_22: number = 22; static readonly TEXT_LINE_HEIGHT_24: number = 24; static readonly TEXT_LINE_HEIGHT_26: number = 26; static readonly TE...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/TextConstants.ets#L6-L14
6a0fbcffbd5850f1674462d87b012e67623faea8
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/VHPushCardBuilder.ets
arkts
自定义参数类型
export class PushCardParams { card: VHCardInfo; webinar: VHWebinarData; constructor(card: VHCardInfo, webinar: VHWebinarData) { this.card = card; this.webinar = webinar; } }
AST#export_declaration#Left export AST#class_declaration#Left class PushCardParams AST#class_body#Left { AST#property_declaration#Left card : AST#type_annotation#Left AST#primary_type#Left VHCardInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left webinar ...
export class PushCardParams { card: VHCardInfo; webinar: VHWebinarData; constructor(card: VHCardInfo, webinar: VHWebinarData) { this.card = card; this.webinar = webinar; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/VHPushCardBuilder.ets#L11-L19
168b67fe50e1aae11f8473586f5a535373fbd6dc
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets
arkts
clearData
清空数据
public clearData(): void { this.messageList = []; this.notifyDataReload(); }
AST#method_declaration#Left public clearData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m...
public clearData(): void { this.messageList = []; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets#L56-L59
f136a711937959e2b9e55b1a5b32c55a4c253832
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/IntroductionPage.ets
arkts
getLazySwiperData
Get the swiper data for lazy load.
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
AST#method_declaration#Left getLazySwiperData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ZonesItem [ ] AST#array_type#Right AST...
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L238-L244
84f4558b98cecc121a20027d56c33aa8ca76dea5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
clear
清除所有数据
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to clear preferences: ${businessEr...
AST#method_declaration#Left async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to clear preferences: ${businessEr...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L266-L276
0a055263c934d326642fa7619e721a61254549a4
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
ClockHeader
时钟所在的 ListItemGroup 的标题组件。
@Builder private ClockHeader(): void { Row() { Text(this.isClockShow ? '隐藏时钟' : '显示时钟') .fontWeight(FontWeight.Medium) .fontSize(14) .fontColor($r('app.color.font_black')); } .padding('1%') .size({ width: '96%', height: '4%' }) .border({ radius: 12, style:...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ClockHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private ClockHeader(): void { Row() { Text(this.isClockShow ? '隐藏时钟' : '显示时钟') .fontWeight(FontWeight.Medium) .fontSize(14) .fontColor($r('app.color.font_black')); } .padding('1%') .size({ width: '96%', height: '4%' }) .border({ radius: 12, style:...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L519-L541
46a29349deb7a1213ca8ab3af2c496c3d107ecc3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/InputFilter.ets
arkts
通过正则表达式设置输入过滤器。匹配表达式的输入允许显示,不匹配的输入将被过滤。仅支持单个字符匹配,不支持字符串匹配。
export interface InputFilter { value: ResourceStr; //正则表达式。 error?: (value: string) => void; //正则匹配失败时,返回被过滤的内容。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface InputFilter AST#object_type#Left { AST#type_member#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //正则表达式。 AST#type_member#Left error ? : AST#type...
export interface InputFilter { value: ResourceStr; error?: (value: string) => void; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/InputFilter.ets#L4-L7
14034adfc6375b4ef941be2241758ac17890775a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/Index.ets
arkts
PicturePreviewSample
view
export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample'
AST#export_declaration#Left export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample' AST#export_declaration#Right
export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/Index.ets#L17-L17
b0618ec9444de240443bc83d838d847a44d88ef1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
getMax
获取指定列的最大值 @param column - 列名(如:"age") @param table - 表名(如:"users") @param where - WHERE条件语句(可选,如:"status = 1") @returns Promise<number> 返回最大值(无数据时返回0)
async getMax(column: string, table: string, where?: string): Promise<number> { // 构建MAX查询SQL let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; }
AST#method_declaration#Left async getMax AST#parameter_list#Left ( AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
async getMax(column: string, table: string, where?: string): Promise<number> { let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L284-L291
ad5f2bb1fe64bb72f83a06a3c2c518ebb28c5125
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageViewerView.ets
arkts
aboutToAppear
初始化数据源
aboutToAppear(): void { const resourceDir: string = this.context.resourceDir; this.imageDataSource.pushData(resourceDir + '/' + ImageViewerConstants.IMAGE_NAME); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resourceDir...
aboutToAppear(): void { const resourceDir: string = this.context.resourceDir; this.imageDataSource.pushData(resourceDir + '/' + ImageViewerConstants.IMAGE_NAME); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageViewerView.ets#L46-L49
d8ab3e13b56161778f5927c7d928bca03e68bd6b
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets
arkts
getCipherTextSpec
获取转换SM2密文格式,ASN.1格式转换为C1C2C3或C1C3C2 @param cipherText ASN.1格式的SM2密文参数 @param cipherMode 0-C1C2C3 、1-C1C3C2,默认为0 @returns
static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string { try { let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2'); let startPre = "04"; // bigint 转十六进制需要补零,参考BC转换 let c1x = CryptoHelper...
AST#method_declaration#Left static getCipherTextSpec AST#parameter_list#Left ( AST#parameter#Left cipherText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L...
static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string { try { let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2'); let startPre = "04"; let c1x = CryptoHelper.toHexWithPaddingZero(spec...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets#L181-L201
a3311a5764365116dfa6e54c04c16142cfb3e53d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
网络变化事件
export class netEventHandler { /** * 网络可用 */ availableCallback?: Callback<connection.NetHandle>; /** * 网络不可用 */ unavailableCallback?: Callback<void>; /** * 网络能力变化 */ capabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>; /** * 网络连接信息变化 */ connPropertiesChangeCallbac...
AST#export_declaration#Left export AST#class_declaration#Left class netEventHandler AST#class_body#Left { /** * 网络可用 */ AST#property_declaration#Left availableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_t...
export class netEventHandler { availableCallback?: Callback<connection.NetHandle>; unavailableCallback?: Callback<void>; capabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>; connPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>; blockStatusChangeCallback?...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L152-L177
c8410e362c881b00e2fdb20e57ac49901743d296
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
AI生成响应接口
export interface AIGeneratedResponse { content: string; type?: MessageType; metadata?: Record<string, string | number | boolean>; attachments?: MessageAttachment[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIGeneratedResponse AST#object_type#Left { AST#type_member#Left content : 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_anno...
export interface AIGeneratedResponse { content: string; type?: MessageType; metadata?: Record<string, string | number | boolean>; attachments?: MessageAttachment[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L218-L223
8d7f22be936909b76fbaf9673b4ec1cc12d68589
github
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/tables/TodoTable.ets
arkts
updateData
更新数据
updateData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName); predicates.equalTo('id', todoItem.id); this.todoTable.updateData(predicates, valueBucket, callback); ...
AST#method_declaration#Left updateData AST#parameter_list#Left ( AST#parameter#Left todoItem : AST#type_annotation#Left AST#primary_type#Left TodoItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_...
updateData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName); predicates.equalTo('id', todoItem.id); this.todoTable.updateData(predicates, valueBucket, callback); ...
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L46-L51
d7263eed940359311978b559c9bb70d99e74dc4f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebOptions.ets
arkts
ArkWeb参数
export class ArkWebOptions { downloadPath: string = FileUtils.getCacheDirPath(); //ArkWeb下载文件夹的路径 renderMode: RenderMode = RenderMode.ASYNC_RENDER; //表示当前Web组件的渲染方式,RenderMode.ASYNC_RENDER表示Web组件异步渲染,RenderMode.SYNC_RENDER表示支持Web组件同步渲染能力,默认值RenderMode.ASYNC_RENDER,该模式不支持动态调整。 incognitoMode: boolean = false; //...
AST#export_declaration#Left export AST#class_declaration#Left class ArkWebOptions AST#class_body#Left { AST#property_declaration#Left downloadPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left A...
export class ArkWebOptions { downloadPath: string = FileUtils.getCacheDirPath(); renderMode: RenderMode = RenderMode.ASYNC_RENDER; incognitoMode: boolean = false; sharedRenderProcessToken: string = ""; domStorageAccess: boolean = true; javaScriptAccess: boolean = true; fileAccess: boolea...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebOptions.ets#L7-L227
fb514c3198b6bc432601c1b19510517828ff71ab
gitee