nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
Declare class TreeListenerManager @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare class TreeListenerManager @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class TreeListenerManager { /** * Get instance of treeListenerManager. * @return treeListenerManager instance * @static * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Get instance of treeListenerManager. * @return treeListenerManager insta...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TreeListenerManager AST#class_body#Left { /** * Get instance of treeListenerManager. * @return treeListenerManager instance * @static * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 1...
export declare class TreeListenerManager { static getInstance(): TreeListenerManager; getTreeListener(): TreeListener; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L188-L220
fd192df6b8e261baaf1b2afe5583e94ca4a7fdb9
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/PrefUtil.ets
arkts
getValueT
根据KEY获取value 对象 @param key @param def 默认返回对象,建议空对象 @param T 返回类型
static getValueT<T>(key: string, def: T): T { const defStore = PrefUtil.getStore() const res = defStore?.getSync(key, '') if (!res) { return def } else { return JSON.parse(res as string) as T } }
AST#method_declaration#Left static getValueT AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#R...
static getValueT<T>(key: string, def: T): T { const defStore = PrefUtil.getStore() const res = defStore?.getSync(key, '') if (!res) { return def } else { return JSON.parse(res as string) as T } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L62-L70
8110a62c39302956cd23eed3071cc1f18b857585
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationUtil.ets
arkts
publishNotification
@param notificationRequest @param id, Support specifying notification id when publishing notifications
async publishNotification(notificationRequest: notificationManager.NotificationRequest, id?: number) { if (id && id > 0) { notificationRequest.id = id; } try { let notificationSlot: notificationManager.NotificationSlot = { type: notification.SlotType.CONTENT_INFORMATION, level: n...
AST#method_declaration#Left async publishNotification AST#parameter_list#Left ( AST#parameter#Left notificationRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete...
async publishNotification(notificationRequest: notificationManager.NotificationRequest, id?: number) { if (id && id > 0) { notificationRequest.id = id; } try { let notificationSlot: notificationManager.NotificationSlot = { type: notification.SlotType.CONTENT_INFORMATION, level: n...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationUtil.ets#L38-L65
2235b9b3b03e5067d6267f6357679b87fcf6d2cf
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets
arkts
@file @kit ArkUI Construct parameter types for EditorMenuOptions. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Construct parameter types for EditorMenuOptions. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface EditorMenuOptions { /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapa...
AST#export_declaration#Left export AST#interface_declaration#Left interface EditorMenuOptions AST#object_type#Left { /** * The icon of icon and text item. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of icon a...
export interface EditorMenuOptions { icon: ResourceStr; action?: () => void; builder?: () => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets#L34-L89
989920799877eee5b2131dc21b4e54717db9ada3
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
getOfferStatusColor
获取Offer状态颜色
getOfferStatusColor(): string { switch (this.offerStatus) { case OfferStatus.NO_OFFER: return '#d9d9d9'; case OfferStatus.PENDING: return '#faad14'; case OfferStatus.RECEIVED: return '#1890ff'; case OfferStatus.ACCEPTED: return '#52c41a'; case OfferStatu...
AST#method_declaration#Left getOfferStatusColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Lef...
getOfferStatusColor(): string { switch (this.offerStatus) { case OfferStatus.NO_OFFER: return '#d9d9d9'; case OfferStatus.PENDING: return '#faad14'; case OfferStatus.RECEIVED: return '#1890ff'; case OfferStatus.ACCEPTED: return '#52c41a'; case OfferStatu...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L204-L219
9837255312a6ca75d5aaa3597e0ce6f5fddbb2f8
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/ChatPage.ets
arkts
onPageHide
界面隐藏时被调用。
onPageHide(): void { // 本界面不显示时,将输入法软键盘避让模式还原为系统默认的KeyboardAvoidMode.OFFSET ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false); }
AST#method_declaration#Left onPageHide 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 { // 本界面不显示时,将输入法软键盘避让模式还原为系统默认的KeyboardAvoidMode.OFFSET AST#expression_statement#Left AST#exp...
onPageHide(): void { ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/ChatPage.ets#L93-L96
575b724fc0527c512354f6f8af2f711107b4da4e
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
buildSubscriptionTab
订阅页签
@Builder buildSubscriptionTab() { Column() { if (this.isLoading) { LoadingProgress() .width(50) .height(50) .margin({ top: 100 }) } else if (this.podcasts.length === 0) { this.buildEmptyView('暂无订阅', '点击右上角添加播客'); } else { List({ space: 12 }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSubscriptionTab 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 { AST#ui_c...
@Builder buildSubscriptionTab() { Column() { if (this.isLoading) { LoadingProgress() .width(50) .height(50) .margin({ top: 100 }) } else if (this.podcasts.length === 0) { this.buildEmptyView('暂无订阅', '点击右上角添加播客'); } else { List({ space: 12 }) ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L534-L559
bad782f3515618b90a55bad2dfbd0f5329c423d9
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets
arkts
优惠券数据模型
export interface Coupon { id: number; title: string; amount: number; minAmount: number; validDays: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Coupon AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#pri...
export interface Coupon { id: number; title: string; amount: number; minAmount: number; validDays: number; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L57-L63
68708d584b0ae63752aba79059501e1dba50a6da
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamDetailPage.ets
arkts
fetchDreamDetail
获取梦想详情
private async fetchDreamDetail() { try { this.isLoading = true; // 先通过API获取梦想详情 console.info(`获取梦想详情, ID: ${this.dreamId}`); const dream: Dream = await ApiService.getDreamById(this.dreamId); console.info(`获取到梦想详情: ${JSON.stringify(dream)}`); this.dream = dream; ...
AST#method_declaration#Left private async fetchDreamDetail AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb...
private async fetchDreamDetail() { try { this.isLoading = true; console.info(`获取梦想详情, ID: ${this.dreamId}`); const dream: Dream = await ApiService.getDreamById(this.dreamId); console.info(`获取到梦想详情: ${JSON.stringify(dream)}`); this.dream = dream; ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamDetailPage.ets#L66-L96
5a180f8921ce998f9b8a2c26d75118c6951ec46e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildBirthdayCard
生日卡片
@Builder buildBirthdayCard(contact: Contact, isToday: boolean) { Row({ space: 12 }) { // 头像 Column() { Text(contact.name.charAt(0)) .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor(this.COLORS.whitePrimary) } .width(48) .height(48) .bo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayCard AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isToday : AST#type_annota...
@Builder buildBirthdayCard(contact: Contact, isToday: boolean) { Row({ space: 12 }) { Column() { Text(contact.name.charAt(0)) .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor(this.COLORS.whitePrimary) } .width(48) .height(48) .borderR...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1497-L1574
2908abfdbeec69435fc578975fc1eddf41b2899b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarUtils.ets
arkts
isLunarLeapYear
判断是否为农历闰年 @param year 农历年份 @returns 是否为闰年
static isLunarLeapYear(year: number): boolean { const yearInfo = LunarUtils.getLunarYearInfo(year); return yearInfo.leapMonth > 0; }
AST#method_declaration#Left static isLunarLeapYear AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
static isLunarLeapYear(year: number): boolean { const yearInfo = LunarUtils.getLunarYearInfo(year); return yearInfo.leapMonth > 0; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L433-L436
4a6602bc38aa14dd0bd61eefc5c2bcfc6b698bf3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
模型类型枚举
export enum ModelType { MESH = 'mesh', PARTICLE_SYSTEM = 'particle_system', SPRITE = 'sprite', TEXT_3D = 'text_3d' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ModelType AST#enum_body#Left { AST#enum_member#Left MESH = AST#expression#Left 'mesh' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PARTICLE_SYSTEM = AST#expression#Left 'particle_system' AST#expression#Right AST#enum_member#Right , A...
export enum ModelType { MESH = 'mesh', PARTICLE_SYSTEM = 'particle_system', SPRITE = 'sprite', TEXT_3D = 'text_3d' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L112-L117
13b29912ffa56f17e4b4ce3e7d25efad058d468e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptGCMSegment
解密(GCM模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。 @param len 自定义的数据拆分长度。 @returns
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); aw...
AST#method_declaration#Left static async decryptGCMSegment AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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#paramet...
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); aw...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L328-L347
19ca887b4bea2fd928a4c173eaff09222250232d
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinW.ets
arkts
SpinW
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinW { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spin...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinW AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinW { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spin...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinW.ets#L26-L92
1b571bf196bb123c99a9b81acb1bddcee1fb345f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/MenuData.ets
arkts
Menu item info.
export class MenuData { /** * Indicates menu title. */ value: string = ''; /** * Indicates menu action. */ action: () => void = () => {}; }
AST#export_declaration#Left export AST#class_declaration#Left class MenuData AST#class_body#Left { /** * Indicates menu title. */ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Rig...
export class MenuData { value: string = ''; action: () => void = () => {}; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/MenuData.ets#L19-L29
021ca672196cd1fbbf632e1c23ef56b10a8db84f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/SubscribeManager.ets
arkts
订阅管理器
export class SubscribeManager { /** 单例 */ static shared: SubscribeManager = new SubscribeManager(); /** 当前订阅项 */ currentItem?: SubscribeItem; private constructor() { this.loadCurrentItem(); } /** 内部同步获取 Preferences */ getPrefs(): preferences.Preferences | null { return preferences.getPreferen...
AST#export_declaration#Left export AST#class_declaration#Left class SubscribeManager AST#class_body#Left { /** 单例 */ AST#property_declaration#Left static shared : AST#type_annotation#Left AST#primary_type#Left SubscribeManager AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Le...
export class SubscribeManager { static shared: SubscribeManager = new SubscribeManager(); currentItem?: SubscribeItem; private constructor() { this.loadCurrentItem(); } getPrefs(): preferences.Preferences | null { return preferences.getPreferencesSync(getAppContext(), { name: SubscribeMana...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L56-L132
dc7acba2de153f11c7dff8513e56c68e372d28c1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets
arkts
onTouchDown
当开始滑动搜索列表、点击历史搜索空白部分关闭键盘 @param event 触屏事件
private onTouchDown(event: TouchEvent): void { let inputMethodController = inputMethod.getController(); inputMethodController.stopInputSession() }
AST#method_declaration#Left private onTouchDown AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
private onTouchDown(event: TouchEvent): void { let inputMethodController = inputMethod.getController(); inputMethodController.stopInputSession() }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L167-L170
8041b92b8bdcbf98f11ca2f70fbee623305229bc
gitee
dividez/harmonyos-games.git
78482622646cb5294d06c0aab1571f31b308b24c
features/number/src/main/ets/services/PreferencesUtil.ets
arkts
deletePreferences
从内存中移除指定文件对应的Preferences单实例。 移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。
async deletePreferences() { await dataPreferences.deletePreferences(context, PREFERENCES_NAME).then(() => { console.info(`Succeeded in delete preferences`); }).catch((err: BusinessError) => { console.error(`Failed to get preferences, Cause:` + err); }); this.preferences = undefined; }
AST#method_declaration#Left async deletePreferences AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#...
async deletePreferences() { await dataPreferences.deletePreferences(context, PREFERENCES_NAME).then(() => { console.info(`Succeeded in delete preferences`); }).catch((err: BusinessError) => { console.error(`Failed to get preferences, Cause:` + err); }); this.preferences = undefined; }
https://github.com/dividez/harmonyos-games.git/blob/78482622646cb5294d06c0aab1571f31b308b24c/features/number/src/main/ets/services/PreferencesUtil.ets#L60-L67
6494122ef37216b8fcb6e359bdcd269f6ce085b9
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
entry/src/main/ets/dialog/DialogStyle.ets
arkts
init
初始化全局样式
static init() { DialogHub.init((config) => { // ------------ 弹窗通用样式 ------------ config.maxWidth = 280 //弹窗最大宽度 config.borderRadius = 20 //弹窗 圆角 config.maskColor = 'rgba(0, 0, 0, 0.7)' //背景遮罩颜色覆盖 // ------------ 组件样式 ------------ //设置文本选择器样式 config.pickerSpecifyOptions.c...
AST#method_declaration#Left static init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHub AST#expression#Right . init AST#member_exp...
static init() { DialogHub.init((config) => { config.maxWidth = 280 config.borderRadius = 20 config.maskColor = 'rgba(0, 0, 0, 0.7)' config.pickerSpecifyOptions.canLoop = false config.pickerSpecifyOptions.style.buttonFontColorPrimary = '#FF191F25' ...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/dialog/DialogStyle.ets#L40-L115
80d35a28b91f15df8c0d32257eca4199668d0d62
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
FestivalData2025
兼容性导出(保持与原FestivalData的兼容性)
export { FestivalData2025 as FestivalData };
AST#export_declaration#Left export { FestivalData2025 as FestivalData } ; AST#export_declaration#Right
export { FestivalData2025 as FestivalData };
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L388-L388
845bf89539f586c4c6adc58d4c2ca6d81aa8f194
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets
arkts
aboutToAppear
在对话框即将出现时的操作
aboutToAppear(): void { // 初始化状态变量为AlarmItem中的值 this.intervalMinuteSelect = this.alarmItem.intervalMinute; this.intervalTimesSelect = this.alarmItem.intervalTimes; }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 初始化状态变量为AlarmItem中的值 AST#expression_statement#Left AST#expression#Left AST#assignment_...
aboutToAppear(): void { this.intervalMinuteSelect = this.alarmItem.intervalMinute; this.intervalTimesSelect = this.alarmItem.intervalTimes; }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets#L22-L26
a92ec8ecda3a396cba58d56ff872c6663855d0ab
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/PageRepository.ets
arkts
getConfirmOrder
获取确认订单页面数据 @returns 确认订单页面数据
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { return this.networkDataSource.getConfirmOrder(); }
AST#method_declaration#Left async getConfirmOrder 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#Left < A...
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { return this.networkDataSource.getConfirmOrder(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/PageRepository.ets#L43-L45
8db9a698ec0dfa600cc71beabea3ac414fba608c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
handleShortcutClick
处理快捷方式点击
async handleShortcutClick(shortcutId: string, params: Record<string, any> = {}): Promise<void> { try { const config = this.shortcuts.get(shortcutId); if (!config) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Unknown shortcut clicked: ${shortcutId}`); return; } ...
AST#method_declaration#Left async handleShortcutClick AST#parameter_list#Left ( AST#parameter#Left shortcutId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#gene...
async handleShortcutClick(shortcutId: string, params: Record<string, any> = {}): Promise<void> { try { const config = this.shortcuts.get(shortcutId); if (!config) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Unknown shortcut clicked: ${shortcutId}`); return; } ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L382-L398
1cfcb7963ed58c15daac5c07545e32d3cb30e404
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/Part_Unit.ets
arkts
get
计算属性:获取活跃单元(包含未删除单词的单元)
get aliveUnits(): Unit[] { return this.units.filter(unit => unit.aliveWords.length > 0); }
AST#method_declaration#Left get AST#ERROR#Left aliveUnits AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Unit [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left...
get aliveUnits(): Unit[] { return this.units.filter(unit => unit.aliveWords.length > 0); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Part_Unit.ets#L52-L54
a1659f9516fdfb6aa4a946f3ec1c197b0e514272
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/views/CustomTabLayout.ets
arkts
CustomTabLayout
纯自定义TabLayout,非官方Tabs自定义,需要自己监听回调选中同步状态
@Component export struct CustomTabLayout { // 标题列表,由父组件初始化 @Link tabTitle: string[] // tab标签选中position @Link currentIndex: number //Tab对齐方式 private flexAlign?: FlexAlign = FlexAlign.Center; // tab标签选中监听 private tabSelectCallback: (position: number, title: string) => void = (position: number, title: stri...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabLayout AST#component_body#Left { // 标题列表,由父组件初始化 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right tabTitle : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left strin...
@Component export struct CustomTabLayout { @Link tabTitle: string[] @Link currentIndex: number private flexAlign?: FlexAlign = FlexAlign.Center; private tabSelectCallback: (position: number, title: string) => void = (position: number, title: string) => { LogUtils.debug('tabSelected position = ' ...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/CustomTabLayout.ets#L6-L34
a6137f35bcc0468eba0459ea650eda14f6ce1f59
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONArrayList.ets
arkts
parse
json字符串转换为JSONArrayList对象 @param bean 实体对象 @returns JSON 对象
public static parse(jsonStr: string): JSONArrayList { let json = new JSONArrayList(); const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); //转换成json对象 let jVal: Record<string, JSONValue> = JSON.parse(replaceStr); //循环赋值 Object.entries(jVal).forEach((...
AST#method_declaration#Left public static parse AST#parameter_list#Left ( AST#parameter#Left jsonStr : 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 JSONArrayList AST#...
public static parse(jsonStr: string): JSONArrayList { let json = new JSONArrayList(); const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); let jVal: Record<string, JSONValue> = JSON.parse(replaceStr); Object.entries(jVal).forEach((item) => { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONArrayList.ets#L37-L59
cae6f7d6b82b4f64a6e0a9b574fad4bd6166f393
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/user/UserNavigator.ets
arkts
toFootprint
跳转到用户足迹 @returns {void} 无返回值
static toFootprint(): void { navigateTo(UserRoutes.Footprint); }
AST#method_declaration#Left static toFootprint AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_e...
static toFootprint(): void { navigateTo(UserRoutes.Footprint); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/user/UserNavigator.ets#L45-L47
7b93aefff9e8c5ef348c493e584131cc4b97f75d
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/dialog/base/BaseSheetOptions.ets
arkts
TODO 半模态工具类,Base参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fharmony-dialog github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/harmony-utils CSDN: https://blog.csdn.net/qq_32922545 QQ交流群: 1029219059
export interface BaseSheetOptions extends SheetOptions { uiContext?: UIContext; //在UIContext实例对应的窗口中显示半模态。说明:使用openBindSheet启动的半模态页面,不支持设置、更新该属性。 dialogId?: string; //弹框id,具有唯一性 targetId?: number | string; //需要绑定组件的ID,若不指定则不绑定任何组件。string类型:传入组件的id,number类型:传入组件的UniqueId this.getUniqueId()。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseSheetOptions AST#extends_clause#Left extends SheetOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation...
export interface BaseSheetOptions extends SheetOptions { uiContext?: UIContext; dialogId?: string; targetId?: number | string; }
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/base/BaseSheetOptions.ets#L28-L34
b357e85c0cf53917d0463f3acfda1f08a217ef41
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/http/apiService.ets
arkts
获取排行榜 @param rankType "weekly" "monthly" "historical" @returns
export function getRankList(rankType: string) { return axiosClient.get<HomeModel>( { url: baseUrl + "api/v4/rankList/videos", params: { "strategy": rankType } } ) }
AST#export_declaration#Left export AST#function_declaration#Left function getRankList AST#parameter_list#Left ( AST#parameter#Left rankType : 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 { A...
export function getRankList(rankType: string) { return axiosClient.get<HomeModel>( { url: baseUrl + "api/v4/rankList/videos", params: { "strategy": rankType } } ) }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L83-L90
9fe683c741e43bf8906e7f8137ff3ff6d1f2c3e9
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets
arkts
rawfile中图片保存的沙箱路径
build() { Column() { // 保存网络图片到沙箱 Row() { Column() { Image(this.internetSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosa...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 保存网络图片到沙箱 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { ...
build() { Column() { Row() { Column() { Image(this.internetSandBoxPath) .width($r('app.integer.nativesavepictosandbox_image_width')) .height($r('app.integer.nativesavepictosandbox_image_height')) .margin($r('app.integer.nativesavepictosandbox_margin...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets#L46-L161
65e424e49295dae9d3ee7c18d200f0941b91128d
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getReadTimeout
Getter and setter for readTimeout
getReadTimeout(): number | undefined { return this.readTimeout; }
AST#method_declaration#Left getReadTimeout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#L...
getReadTimeout(): number | undefined { return this.readTimeout; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L83-L85
ec939dee023714ffd9ee581c0969920578897ead
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Web/WebGetCameraImage/webgetcameraimage/Index.ets
arkts
WebGetCameraImageView
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage';
AST#export_declaration#Left export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage' ; AST#export_declaration#Right
export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Web/WebGetCameraImage/webgetcameraimage/Index.ets#L16-L16
93ba9a100c74ce8afd2d61bdfc4610c9766c01e7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
getFilesDirPath
获取文件目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir; //根目录 if (Helper.isNotEmpty(dirPath)) { if (Helper.startsWith(dirPath, filePath)) { //路径中包含根目录,是完整路径。 f...
AST#method_declaration#Left static getFilesDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_anno...
static getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir; if (Helper.isNotEmpty(dirPath)) { if (Helper.startsWith(dirPath, filePath)) { filePath = dirPath; ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L168-L184
ed332bed2adcc120e93f731dbfae0470ca7288a0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
offBTStateChange
取消订阅蓝牙设备开关状态事件
private offBTStateChange() { Log.showInfo(TAG, `offBTStateChange`); try { access.off('stateChange'); } catch (err) { Log.showError(TAG, `offBTStateChange: err = ${err}`); } }
AST#method_declaration#Left private offBTStateChange 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 Log AST#expression#Right ....
private offBTStateChange() { Log.showInfo(TAG, `offBTStateChange`); try { access.off('stateChange'); } catch (err) { Log.showError(TAG, `offBTStateChange: err = ${err}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L186-L193
aeb8a55a2cdfb86617e993a0dc6f1e951f12926a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets
arkts
computeTask
[Start compute_task]
@Concurrent function computeTask(): string[] { let array: string[] = [] // AppConstant.CITYS 为需要加载的数据 for (let t of AppConstant.CITYS) { array.push(t.trim()) } let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" }); array.sort((a, b) => collator.compare(a, b)) return arr...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function computeTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#...
@Concurrent function computeTask(): string[] { let array: string[] = [] for (let t of AppConstant.CITYS) { array.push(t.trim()) } let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" }); array.sort((a, b) => collator.compare(a, b)) return array; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets#L31-L41
7ffd0670bcb04e5855c2e51277c5e738e438e911
gitee
langwudong/browser.git
f44fff759c50c162739c1585149018e6f0277471
entry/src/main/ets/view/SettingDialog.ets
arkts
ClearHistoryBuilder
清除浏览记录
@Builder ClearHistoryBuilder() { Row() { Text("清除浏览记录") .margin({left: 15}) .fontSize(17) .onClick(() => { try { this.promptAction.showDialog({ title: "提示", message: "确定要删除所有浏览记录?", alignment: DialogAlignment.Bottom, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ClearHistoryBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui...
@Builder ClearHistoryBuilder() { Row() { Text("清除浏览记录") .margin({left: 15}) .fontSize(17) .onClick(() => { try { this.promptAction.showDialog({ title: "提示", message: "确定要删除所有浏览记录?", alignment: DialogAlignment.Bottom, ...
https://github.com/langwudong/browser.git/blob/f44fff759c50c162739c1585149018e6f0277471/entry/src/main/ets/view/SettingDialog.ets#L92-L130
fc7f4ce51263ef68b0bb156c0a685a4ebf080354
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets
arkts
Basic implementation of IDataSource to handle data listener @class @implements {IDataSource}
export class MonthDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataArray: Month[] = []; /** * 获取数组长度。 * @returns {number} 返回数组长度。 */ public totalCount(): number { return this.dataArray.length; } /** * 获取指定索引数据。 * @param {number} index - 索引值。 ...
AST#export_declaration#Left export AST#class_declaration#Left class MonthDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener ...
export class MonthDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataArray: Month[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): Month { return this.dataArray[index]; } registerDataChangeLi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L28-L136
46ce8d46eebf9b0ef56cb1ffe6335b1dfcc56af1
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PhotoBrowserInfo @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class PhotoBrowserInfo { /** * AnimatorParams. include duration and curve * * @type { ?AnimatorParams } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ animatorParams?: AnimatorParams; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class PhotoBrowserInfo AST#class_body#Left { /** * AnimatorParams. include duration and curve * * @type { ?AnimatorParams } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @at...
export declare class PhotoBrowserInfo { animatorParams?: AnimatorParams; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L443-L453
e787f7e0c626ec1bb797e9c6bda2de8e511dd566
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/model/MenuData.ets
arkts
首页弹窗菜单 menu数据
export class MenuData { public title: ResourceStr; public url: string; constructor(title: ResourceStr, url: string) { this.title = title; this.url = url; } }
AST#export_declaration#Left export AST#class_declaration#Left class MenuData AST#class_body#Left { AST#property_declaration#Left public title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left publi...
export class MenuData { public title: ResourceStr; public url: string; constructor(title: ResourceStr, url: string) { this.title = title; this.url = url; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/MenuData.ets#L17-L25
8727b60861d74080c77dd30f708c6f2cd1b05e8f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarService.ets
arkts
formatLunarDateKey
工具方法:格式化农历日期键
private formatLunarDateKey(lunarDate: LunarDate): string { const month = lunarDate.month.toString().padStart(2, '0'); const day = lunarDate.day.toString().padStart(2, '0'); return `${month}-${day}`; }
AST#method_declaration#Left private formatLunarDateKey AST#parameter_list#Left ( AST#parameter#Left lunarDate : AST#type_annotation#Left AST#primary_type#Left LunarDate AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string...
private formatLunarDateKey(lunarDate: LunarDate): string { const month = lunarDate.month.toString().padStart(2, '0'); const day = lunarDate.day.toString().padStart(2, '0'); return `${month}-${day}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarService.ets#L385-L389
9a93ed2f04d0a4d9889a988e4b1d09b91b912a60
github
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/service/ReminderService.ets
arkts
addReminder
发布提醒
static async addReminder(title: string, targetTime: Date): Promise<number> { let reminder: reminderAgentManager.ReminderRequestCalendar = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR, dateTime: { year: targetTime.getFullYear(), month: targetTime.getMonth() + 1...
AST#method_declaration#Left static async addReminder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetTime : AST#type_annotation#Left AST#primary_type#Left Date AST#p...
static async addReminder(title: string, targetTime: Date): Promise<number> { let reminder: reminderAgentManager.ReminderRequestCalendar = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR, dateTime: { year: targetTime.getFullYear(), month: targetTime.getMonth() + 1...
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/service/ReminderService.ets#L7-L39
0799c5f22502d3881e895453248e58d7b9749bed
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets
arkts
aboutToAppear
[StartExclude tabs_bar_translate]
async aboutToAppear(): Promise<void> { this.updateTabItems(); this.subscribeSystemLanguageUpdate(); }
AST#method_declaration#Left async aboutToAppear 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_ar...
async aboutToAppear(): Promise<void> { this.updateTabItems(); this.subscribeSystemLanguageUpdate(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets#L37-L40
fac5726c2203b220ef471fb07ec66b7131c7c3e5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets
arkts
pushData
添加数据。 @param {CustomDataType} data - 需要添加的数据。
public pushData(data: CustomDataType | CustomDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomDataType AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left CustomDataType [ ] AST#array_type#Right AST#primary_type#Right AST#union_ty...
public pushData(data: CustomDataType | CustomDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L172-L179
a4f7ab961107f6d93c5033da5a72d61f9a902d09
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/ui/AxiosLoadingUtil.ets
arkts
引入命名路由页面 @Author csx @DateTime 2024/6/19 00:16 @TODO WinLoadingUtil 子窗口方式实现全局加载框 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_axios
export class WinLoadingUtil { /** * 缓存窗体集合,关闭时需要 */ private static cacheWindow: window.Window; /** * 解决重复多次弹出关闭可能导致的异常 */ private static showTimes: number = 0; /** * 根据参数创建窗口 * @param options * @returns */ static async showLoading(options?: efAxiosLoadingOptions): Promise<void> { ...
AST#export_declaration#Left export AST#class_declaration#Left class WinLoadingUtil AST#class_body#Left { /** * 缓存窗体集合,关闭时需要 */ AST#property_declaration#Left private static cacheWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type...
export class WinLoadingUtil { private static cacheWindow: window.Window; private static showTimes: number = 0; static async showLoading(options?: efAxiosLoadingOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; WinLoadingUtil.showTimes += 1 if (WinLoadingUtil.s...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/ui/AxiosLoadingUtil.ets#L31-L108
562eef6834a717ffd691e88496ee86d9f35d052c
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets
arkts
GridObjectSortComponent
Declare struct GridObjectSortComponent. @struct { GridObjectSortComponent } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Declare struct GridObjectSortComponent. @struct { GridObjectSortComponent } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
@Component export declare struct GridObjectSortComponent { /** * Component types and parameters of the GridObjectSortComponent. * @type { GridObjectSortComponentOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Component types and param...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct GridObjectSortComponent AST#component_body#Left { /** * Component types and parameters of the GridObjectSortComponent. * @type { GridObjectSortComponentOptions } *...
@Component export declare struct GridObjectSortComponent { @Prop options: GridObjectSortComponentOptions; dataList: Array<GridObjectSortComponentItem>; onSave: (select: Array<GridObjectSortComponentItem>, unselect: Array<GridObjectSortComponentItem>) => void; ...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L291-L372
cc4cbb8f4c2c944a7744f7d2095bb3643e4e4ba8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
verifyPKCS1
验签-PKCS1 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false @returns 验签结果OutDTO对象,其中Msg为验签结果
static verifyPKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024, keyCoding, data...
AST#method_declaration#Left static verifyPKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
static verifyPKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024, keyCoding, data...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L210-L214
4bfb323ca82b0babdc10131459812b90321e8265
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets
arkts
createAnimation
创建动画
createAnimation() { // 计算Mini条距离屏幕顶部的高度(包含顶部非安全区域高度)。Mini条距离屏幕顶部的高度=屏幕高度-Mini条高度-TabBar高度-底部非安全区域高度(导航栏高度) this.animationData.miniDistanceToTop = this.animationData.screenHeight - Constants.MINI_HEIGHT - Constants.BAR_HEIGHT - this.animationData.bottomUnsafeHeight; // 计算Mini条歌曲封面Y轴位置。Mini条距离屏幕顶部的高度(包含顶部...
AST#method_declaration#Left createAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 计算Mini条距离屏幕顶部的高度(包含顶部非安全区域高度)。Mini条距离屏幕顶部的高度=屏幕高度-Mini条高度-TabBar高度-底部非安全区域高度(导航栏高度) AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#...
createAnimation() { this.animationData.miniDistanceToTop = this.animationData.screenHeight - Constants.MINI_HEIGHT - Constants.BAR_HEIGHT - this.animationData.bottomUnsafeHeight; this.animationData.miniImgPositionY = this.animationData.miniDistanceToTop + Constants.MINI_SPACE; this.animat...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets#L217-L281
ec2210bbd9fd6fc8540729249c25b47270d32cda
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
arkts
insertSound
MARK: - 插入操作
async insertSound(sound: CDBSound): Promise<void> { if (!this.db || !sound.lang || !sound.text || !sound.data) return; const sql = `INSERT INTO ${Tables.CSound.name} ( ${Tables.CSound.Col.lang}, ${Tables.CSound.Col.text}, ${Tables.CSound.Col.data} ) VALUES(?, ?, ?)`; // 假设StringEncod...
AST#method_declaration#Left async insertSound AST#parameter_list#Left ( AST#parameter#Left sound : AST#type_annotation#Left AST#primary_type#Left CDBSound AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async insertSound(sound: CDBSound): Promise<void> { if (!this.db || !sound.lang || !sound.text || !sound.data) return; const sql = `INSERT INTO ${Tables.CSound.name} ( ${Tables.CSound.Col.lang}, ${Tables.CSound.Col.text}, ${Tables.CSound.Col.data} ) VALUES(?, ?, ?)`; const encod...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L69-L83
22dd5841f3a9518ce3a54925d58c8d92513d625d
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/model/ImageEditModel.ets
arkts
矩阵操作类型
export enum MatrixType { rotate = 'rotate', translate = 'translate', scale = 'scale' }
AST#export_declaration#Left export AST#enum_declaration#Left enum MatrixType AST#enum_body#Left { AST#enum_member#Left rotate = AST#expression#Left 'rotate' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left translate = AST#expression#Left 'translate' AST#expression#Right AST#enum_member#Right , AST#enum...
export enum MatrixType { rotate = 'rotate', translate = 'translate', scale = 'scale' }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L51-L55
f7676300099c6bb70e73c025052e392cc4c54e94
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets
arkts
onPageShow
Page life cycle after the build
onPageShow(): void { if (this.recordingState === RecordingState.Idle) { // Notes: controller must start after the build() func to init the TextTimer() now this.textTimerController.start() this.startRecorder() // this.flashTheRecordingIcon() // enable this feature depend on the ArkTSPartialUp...
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expres...
onPageShow(): void { if (this.recordingState === RecordingState.Idle) { this.textTimerController.start() this.startRecorder() Logger.info(TAG, 'onPageShow() textTimerController to start') } else { Logger.warn(TAG, 'onPageShow() recording is not idle, recordingState:' + this...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets#L100-L110
1e96153dcbb6cc840d344bc7fca81f5dd70b10c2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/utils/PhotoHelperPage.ets
arkts
save
图片保存进相册(已申请权限使用该方法)
save(){ let ps: Permissions[] = ['ohos.permission.WRITE_IMAGEVIDEO']; PermissionUtil.requestPermissions(ps).then((result) => { if (result) { let imgName = `漂亮小姐姐_${DateUtil.getTodayTime()}`; PhotoHelper.save(photoAccessHelper.PhotoType.IMAGE, 'jpg', { title: imgName }).then(async (uri) => ...
AST#method_declaration#Left save AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ps : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type...
save(){ let ps: Permissions[] = ['ohos.permission.WRITE_IMAGEVIDEO']; PermissionUtil.requestPermissions(ps).then((result) => { if (result) { let imgName = `漂亮小姐姐_${DateUtil.getTodayTime()}`; PhotoHelper.save(photoAccessHelper.PhotoType.IMAGE, 'jpg', { title: imgName }).then(async (uri) => ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L148-L170
633596b1129c4edcbc03c12ab1a4a6db0afe466c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets
arkts
connectToServer
Connect to the server and perform TLS upgrade
function connectToServer(serverIp: string, serverPort: number, ca: string, cert: string, privateKey: string) { if (tcpSocket) { workerPort.postMessage({ type: 'connectFailure', message: 'TCP already connected' }); return; } tcpSocket = socket.constructTCPSocketInstance(); let serverAddress: ServerAddr...
AST#function_declaration#Left function connectToServer AST#parameter_list#Left ( AST#parameter#Left serverIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serverPort : AST#type_annotation#Left AST#primary_type#Left numbe...
function connectToServer(serverIp: string, serverPort: number, ca: string, cert: string, privateKey: string) { if (tcpSocket) { workerPort.postMessage({ type: 'connectFailure', message: 'TCP already connected' }); return; } tcpSocket = socket.constructTCPSocketInstance(); let serverAddress: ServerAddr...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets#L101-L148
204486647d2d1505fe9c58c21837e0f956f91c06
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
AI生成配置接口
export interface AIGenerationConfig { modelConfig: AIModelConfig; streamMode: StreamMode; enableStreamDelay: boolean; streamDelayMs: number; maxRetries: number; timeout: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIGenerationConfig AST#object_type#Left { AST#type_member#Left modelConfig : AST#type_annotation#Left AST#primary_type#Left AIModelConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left streamMode :...
export interface AIGenerationConfig { modelConfig: AIModelConfig; streamMode: StreamMode; enableStreamDelay: boolean; streamDelayMs: number; maxRetries: number; timeout: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L514-L521
8ca495de088ea799c66ad3c9b337ee1af7e331cd
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/database/DistributedDB.ets
arkts
saveSurvey
新增数据
async saveSurvey(survey: Survey, isSync = true): Promise<number> { if (!this.rdbStore) { Logger.info('[saveSurvey]', 'saveSurvey() has no callback!'); return -1; } try { const insertData: relationalStore.ValuesBucket = { 'title': survey.title, 'description': survey.descri...
AST#method_declaration#Left async saveSurvey AST#parameter_list#Left ( AST#parameter#Left survey : AST#type_annotation#Left AST#primary_type#Left Survey AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSync = AST#expression#Left AST#boolean_literal#Left true AST#boolean_litera...
async saveSurvey(survey: Survey, isSync = true): Promise<number> { if (!this.rdbStore) { Logger.info('[saveSurvey]', 'saveSurvey() has no callback!'); return -1; } try { const insertData: relationalStore.ValuesBucket = { 'title': survey.title, 'description': survey.descri...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/database/DistributedDB.ets#L34-L77
796c2704004a48441bae9260619d15d1031ff6d3
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardOne.ets
arkts
buildWordTitleRow
构建单词标题行(英文单词 + 语音按钮)
@Builder buildWordTitleRow() { Row(){ // 英文单词 Text(this.word.titleEn) .fontColor($r('app.color.color_card_title')) .maxFontSize(30) .minFontSize(0.1) .maxLines(1) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Start) .layoutWeight(1) // 占据剩余空间...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWordTitleRow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 英文单词 AST#ar...
@Builder buildWordTitleRow() { Row(){ Text(this.word.titleEn) .fontColor($r('app.color.color_card_title')) .maxFontSize(30) .minFontSize(0.1) .maxLines(1) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Start) .layoutWeight(1) .onClic...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L163-L188
a3c2b2b1eaba66605cfcd0ca4d1b5fcd9f57bd43
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets
arkts
clearLastChar
删除最后一个字符
clearLastChar() { if (this.inputValue.length > 0) { this.inputValue = this.inputValue.substring(0, this.inputValue.length - 1); } }
AST#method_declaration#Left clearLastChar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#L...
clearLastChar() { if (this.inputValue.length > 0) { this.inputValue = this.inputValue.substring(0, this.inputValue.length - 1); } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets#L37-L41
0150a655e7841c29b1df4ad70e311414a915caa1
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
arkts
SearchBar
搜索栏
@Builder SearchBar() { Row() { // Logo Image($r('app.media.startIcon')) .width(34) .height(34) .borderRadius(AppDimensions.radiusSmall) // 搜索框 Row({ space: AppDimensions.spaceSmall }) { Text('🔍') .fontSize(16) Text('搜索商品') .fon...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SearchBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // Logo AST#arkts_ui_e...
@Builder SearchBar() { Row() { Image($r('app.media.startIcon')) .width(34) .height(34) .borderRadius(AppDimensions.radiusSmall) Row({ space: AppDimensions.spaceSmall }) { Text('🔍') .fontSize(16) Text('搜索商品') .fontSize(AppTypo...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L58-L93
d24341f496543e5c734f82b7a580cd052bf2c5c7
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/TCPEchoServer/entry/src/main/ets/pages/Index.ets
arkts
startServer
启动服务
startServer() { //订阅连接事件消息 tcpSocketServer.on('connect', (clientSocket: socket.TCPSocketConnection) => { this.clientList.add(clientSocket) clientSocket.on('message', (msgInfo: socket.SocketMessageInfo) => { //收到的信息转化为字符串 let content = buf2String(msgInfo.message) //显示信息日志,最后加上...
AST#method_declaration#Left startServer 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 tcpSocketServer AST#expressi...
startServer() { tcpSocketServer.on('connect', (clientSocket: socket.TCPSocketConnection) => { this.clientList.add(clientSocket) clientSocket.on('message', (msgInfo: socket.SocketMessageInfo) => { let content = buf2String(msgInfo.message) this.msgHistory += `[${msgI...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TCPEchoServer/entry/src/main/ets/pages/Index.ets#L114-L137
6d792a7ef32ede70f672ddf59ede0c73bdb8cbcf
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/SettingsStorage.ets
arkts
智感握持设置
export async function getHoldCheckEnabled(): Promise<boolean> { const settings = getSettingsInstance(); // true = 开, false = 关 return (await settings.get("holdCheckON", true)) as boolean; }
AST#export_declaration#Left export AST#function_declaration#Left async function getHoldCheckEnabled 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#pri...
export async function getHoldCheckEnabled(): Promise<boolean> { const settings = getSettingsInstance(); return (await settings.get("holdCheckON", true)) as boolean; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L47-L51
b0325f59b473a47acd2f119a27a4abeb924c1b61
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/MoodEntry.ets
arkts
Database row representation for MoodEntry
export interface MoodEntryRow { id: number; date: string; // YYYY-MM-DD format emotion: string; // happy, sad, excited, calm, angry, surprised, neutral intensity: number; // 1-5, how strong the emotion is message_count: number; // number of messages on this day timestamp: number; // when ...
AST#export_declaration#Left export AST#interface_declaration#Left interface MoodEntryRow AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left date : AST#type_annotation#Left AS...
export interface MoodEntryRow { id: number; date: string; emotion: string; intensity: number; message_count: number; timestamp: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L11-L18
afc1634a99989cdc8742913dedba7442b7d5cccd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbOption.ets
arkts
视频帧图片选项
export class ThumbContent { // 当加载帧没有完成,默认的占位图 public framePlaceholder?: PixelMap = undefined; // 裁剪视频预览长方形条状区域背景颜色 public frameBackground: string = '#000000'; // 视频帧加载成功后的图片信息 public pixelMap?: PixelMap = undefined; }
AST#export_declaration#Left export AST#class_declaration#Left class ThumbContent AST#class_body#Left { // 当加载帧没有完成,默认的占位图 AST#property_declaration#Left public framePlaceholder ? : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST...
export class ThumbContent { public framePlaceholder?: PixelMap = undefined; public frameBackground: string = '#000000'; public pixelMap?: PixelMap = undefined; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbOption.ets#L19-L26
00bf3bcb6c3c22a20668f0fa1d0157bf72833b04
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/vibrateeffect/src/main/ets/components/constantsData.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const CONFIGURATION: Record<string, number> = { 'VIBRATION_TIME': 600, 'ANIMATION_TIME': 100, 'MARGIN_VERTICAL': 16, 'FLEX_SHRINK': 1, 'POPUP_POSITION_X': 8, 'POPUP_POSITION_Y': 1, 'MARK_POSITION_X': 4, 'MARK_POSITION_Y': 9, 'POSITION_ZERO': 0, 'OPACITY_VALUE': 0.8, 'PLAYBACK_COUNT': 2, '...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CONFIGURATION : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right...
export const CONFIGURATION: Record<string, number> = { 'VIBRATION_TIME': 600, 'ANIMATION_TIME': 100, 'MARGIN_VERTICAL': 16, 'FLEX_SHRINK': 1, 'POPUP_POSITION_X': 8, 'POPUP_POSITION_Y': 1, 'MARK_POSITION_X': 4, 'MARK_POSITION_Y': 9, 'POSITION_ZERO': 0, 'OPACITY_VALUE': 0.8, 'PLAYBACK_COUNT': 2, '...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/src/main/ets/components/constantsData.ets#L16-L29
49a4e2b3eb942042cfe675fb84357ff050f41dee
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webcustompressmenu/src/main/ets/components/mainpage/MainPage.ets
arkts
getPopupPosition
计算弹窗相对手指和屏幕的偏移量。 @returns 弹窗的偏移量。
getPopupPosition(): Position { // 计算弹窗的宽高,用于计算偏移量 let popupWidth: number = MENU_ITEM_WIDTH_LEVEL1; let popupHeight: number = 0; if (this.param?.existsImageContents()) { popupHeight += MENU_ITEM_HEIGHT; } switch (this.param?.getEditStateFlags()) { case ContextMenuEditStateFlags.CAN_CU...
AST#method_declaration#Left getPopupPosition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right { // 计算弹窗的宽高,用于计算偏移量 AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variabl...
getPopupPosition(): Position { let popupWidth: number = MENU_ITEM_WIDTH_LEVEL1; let popupHeight: number = 0; if (this.param?.existsImageContents()) { popupHeight += MENU_ITEM_HEIGHT; } switch (this.param?.getEditStateFlags()) { case ContextMenuEditStateFlags.CAN_CUT: case Cont...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webcustompressmenu/src/main/ets/components/mainpage/MainPage.ets#L243-L255
5ee90048d79aa8aa14203af7f89d58382ab5c21c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/view/UserAgreementPage.ets
arkts
构建用户协议页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "用户协议", viewModel: this.vm }) { this.UserAgreementContent(); } }
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#expression#Right AST#component_parameter#Right , AST#component_...
build() { AppNavDestination({ title: "用户协议", viewModel: this.vm }) { this.UserAgreementContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/UserAgreementPage.ets#L20-L27
bbc8f044adfc4f2fe2078ff40d1ce7439398c4d8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AVRecorder/entry/src/main/ets/utils/DateTimeUtils.ets
arkts
Copyright (C) 2023-2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
export default class DateTimeUtil { getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()) } getDate(): string { const DATETIME = new Date(); return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1,...
AST#export_declaration#Left export default AST#class_declaration#Left class DateTimeUtil AST#class_body#Left { AST#method_declaration#Left getTime 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_state...
export default class DateTimeUtil { getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()) } getDate(): string { const DATETIME = new Date(); return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1,...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVRecorder/entry/src/main/ets/utils/DateTimeUtils.ets#L16-L38
1f7e5a1aa2b578161d49d43ab3975dc17ff3fdad
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
@file 商品详情页面 ViewModel @author Joker.X
@ObservedV2 export default class GoodsDetailViewModel extends BaseNetWorkViewModel<GoodsDetail> { /** * 顶部导航栏透明度(0-255) */ @Trace topBarAlpha: number = 0; /** * 累计滚动距离 */ private totalScrollOffset: number = 0; /** * 是否显示规格选择弹窗 */ @Trace showSpecSelectModal: boolean = false; /** * ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class GoodsDetailViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_...
@ObservedV2 export default class GoodsDetailViewModel extends BaseNetWorkViewModel<GoodsDetail> { @Trace topBarAlpha: number = 0; private totalScrollOffset: number = 0; @Trace showSpecSelectModal: boolean = false; @Trace specList: GoodsSpec[] = []; @Trace specUiState: BaseNetWorkUiState...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L13-L231
10fee9c45a83d5366f4e6b37fc0bf28ec1b2a40f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets
arkts
resetDefaultOffSet
Reset the offset to the default value.
public resetDefaultOffSet() { this.offsetXLeft = CommonConstant.DEFAULT_OFFSET_X_LEFT; this.offsetXRight = CommonConstant.DEFAULT_OFFSET_X_RIGHT; this.offsetYTop = CommonConstant.DEFAULT_OFFSET_Y_TOP; this.offsetYBottom = CommonConstant.DEFAULT_OFFSET_Y_BOTTOM; }
AST#method_declaration#Left public resetDefaultOffSet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetXLeft AST#member_e...
public resetDefaultOffSet() { this.offsetXLeft = CommonConstant.DEFAULT_OFFSET_X_LEFT; this.offsetXRight = CommonConstant.DEFAULT_OFFSET_X_RIGHT; this.offsetYTop = CommonConstant.DEFAULT_OFFSET_Y_TOP; this.offsetYBottom = CommonConstant.DEFAULT_OFFSET_Y_BOTTOM; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets#L43-L48
24ed057ca0bf6d508c16d3e5f8b01a4ae7cffc02
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/permission/PermissionUtils.ets
arkts
requestStoragePermission
申请存储权限(读写用户存储) 用法示例:PermissionUtils.requestStoragePermission() { granted => ... } @param callback 权限申请结果回调
public async requestStoragePermission(callback: (granted: boolean) => void): Promise<void> { const permissions: Permissions[] = [ "ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA" ]; await this.handlePermissionResult('存储权限', callback, permissions); }
AST#method_declaration#Left public async requestStoragePermission AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotati...
public async requestStoragePermission(callback: (granted: boolean) => void): Promise<void> { const permissions: Permissions[] = [ "ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA" ]; await this.handlePermissionResult('存储权限', callback, permissions); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L172-L178
ab4ef47a84e67733bf79e0c11ab8411d4f67525a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets
arkts
FileDownloadItem
单个下载任务
@Component export struct FileDownloadItem { // 文件下载配置 @State downloadConfig: request.agent.Config = { action: request.agent.Action.DOWNLOAD, url: '' }; // 下载文件名 @State fileName: string = ''; // 下载任务状态 @State state: string = ''; // 监听是否全部开始下载 @Link @Watch('onDownLoadUpdated') isStartAllDownload: boolean;...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FileDownloadItem AST#component_body#Left { // 文件下载配置 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right downloadConfig : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left...
@Component export struct FileDownloadItem { @State downloadConfig: request.agent.Config = { action: request.agent.Action.DOWNLOAD, url: '' }; @State fileName: string = ''; @State state: string = ''; @Link @Watch('onDownLoadUpdated') isStartAllDownload: boolean; private downloadTask: request.age...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets#L46-L183
ee04c33460d95e006fb6ea42f4d6b3b5a2fb10bf
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets
arkts
getLow
Returns the lower shadows lowest value. @return
public getLow(): number { return this.mShadowLow; }
AST#method_declaration#Left public getLow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression...
public getLow(): number { return this.mShadowLow; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets#L108-L110
e5814e4c0bea39d85a220b631514b322b0f2b281
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Popup.d.ets
arkts
Defines the popup button options @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines the popup button options @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface PopupButtonOptions { /** * Set the button display content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Set the button display content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full *...
AST#export_declaration#Left export AST#interface_declaration#Left interface PopupButtonOptions AST#object_type#Left { /** * Set the button display content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Set the button display content. *...
export interface PopupButtonOptions { text: ResourceStr; action?: () => void; fontSize?: number | string | Resource; fontColor?: ResourceColor; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Popup.d.ets#L119-L187
46d9fcfe67aa3cf09dc941ade034fabfd85da339
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/link_tools.ets
arkts
Opens uri with filemanager. @param uri the uri.
export function open_file_uri(uri: string, context: Context) { // Open folder let link: string = 'filemanager://openDirectory'; let openLinkOptions: OpenLinkOptions = { parameters: { 'fileUri': uri } }; try { (context as common.UIAbilityContext).openLink(link, openLinkOptions) } catch (e) ...
AST#export_declaration#Left export AST#function_declaration#Left function open_file_uri AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AS...
export function open_file_uri(uri: string, context: Context) { let link: string = 'filemanager://openDirectory'; let openLinkOptions: OpenLinkOptions = { parameters: { 'fileUri': uri } }; try { (context as common.UIAbilityContext).openLink(link, openLinkOptions) } catch (e) { console....
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/link_tools.ets#L10-L23
bcb7121b989fa586a534842e6cb297e113711b4a
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/DateUtils.ets
arkts
获取本周的日期范围
export function getDateRangeOfThisWeek(date: Date | number) { // 获取本周的第一天和下一周的第一天 const beginDate = getMondayOfWeek(date) const nextWeek = new Date(beginDate.getTime()) nextWeek.setDate(nextWeek.getDate() + 7) // 返回日期范围对象 return { beginDate: beginDate.getTime(), endDate: nextWeek.getTime() - 1 }; }
AST#export_declaration#Left export AST#function_declaration#Left function getDateRangeOfThisWeek AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right A...
export function getDateRangeOfThisWeek(date: Date | number) { const beginDate = getMondayOfWeek(date) const nextWeek = new Date(beginDate.getTime()) nextWeek.setDate(nextWeek.getDate() + 7) return { beginDate: beginDate.getTime(), endDate: nextWeek.getTime() - 1 }; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L116-L123
d46ff5140c975b422ba8302de072539900f23499
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
spring
弹性动画
static spring(duration: number = 500): object { return { duration: duration, curve: curve.Spring }; }
AST#method_declaration#Left static spring AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
static spring(duration: number = 500): object { return { duration: duration, curve: curve.Spring }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L62-L67
e623cf9b982a1195ac0c83f323a7911ec8b25927
github
smarthane/DrawerLayout.git
0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec
DrawerLayout/src/main/ets/components/DrawerLayout.ets
arkts
DrawerLayout
********************************************************* @author smarthane @version v1.0.0 DrawerLayout 左右抽屉布局,侧边栏布局。 提供侧边栏可以显示和隐藏的侧边栏布局组件,通过子组件定义侧边栏和内容区。 https://github.com/smarthane/DrawerLayout https://gitee.com/smarthane/drawerlayout **********************************************************
@Component export struct DrawerLayout { @Link model: DrawerLayout.Model @BuilderParam drawerView?: () => any @BuilderParam contentView?: () => any @Watch('watchDrawerTypeChange') @State currentDrawerType: DrawerLayout.Type = DrawerLayout.Type.LEFT // 当设备横屏时条件成立 private mediaqueryListener = mediaquery.match...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DrawerLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right model : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DrawerLayout . Model AS...
@Component export struct DrawerLayout { @Link model: DrawerLayout.Model @BuilderParam drawerView?: () => any @BuilderParam contentView?: () => any @Watch('watchDrawerTypeChange') @State currentDrawerType: DrawerLayout.Type = DrawerLayout.Type.LEFT private mediaqueryListener = mediaquery.matchMediaSync('(o...
https://github.com/smarthane/DrawerLayout.git/blob/0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec/DrawerLayout/src/main/ets/components/DrawerLayout.ets#L15-L67
9b623aa4aa416a48cefc1d224a841005868ad1e2
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
数据库操作参数类型定义 支持:字符串(string)、数字(number)、布尔值(boolean)、null四种类型
export type ParamType = relationalStore.ValueType// | relationalStore.UTCTime //string | number | boolean | null;
AST#export_declaration#Left export AST#type_declaration#Left type ParamType = AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValueType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right // | relationalStore.UTCTime //string | number | boolean | null; AST...
export type ParamType = relationalStore.ValueType
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L12-L12
ef61b255da2d0f6e09a5a3116e4c79e1754387dd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets
arkts
============================================================ MARK: - DetailItem 偏好设置常量
export class DetailItemPref { static readonly Name = "DetailItemSort_Setting001" static readonly kOrder = "DetailItem_Key_Order" static readonly kVisiable = "DetailItem_Key_Visable" }
AST#export_declaration#Left export AST#class_declaration#Left class DetailItemPref AST#class_body#Left { AST#property_declaration#Left static readonly Name = AST#expression#Left "DetailItemSort_Setting001" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kOrder = AST#ex...
export class DetailItemPref { static readonly Name = "DetailItemSort_Setting001" static readonly kOrder = "DetailItem_Key_Order" static readonly kVisiable = "DetailItem_Key_Visable" }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L9-L13
3b0271ca725e421745b807c114e30023d9ede374
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
getFullYear
获取年份
getFullYear(): number { return this.date.year; }
AST#method_declaration#Left getFullYear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
getFullYear(): number { return this.date.year; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L165-L167
4d8a67742b44ceb046abf7b70f2be9da4b60afcb
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/configs/ProjectConfig.ets
arkts
上次版本号
export const kUserDefault_LastVersion = 'kUserDefault_LastVersion';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left kUserDefault_LastVersion = AST#expression#Left 'kUserDefault_LastVersion' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const kUserDefault_LastVersion = 'kUserDefault_LastVersion';
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/configs/ProjectConfig.ets#L11-L11
36639fc8cf6a8e44029948392e820ab74276631a
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
LogisticsTrackCard
物流轨迹卡片 @param {Logistics} logistics - 物流信息 @returns {void} 无返回值
@Builder private LogisticsTrackCard(logistics: Logistics): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.LogisticsTrackTitle() ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LogisticsTrackCard AST#parameter_list#Left ( AST#parameter#Left logistics : AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
@Builder private LogisticsTrackCard(logistics: Logistics): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.LogisticsTrackTitle() ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L230-L246
e2be5b3526e7f088eab13b4659190eb88c5a7f54
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/view/LeftRightFlipPage.ets
arkts
LeftRightPlipPage
左右翻页方式通过swiper+lazyforeach+cachecount实现按需加载。什么时候加载在BasicDataSource的getData方法中实现
@Component export struct LeftRightPlipPage { @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link currentPageNum: number; private swiperController: SwiperController = new SwiperController(); private data: BasicDataSource = new BasicDataSource([]); private screenW: number = px2vp(display....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LeftRightPlipPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isMenuViewVisible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right...
@Component export struct LeftRightPlipPage { @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link currentPageNum: number; private swiperController: SwiperController = new SwiperController(); private data: BasicDataSource = new BasicDataSource([]); private screenW: number = px2vp(display....
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/view/LeftRightFlipPage.ets#L25-L127
edb5e975f14d20621143764199206b65f81d1021
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/MainPage.ets
arkts
MainContent
主页面内容视图 @returns {void} 无返回值
@Builder private MainContent() { Tabs({ index: this.vm.currentPageIndex, barPosition: this.breakpointState.isLG() ? BarPosition.Start : BarPosition.End, }) { TabContent() { CorePage(); }.tabBar(this.tabBarItem(0)); TabContent() { NavigationPage(); }.tabBar(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private MainContent 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 Tabs ( AST#component_parameters#Left { AST#component_p...
@Builder private MainContent() { Tabs({ index: this.vm.currentPageIndex, barPosition: this.breakpointState.isLG() ? BarPosition.Start : BarPosition.End, }) { TabContent() { CorePage(); }.tabBar(this.tabBarItem(0)); TabContent() { NavigationPage(); }.tabBar(...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/MainPage.ets#L52-L86
9b2d130614d179ad4af53c47005e5db0f7f194bd
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/ClassifyViewModel.ets
arkts
getLinkData
Get Classify list data @returns Array<ClassifyModel> linkDataList
getLinkData(): Array<ClassifyModel> { let linkDataList: Array<ClassifyModel> = []; let superId: number = 0; LINK_DATA.forEach((item: LinkDataModel) => { if (superId !== item.superId) { // add the course classify model. let classifyItem: ClassifyModel = { classifyId: item.supe...
AST#method_declaration#Left getLinkData 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 ClassifyModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
getLinkData(): Array<ClassifyModel> { let linkDataList: Array<ClassifyModel> = []; let superId: number = 0; LINK_DATA.forEach((item: LinkDataModel) => { if (superId !== item.superId) { let classifyItem: ClassifyModel = { classifyId: item.superId, classifyName: item...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/ClassifyViewModel.ets#L26-L51
6c6549099276904a205f6f5ad703a7f958bf9b9e
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/model/Message.ets
arkts
createChatMsgEntity_OUTGO_TEXT
构建一条发出的消息对象。 @param message 消息内容 @param fingerPrint 消息ID @returns 新的消息对象
static createChatMsgEntity_OUTGO_TEXT(message: string, fingerPrint: string): Message { let localUid = ChartTools.getLocalUserUid(); if(!localUid) { console.error('无法读取本地用户uid,还没有登录?'); } let cm: Message = new Message(localUid ? localUid : '', "我", getCurrentUTCTimestamp(), message, MsgType.TYPE_...
AST#method_declaration#Left static createChatMsgEntity_OUTGO_TEXT AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fingerPrint : AST#type_annotation#Left AST#primary_type...
static createChatMsgEntity_OUTGO_TEXT(message: string, fingerPrint: string): Message { let localUid = ChartTools.getLocalUserUid(); if(!localUid) { console.error('无法读取本地用户uid,还没有登录?'); } let cm: Message = new Message(localUid ? localUid : '', "我", getCurrentUTCTimestamp(), message, MsgType.TYPE_...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L68-L77
cc5c810ab1dbe45a412483eb7a0767fa044aeecf
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/path_sensitive/explicit_jump_control/continue_001_T.ets
arkts
Introduction 显式跳转控制-continue
export function continue_001_T(taint_src : string) { let res = '' for (let i = 0; i < 10; i++) { if (i === 3) { res = taint_src continue } taint.Sink(res) } }
AST#export_declaration#Left export AST#function_declaration#Left function continue_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left...
export function continue_001_T(taint_src : string) { let res = '' for (let i = 0; i < 10; i++) { if (i === 3) { res = taint_src continue } taint.Sink(res) } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/explicit_jump_control/continue_001_T.ets#L6-L15
cf024fc741f812e4bbecfe32dce8db6f1ba4e773
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileUtility.ets
arkts
moveFile
移动文件
static moveFile(fromPath: string, toPath: string): boolean { try { if (fs.accessSync(fromPath)) { fs.copyFileSync(fromPath, toPath); fs.unlinkSync(fromPath); return true; } return false; } catch (e) { return false; } }
AST#method_declaration#Left static moveFile AST#parameter_list#Left ( AST#parameter#Left fromPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static moveFile(fromPath: string, toPath: string): boolean { try { if (fs.accessSync(fromPath)) { fs.copyFileSync(fromPath, toPath); fs.unlinkSync(fromPath); return true; } return false; } catch (e) { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L169-L180
9e8de729e8a84b60ec6ecef9a294bbab11f302e3
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
setCurrentTheme
设置当前主题
async setCurrentTheme(themeType: string): Promise<boolean> { console.log(`开始设置主题: ${themeType}`); const newTheme = this.getAllThemes().find(theme => theme.type === themeType); if (!newTheme) { console.error('主题类型不存在:', themeType); return false; } if (this.currentTheme.type === themeTyp...
AST#method_declaration#Left async setCurrentTheme AST#parameter_list#Left ( AST#parameter#Left themeType : 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 setCurrentTheme(themeType: string): Promise<boolean> { console.log(`开始设置主题: ${themeType}`); const newTheme = this.getAllThemes().find(theme => theme.type === themeType); if (!newTheme) { console.error('主题类型不存在:', themeType); return false; } if (this.currentTheme.type === themeTyp...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L80-L116
dc155ea899ba908d07583a57f94093e9204e54d3
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/DateUtils.ets
arkts
根据偏移量调整日期时间。 @param date 日期时间对象或时间戳 @param offset 偏移量,可以为正数(向后移动)或负数(向前移动) @returns 调整后的日期时间对象
export function plusOffset(date: number | Date, offset: number): Date { date = new Date(date) // 确定符号并取得绝对值 const sign = offset >= 0 ? 1 : -1; const absoluteOffset = Math.abs(offset); // 分离小时和分钟 const hours = Math.floor(absoluteOffset); const minutes = Math.floor((absoluteOffset - hours) * 60); date.se...
AST#export_declaration#Left export AST#function_declaration#Left function plusOffset AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_anno...
export function plusOffset(date: number | Date, offset: number): Date { date = new Date(date) const sign = offset >= 0 ? 1 : -1; const absoluteOffset = Math.abs(offset); const hours = Math.floor(absoluteOffset); const minutes = Math.floor((absoluteOffset - hours) * 60); date.setHours(date.getHours() ...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/DateUtils.ets#L59-L71
1c08b5648158a7474d2543eb322561f1b36682dd
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets
arkts
selectDocFile
选择文件
selectDocFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true let segments ...
AST#method_declaration#Left selectDocFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
selectDocFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true let segments ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L221-L235
d80f583fa6661d1f76022bafeced7ebbafeb54f1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/network/NetworkPageData.ets
arkts
构造函数,对接口返回做空值兜底 @param {Partial<NetworkPageData<T>>} payload - 接口返回的分页数据
constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.list ?? null; this.pagination = payload?.pagination ? new NetworkPageMeta(payload.pagination) : null; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left payload ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#...
constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.list ?? null; this.pagination = payload?.pagination ? new NetworkPageMeta(payload.pagination) : null; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkPageData.ets#L21-L24
5124cf4c4e6c74e5003dc5cf0d8c52e8fcfa08d8
github
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/DatabaseAbility.ets
arkts
query
查询数据
query(predicates: relationalStore.RdbPredicates, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'query() has no callback!'); return; } else if (this.rdbStore) { this.rdbStore.query(predicates, thi...
AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback :...
query(predicates: relationalStore.RdbPredicates, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'query() has no callback!'); return; } else if (this.rdbStore) { this.rdbStore.query(predicates, thi...
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/DatabaseAbility.ets#L116-L131
95592e4f16d7244ebddb1bd5c81e15d9576e0cae
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/basicUI/KeyItemNumber.ets
arkts
KeyItemNumber
有大小写的按键组件
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; @State private keyValue: keySourceListType | undefined = undefined; @State WIDTH: number = 36; build() { Flex({ direction: FlexDirection.Column, a...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyItemNumber AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Lef...
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; @State private keyValue: keySourceListType | undefined = undefined; @State WIDTH: number = 36; build() { Flex({ direction: FlexDirection.Column, a...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/basicUI/KeyItemNumber.ets#L30-L95
5c8cbe06d3e81fb0bd68a057ebeb4faaa964b15c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets
arkts
[End module_load_directly] [Start module_load_optimize]
export const dataOptimizeTwo = 1;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dataOptimizeTwo = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const dataOptimizeTwo = 1;
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets#L23-L23
bf037b7f6ab7e18495b82f2d74b9e8eb76d5d40e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
height
Sets the height of the toolBar. @param { LengthMetrics } height - toolBar's height. @returns { ToolBarModifier } returns the instance of the ToolBarModifier. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13 Sets the height of the toolBar. @param { LengthMetrics } height - toolBar's height. @return...
height(height: LengthMetrics): ToolBarModifier;
AST#method_declaration#Left height AST#parameter_list#Left ( AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#prima...
height(height: LengthMetrics): ToolBarModifier;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L436-L436
46b27de16beb2fe82de4a0862a9c49903c1723f5
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets
arkts
buttons
设置弹窗按钮 @param primaryButton 左侧按钮 @param secondaryButton 右侧按钮 @returns
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
AST#method_declaration#Left buttons AST#parameter_list#Left ( AST#parameter#Left primaryButton : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secondaryButton ? : AST#type_annotation#Left AST#primary_type#Left Butto...
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets#L50-L54
d1a7db9346ce5db344ff52988179013697bb8299
github
ssj4429108/OkRequest.git
96ce126dca31a3e532e066d25a4057141429e4ff
reqwest/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.0.26';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.0.26' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.0.26';
https://github.com/ssj4429108/OkRequest.git/blob/96ce126dca31a3e532e066d25a4057141429e4ff/reqwest/BuildProfile.ets#L4-L4
b103928f1d4ce70ef2b2df03e8615b47e6e24edf
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
setContentMode
动画填充模式,默认的填充模式是:Contain @param contentMode 模式:'Fill','Top','Bottom','Cover','Contain'
setContentMode(contentMode: string): void { this.animationItem?.setContentMode(contentMode) }
AST#method_declaration#Left setContentMode AST#parameter_list#Left ( AST#parameter#Left contentMode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
setContentMode(contentMode: string): void { this.animationItem?.setContentMode(contentMode) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L354-L356
f62c7826046448d44911fe54bd2b9c87479c171f
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/storage/bookListData.ets
arkts
初始化页面公用变量
export const initBookListData = ()=>{ AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_REFRESHING, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_GROUPS_REFRESHING, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_WORKS_BOOK_LIST, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_HISTORY_R...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left initBookListData = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#c...
export const initBookListData = ()=>{ AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_REFRESHING, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_GROUPS_REFRESHING, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_WORKS_BOOK_LIST, 0) AppStorage.setOrCreate(CommonConstants.BOOK_IS_BOOK_HISTORY_R...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/storage/bookListData.ets#L7-L13
f297de4e2ea0a418afb0939990bc8ac28cfb9193
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/ScreenUtils.ets
arkts
getDensity
获取屏幕密度
static getDensity(): number { return ScreenUtils.getScreenInfo().densityDPI; }
AST#method_declaration#Left static getDensity AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
static getDensity(): number { return ScreenUtils.getScreenInfo().densityDPI; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ScreenUtils.ets#L38-L40
57d973df90d610a27a1ee0f181db5eef4aff2859
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
rename
重命名文件或文件夹,使用Promise异步回调。 @param oldPath string 文件的应用沙箱原路径。 @param newPath string 文件的应用沙箱新路径。 @returns
static rename(oldPath: string, newPath: string): Promise<void> { return fs.rename(oldPath, newPath); }
AST#method_declaration#Left static rename AST#parameter_list#Left ( AST#parameter#Left oldPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static rename(oldPath: string, newPath: string): Promise<void> { return fs.rename(oldPath, newPath); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L296-L298
bb5f87cb1a246d18eafd4b897b5c965574b75d0a
gitee