nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/danmakuplayer/src/main/ets/common/Constants.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 class Constants { static readonly HUNDRED_PERCENT: number = 100; // 百分比最大值 static readonly MAX_BRIGHTNESS: number = 255; // 最大亮度 static readonly DEFAULT_BRIGHTNESS: number = 10; // 默认亮度 static readonly DANMU_RESIZE_TIME: number = 300; // 默认亮度 static readonly COUNT_DOWN_TIME: number = 3; // UI自动隐藏倒计时时间 ...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly HUNDRED_PERCENT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#...
export class Constants { static readonly HUNDRED_PERCENT: number = 100; static readonly MAX_BRIGHTNESS: number = 255; static readonly DEFAULT_BRIGHTNESS: number = 10; static readonly DANMU_RESIZE_TIME: number = 300; static readonly COUNT_DOWN_TIME: number = 3; static readonly MS_IN_SECOND: number = 100...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/danmakuplayer/src/main/ets/common/Constants.ets#L16-L31
59596071cd1a7a69e88d987d48ef94c4bd616757
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
addListener
添加任务变更监听器
addListener(listener: TaskChangeListener) { this.listeners.push(listener); }
AST#method_declaration#Left addListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TaskChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left...
addListener(listener: TaskChangeListener) { this.listeners.push(listener); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L32-L34
93d9f24162a36922e8338e93b6234e7a8f75ae2d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
appendBaseURL
拼接url @param baseurl @returns
private static appendBaseURL(baseurl?: string): string { let url: string = ''; if (baseurl) { url = baseurl; } return url; }
AST#method_declaration#Left private static appendBaseURL AST#parameter_list#Left ( AST#parameter#Left baseurl ? : 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 string ...
private static appendBaseURL(baseurl?: string): string { let url: string = ''; if (baseurl) { url = baseurl; } return url; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L63-L69
3efe5d6baabd48369a3d33923d329b7051fe40ab
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets
arkts
initNotificationPictureContent
init picture notification content @param basicContent @param notificationBriefText @param notificationExpandedTitle @param notificationPicture @return return the created NotificationContent
initNotificationPictureContent(basicContent: notification.NotificationBasicContent, notificationBriefText: string, notificationExpandedTitle: string, notificationPicture: image.PixelMap) { let result: NotificationContentUtilResultType = { contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, // ...
AST#method_declaration#Left initNotificationPictureContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
initNotificationPictureContent(basicContent: notification.NotificationBasicContent, notificationBriefText: string, notificationExpandedTitle: string, notificationPicture: image.PixelMap) { let result: NotificationContentUtilResultType = { contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets#L96-L109
41a92caeeeaeb7574ec47fdd14c243adbc894ba5
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/RegUtil.ets
arkts
isMatch
给定内容是否匹配正则 @param regex 正则 @param content 内容
static isMatch(pattern: string, content: string): OutDTO<string> { if (content == null || content == '') { // 提供 null 的字符串为不匹配 return OutDTO.Error("验证字符串不能为空"); } if (new RegExp(pattern).test(content)) { return OutDTO.OK("验证字符串格式正确") } else { return OutDTO.Error("验证字符串格式不正确,请检查")...
AST#method_declaration#Left static isMatch AST#parameter_list#Left ( AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static isMatch(pattern: string, content: string): OutDTO<string> { if (content == null || content == '') { return OutDTO.Error("验证字符串不能为空"); } if (new RegExp(pattern).test(content)) { return OutDTO.OK("验证字符串格式正确") } else { return OutDTO.Error("验证字符串格式不正确,请检查") } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RegUtil.ets#L33-L43
d970645afdd8735a3ff933e9eb80cf7402c756aa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
isSameHour
是否是同一时
static isSameHour(selectDate: Date, date: Date): boolean { return DateHelper.isSameDay(selectDate, date) && selectDate.getHours() == date.getHours(); }
AST#method_declaration#Left static isSameHour AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_typ...
static isSameHour(selectDate: Date, date: Date): boolean { return DateHelper.isSameDay(selectDate, date) && selectDate.getHours() == date.getHours(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L137-L139
821b642f52bbd5515a0aa5e390b532b33d442929
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
TODO 窗口工具 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class WindowUtil { /** * 设置窗口的显示方向属性,使用Promise异步回调。 * Orientation 窗口显示方向类型枚举: * UNSPECIFIED 0 表示未定义方向模式,由系统判定。 * PORTRAIT 1 表示竖屏显示模式。 * LANDSCAPE 2 表示横屏显示模式。 * PORTRAIT_INVERTED 3 表示反向竖屏显示模式。 * LANDSCAPE_INVERTED 4 表示反向横屏显示模式。 * AUTO_ROTATION 5 表示传感器自动旋转模式。 ...
AST#export_declaration#Left export AST#class_declaration#Left class WindowUtil AST#class_body#Left { /** * 设置窗口的显示方向属性,使用Promise异步回调。 * Orientation 窗口显示方向类型枚举: * UNSPECIFIED 0 表示未定义方向模式,由系统判定。 * PORTRAIT 1 表示竖屏显示模式。 * LANDSCAPE 2 表示横屏显示模式。 * PORTRAIT_INVERTED 3 表示反向竖屏显示模式。 * LANDS...
export class WindowUtil { static async setPreferredOrientation(orientation: window.Orientation, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setPreferredOrientation(orientation); } static getPreferredOrientation(windowClass: window.Window = AppUtil.get...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L28-L547
25075db42537a56170f608c31c238b30e77d438d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
扩展联系人信息接口
export interface ExtendedContactInfo { interests?: string[]; // 兴趣爱好 dislikes?: string[]; // 讨厌的事 favoriteFoods?: string[]; // 想吃的美食 taboos?: string[]; // 禁忌的事 occupation?: string; // 职业 company?: string; // 公司 department?: string; // 部门 position?: string;...
AST#export_declaration#Left export AST#interface_declaration#Left interface ExtendedContactInfo AST#object_type#Left { AST#type_member#Left interests ? : 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#type_member#Ri...
export interface ExtendedContactInfo { interests?: string[]; dislikes?: string[]; favoriteFoods?: string[]; taboos?: string[]; occupation?: string; company?: string; department?: string; position?: string; address?: string; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L140-L152
9a01d29d7cafba34a32b0a57374c245fe19e5ea8
github
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/view/PublicFilesTab.ets
arkts
loadFileListWithInfo
加载文件列表(包含详细信息)
async loadFileListWithInfo() { console.log('加载文件列表(带详细信息)...'); if (this.fileManager) { try { const files = await this.fileManager.getAllFilesWithInfo(); console.log('获取到的文件数量:', files.length); this.fileList = files; if (files.length > 0) { console.log('示例文件信息:'...
AST#method_declaration#Left async loadFileListWithInfo 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 console AST#expression#R...
async loadFileListWithInfo() { console.log('加载文件列表(带详细信息)...'); if (this.fileManager) { try { const files = await this.fileManager.getAllFilesWithInfo(); console.log('获取到的文件数量:', files.length); this.fileList = files; if (files.length > 0) { console.log('示例文件信息:'...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/view/PublicFilesTab.ets#L211-L232
8f83246e3ab9d990c6f0001e5b355e4d5ee24dfa
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets
arkts
The percentage of 100.
export const PERCENTAGE_100 = '100%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERCENTAGE_100 = AST#expression#Left '100%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const PERCENTAGE_100 = '100%';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L40-L40
a764f9dd910c0bf29792d136212d4b8085daf5f2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KeyboardUtil.ets
arkts
onKeyboardListener
订阅输入法软键盘显示或隐藏事件 @param callBack: show boolen,true-键盘显示、false-键盘隐藏; height 键盘高度。
static onKeyboardListener(callback: KeyboardCallBack): void { if (ArrayUtil.contain(KeyboardUtil.callBacks, callback)) { LogUtil.error(`KeyboardUtil-onKeyboardListener: 监听事件已存在!`); } else { KeyboardUtil.callBacks.push(callback); } if (KeyboardUtil.keyboardCallBack === undefined) { Keyb...
AST#method_declaration#Left static onKeyboardListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left KeyboardCallBack AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
static onKeyboardListener(callback: KeyboardCallBack): void { if (ArrayUtil.contain(KeyboardUtil.callBacks, callback)) { LogUtil.error(`KeyboardUtil-onKeyboardListener: 监听事件已存在!`); } else { KeyboardUtil.callBacks.push(callback); } if (KeyboardUtil.keyboardCallBack === undefined) { Keyb...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KeyboardUtil.ets#L56-L68
bcd9bd66705e470503b73a54662fe47ba5688eee
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
addTask
添加新任务
async addTask(taskData: TaskData): Promise<TaskItem> { const now = new Date(); // 初始化状态历史记录 const statusHistory: TaskStatusHistory[] = [{ status: taskData.status, timestamp: now, note: '任务创建' }]; // 初始化时间记录 const timeRecord: TaskTimeRecord = { totalTimeSpent: 0, f...
AST#method_declaration#Left async addTask AST#parameter_list#Left ( AST#parameter#Left taskData : AST#type_annotation#Left AST#primary_type#Left TaskData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
async addTask(taskData: TaskData): Promise<TaskItem> { const now = new Date(); const statusHistory: TaskStatusHistory[] = [{ status: taskData.status, timestamp: now, note: '任务创建' }]; const timeRecord: TaskTimeRecord = { totalTimeSpent: 0, focusTime: 0, bre...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L95-L149
4481fc5f3900bb04f8e37f567c3eb94d8aabbe42
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/components/common/LoadingView.ets
arkts
ListLoadingMore
列表加载更多组件
@Component export struct ListLoadingMore { @Prop loading: boolean = false; @Prop hasMore: boolean = true; @Prop loadingText: string = '加载更多...'; @Prop noMoreText: string = '没有更多数据'; build() { Row({ space: 12 }) { if (this.loading && this.hasMore) { LoadingProgress() .width(16) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListLoadingMore AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right loading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an...
@Component export struct ListLoadingMore { @Prop loading: boolean = false; @Prop hasMore: boolean = true; @Prop loadingText: string = '加载更多...'; @Prop noMoreText: string = '没有更多数据'; build() { Row({ space: 12 }) { if (this.loading && this.hasMore) { LoadingProgress() .width(16) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/components/common/LoadingView.ets#L60-L89
7df6228b8cd27963380267277247eb0fefc4bfb8
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/view/CustomDialogComponent.ets
arkts
CustomDialogComponent
Custom pop-up window.
@CustomDialog export default struct CustomDialogComponent { controller: CustomDialogController = new CustomDialogController({'builder': ''}); cancel: Function = () => {}; confirm: Function = () => {}; build() { Column() { Text($r('app.string.dialog_text_title')) .width(CommonConstants.DIALOG_...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct CustomDialogComponent AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Ri...
@CustomDialog export default struct CustomDialogComponent { controller: CustomDialogController = new CustomDialogController({'builder': ''}); cancel: Function = () => {}; confirm: Function = () => {}; build() { Column() { Text($r('app.string.dialog_text_title')) .width(CommonConstants.DIALOG_...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/view/CustomDialogComponent.ets#L24-L88
1f944ddb917b29cf4feec47d4052e85f3bba70be
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHBarrageView.ets
arkts
VHBarrageViews
弹幕
@Preview @Component export struct VHBarrageViews { private barrageController: BarrageController = new BarrageController; @State comHeight: number = 0; @State enable:boolean=true; aboutToAppear(): void { EmitterUtil.subscribe(VHRoomEventType.IM_TEXT, (msgData: EmitterMsgData) => { console.log(`收到文本消息,...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct VHBarrageViews AST#component_body#Left { AST#property_declaration#Left private barrageController : AST#type_annotation#Left AST#primary_type#Left BarrageController AST#...
@Preview @Component export struct VHBarrageViews { private barrageController: BarrageController = new BarrageController; @State comHeight: number = 0; @State enable:boolean=true; aboutToAppear(): void { EmitterUtil.subscribe(VHRoomEventType.IM_TEXT, (msgData: EmitterMsgData) => { console.log(`收到文本消息,...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHBarrageView.ets#L7-L84
2a22daea1e13c5f4bb14a7f1ae638f399ebba1f5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listslidetohistory/src/main/ets/constants/ListConstants.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 class ListConstants { static readonly LAYOUT_WEIGHT: number = 1; // 自动分配剩余空间 static readonly LIST_SPACE: number = 8; // 列表默认间隔 }
AST#export_declaration#Left export AST#class_declaration#Left class ListConstants AST#class_body#Left { AST#property_declaration#Left static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#...
export class ListConstants { static readonly LAYOUT_WEIGHT: number = 1; static readonly LIST_SPACE: number = 8; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/constants/ListConstants.ets#L16-L19
3998e977f2a03df79014d1c6c0bc9549148a1b61
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SegmentButton.d.ets
arkts
capsule
The function used to create a SegmentButtonOptions of capsule type. @param { CapsuleSegmentButtonConstructionOptions } options - The options of SegmentButton. @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of capsule type. @static @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatfor...
static capsule(options: CapsuleSegmentButtonConstructionOptions): SegmentButtonOptions;
AST#method_declaration#Left static capsule AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CapsuleSegmentButtonConstructionOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_...
static capsule(options: CapsuleSegmentButtonConstructionOptions): SegmentButtonOptions;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButton.d.ets#L1748-L1748
7fa5a6cc5c825ff3e1c0950e3e4298956161c039
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
MessageUtils
消息工具函数 提供批量操作、过滤、分组等实用功能
export { MessageUtils } from './MessageUtils'
AST#export_declaration#Left export { MessageUtils } from './MessageUtils' AST#export_declaration#Right
export { MessageUtils } from './MessageUtils'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L76-L76
71730cce6804f16b0365b2b67de20eab083729f6
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
ChipGroup
Defines chipGroup. @struct ChipGroup @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
@Component export declare struct ChipGroup { /** * Chip item. * * @type { ChipGroupItemOptions[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ @Require @Prop items: ChipGroupItemOptions[]; /** * Chip item s...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ChipGroup AST#component_body#Left { /** * Chip item. * * @type { ChipGroupItemOptions[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform ...
@Component export declare struct ChipGroup { @Require @Prop items: ChipGroupItemOptions[]; @Prop itemStyle?: ChipItemStyle; @Prop selectedIndexes?: Array<number>; @Prop multiple?: boolean; @Prop chipGroupSpace?: ChipGroupSpaceOptions; @Prop ...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L341-L431
f81d853b4868c865a05c33f5446a0cc810d42d10
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/ReceiveCouponRequest.ets
arkts
@file 领取优惠券请求参数 @author Joker.X
export class ReceiveCouponRequest { /** * 优惠券ID */ couponId: number; /** * @param {ReceiveCouponRequest} init - 初始化数据 */ constructor(init: ReceiveCouponRequest) { this.couponId = init.couponId; } }
AST#export_declaration#Left export AST#class_declaration#Left class ReceiveCouponRequest AST#class_body#Left { /** * 优惠券ID */ AST#property_declaration#Left couponId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * @p...
export class ReceiveCouponRequest { couponId: number; constructor(init: ReceiveCouponRequest) { this.couponId = init.couponId; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/ReceiveCouponRequest.ets#L5-L17
401e1947eb651c8d34d6d71d1f59f2c12a2108b5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
getDevice
获取设备信息
private getDevice(deviceId: string, deviceName: string): BluetoothDevice { Log.showInfo(TAG, `getDevice: deviceId = ${deviceId}, deviceName = ${deviceName}`); let device = new BluetoothDevice(); device.deviceId = deviceId; device.deviceName = deviceName; Log.showInfo(TAG, `getDevice: device = ${JSON...
AST#method_declaration#Left private getDevice AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left deviceName : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
private getDevice(deviceId: string, deviceName: string): BluetoothDevice { Log.showInfo(TAG, `getDevice: deviceId = ${deviceId}, deviceName = ${deviceName}`); let device = new BluetoothDevice(); device.deviceId = deviceId; device.deviceName = deviceName; Log.showInfo(TAG, `getDevice: device = ${JSON...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L471-L478
f0db2318c6c8a41ea8873bbb493af017e1a28787
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDH.ets
arkts
ecdh
ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 @returns ECC256共享密钥
static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>> { return DynamicUtil.dynamicKey(pubKey, priKey, 'ECC256', 256); }
AST#method_declaration#Left static async ecdh AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ...
static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>> { return DynamicUtil.dynamicKey(pubKey, priKey, 'ECC256', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDH.ets#L32-L34
13f2d50ed2238aa3c14c2c8102cc5108bb1b42af
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets
arkts
topUpBuilder
展开后的蓝色回顶部图标
@Builder topUpBuilder() { Column() { Image($r("app.media.status_bar_animation_top_up")) .width($r('app.integer.status_bar_animation_top_up_width')) .aspectRatio(Constants.ASPECT_RATIO_ONE) Text($r('app.string.status_bar_animation_top_up_text')) .textAlign(TextAlign.Center) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right topUpBuilder 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#arkts_ui_ele...
@Builder topUpBuilder() { Column() { Image($r("app.media.status_bar_animation_top_up")) .width($r('app.integer.status_bar_animation_top_up_width')) .aspectRatio(Constants.ASPECT_RATIO_ONE) Text($r('app.string.status_bar_animation_top_up_text')) .textAlign(TextAlign.Center) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets#L139-L173
d15c74295ad8568c5142491ca8f41dc4f9da2b81
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
replace
替换字符串中匹配的正则为给定的字符串 @param str 待替换的字符串 @param pattern 要匹配的内容正则或字符串 @param replaceValue 替换的内容 @returns
static replace(str: string, pattern: RegExp | string, replaceValue: string = ''): string { return str.replace(pattern, replaceValue); }
AST#method_declaration#Left static replace AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RegEx...
static replace(str: string, pattern: RegExp | string, replaceValue: string = ''): string { return str.replace(pattern, replaceValue); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L131-L133
50f9fec1bb405195fe6a32743610f445f57f43d2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/keyAgree/X25519.ets
arkts
@Author csx @DateTime 2024/3/20 21:29 @TODO X25519 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class X25519 { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns 256位共享密钥字符串 */ static async x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<string> { retu...
AST#export_declaration#Left export AST#class_declaration#Left class X25519 AST#class_body#Left { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns 256位共享密钥字符串 */ AST#method_declaration#Left static...
export class X25519 { static async x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<string> { return DynamicUtil.dynamicKey(pubKey, priKey, 'X25519', 256); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/X25519.ets#L26-L36
4fd576361daf08c968b963cb2d06fe944e6352fe
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatController.ets
arkts
submitUserInput
提交用户输入内容函数 @param userIputText
public submitUserInput(userIputText: string) { if (this.chatCtrl) { this.chatCtrl.submitUserInput(userIputText); } }
AST#method_declaration#Left public submitUserInput AST#parameter_list#Left ( AST#parameter#Left userIputText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left A...
public submitUserInput(userIputText: string) { if (this.chatCtrl) { this.chatCtrl.submitUserInput(userIputText); } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatController.ets#L22-L26
0ed8080a9cb9a992fee401ef3203485bd4b45b45
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
reCustomScan
重新触发一次扫码(仅能使用在customScan.start的异步回调中) @returns {void}
reCustomScan(): void { try { customScan.rescan(); } catch (error) { logger.error('reCustomScan failed error: ' + JSON.stringify(error)); } }
AST#method_declaration#Left reCustomScan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#...
reCustomScan(): void { try { customScan.rescan(); } catch (error) { logger.error('reCustomScan failed error: ' + JSON.stringify(error)); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L329-L335
86411c0b831e9f25e71809061422e155233b0126
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
makeNode
The method that must be overridden is used to build the number of nodes and return the nodes to be mounted in the corresponding NodeContainer. //Called when the corresponding NodeContainer is created, or refreshed by calling the rebuild method.
makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undefined : ' + (uiContext === undefined)); try { if (this.rootNode != null) { const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode; if (parent) { console.info(JSON.stringif...
AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Fram...
makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undefined : ' + (uiContext === undefined)); try { if (this.rootNode != null) { const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode; if (parent) { console.info(JSON.stringif...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L41-L61
e933b4047a0bda4f90ebab414ac7e1d1583cc680
gitee
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/commonViews/exit.ets
arkts
exit
跳转按钮 点击右侧箭头返回登录页面
@Entry @Component export struct exit{ @Prop indexPage:string="pages/Index" build() { Column(){ Row({space:0}) { Row() { Image($r('app.media.left_arrow')) .width(36) .height(36) .margin({ left: 12 }) .onClick(() => { router.ba...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct exit AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right indexPage : AST#type_annotation#Left AST#primary_type#Left stri...
@Entry @Component export struct exit{ @Prop indexPage:string="pages/Index" build() { Column(){ Row({space:0}) { Row() { Image($r('app.media.left_arrow')) .width(36) .height(36) .margin({ left: 12 }) .onClick(() => { router.ba...
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/commonViews/exit.ets#L5-L50
76fecf40a5a9b6f33060ede2373d5e48e8a26c8f
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/http/AxiosHttp.ets
arkts
定义接口响应包装类
export interface BaseResponse { //wanAndroid-API响应体 errorCode: number errorMsg: string //拓展xxx-API响应体 }
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseResponse AST#object_type#Left { //wanAndroid-API响应体 AST#type_member#Left errorCode : 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 errorMsg ...
export interface BaseResponse { errorCode: number errorMsg: string }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/AxiosHttp.ets#L15-L20
2a55bfd552ea6edb894849102a966977b2efe312
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/utils/TongYiHttpUtils.ets
arkts
request
消息请求函数 @param msg @param callback
request(msg: string,callback: Function) { //创建请求 let httpRequest = http.createHttp(); //发起请求 httpRequest.request( //请求地址url "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation", //请求可选设置options { //请求方式 method: http.RequestMethod.POST,...
AST#method_declaration#Left request AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right...
request(msg: string,callback: Function) { let httpRequest = http.createHttp(); httpRequest.request( "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation", { method: http.RequestMethod.POST, header: { "Con...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/utils/TongYiHttpUtils.ets#L22-L70
ff904575c5476ad042e6e916a811bdcaf758fae0
gitee
charon2pluto/MoodDiary-HarmonyOS.git
0ec7ee6861e150bc9b4571062dbf302d1b106b8c
entry/src/main/ets/pages/MoodDetail.ets
arkts
getScoreColor
获取分数颜色
getScoreColor(score: number): string { if (score >= 8) return '#FF9800'; // 橙 if (score >= 5) return '#2196F3'; // 蓝 return '#9E9E9E'; // 灰 }
AST#method_declaration#Left getScoreColor AST#parameter_list#Left ( AST#parameter#Left score : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
getScoreColor(score: number): string { if (score >= 8) return '#FF9800'; if (score >= 5) return '#2196F3'; return '#9E9E9E'; }
https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/MoodDetail.ets#L36-L40
594135f5b30b1e8dfd438678a78d433dcb4752d8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
generateSM2Key
生成SM2的非对称密钥 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns SM2密钥{publicKey:公钥,privateKey:私钥}
static generateSM2Key(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('SM2_256', resultCoding); }
AST#method_declaration#Left static generateSM2Key AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres...
static generateSM2Key(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('SM2_256', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L34-L36
aefebc80a3b7fb010ccfbf092223e24e088c6d6d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/model/DescribeBean.ets
arkts
url地址
constructor(name: string, desc: string, type: number = 0) { this.name = name; this.desc = desc; this.type = type; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
constructor(name: string, desc: string, type: number = 0) { this.name = name; this.desc = desc; this.type = type; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/DescribeBean.ets#L10-L14
9472866437ed472bb5e77790ee16b72bf00c16fb
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/entity/Auth.ets
arkts
shouldRefresh
检查令牌是否需要刷新(过期前15分钟) @returns {boolean} 是否需要刷新
shouldRefresh(): boolean { const currentTime: number = Date.now(); const refreshTime: number = this.createdAt + this.expire * 1000 - 15 * 60 * 1000; return currentTime >= refreshTime && !this.isRefreshTokenExpired(); }
AST#method_declaration#Left shouldRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentT...
shouldRefresh(): boolean { const currentTime: number = Date.now(); const refreshTime: number = this.createdAt + this.expire * 1000 - 15 * 60 * 1000; return currentTime >= refreshTime && !this.isRefreshTokenExpired(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Auth.ets#L76-L80
a2d7aad78e3e470c727e3b2d8dd9cbb27b410c13
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets
arkts
removeDuplicate
列表对象去重 @param arr 列表
private removeDuplicate(arr: InputDeviceInfo[]): InputDeviceInfo[] { const newArr: InputDeviceInfo[] = []; for (const item of arr) { // 检查缓存中是否已经存在 if (newArr.find((cur: InputDeviceInfo) => cur.id === item.id && cur.name === item.name && cur.connect === item.connect) ) { ...
AST#method_declaration#Left private removeDuplicate AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left InputDeviceInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an...
private removeDuplicate(arr: InputDeviceInfo[]): InputDeviceInfo[] { const newArr: InputDeviceInfo[] = []; for (const item of arr) { if (newArr.find((cur: InputDeviceInfo) => cur.id === item.id && cur.name === item.name && cur.connect === item.connect) ) { c...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets#L194-L211
c65e12f5804f4f8f36d77d3a900bd402d543e86c
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/interface_class/simple_class/simple_class_006_F.ets
arkts
Introduction 函数内部类
export function simple_class_006_F(taint_src : string) { class A { data: string; clean: string; constructor() { this.data = taint_src; this.clean = "_"; }
AST#export_declaration#Left export AST#function_declaration#Left function simple_class_006_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function simple_class_006_F(taint_src : string) { class A { data: string; clean: string; constructor() { this.data = taint_src; this.clean = "_"; }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/simple_class/simple_class_006_F.ets#L6-L13
f78a53decc853d0864aba9d482cfef3003e8bf51
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getPhoneText
获取手机号展示文本 @returns {ResourceStr} 手机号文本
getPhoneText(): ResourceStr { const phone: string = this.getUserInfo().phone ?? ""; return phone ? phone : $r("app.string.not_bound"); } /** * 获取账号展示文本 * @returns {ResourceStr} 账号文本 */ getAccountText(): ResourceStr { const id: number | null = this.getUserInfo().id ?? null; return id ? `$...
AST#method_declaration#Left getPhoneText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phone...
getPhoneText(): ResourceStr { const phone: string = this.getUserInfo().phone ?? ""; return phone ? phone : $r("app.string.not_bound"); } getAccountText(): ResourceStr { const id: number | null = this.getUserInfo().id ?? null; return id ? `${id}` : $r("app.string.not_set"); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L100-L112
a77650d27a39d1527d090dd339e2b60b32b5da7b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets
arkts
onWindowStageDestroy
[End soft_keyboard_entryability]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L47-L50
d8b28178fa47e80c1ef62ea03f3c7bed2516475d
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/CharUtils.ets
arkts
isAscii
检查字符是否位于ASCII范围内(0~127) @param ch 被检查的字符 @returns `true`表示为ASCII字符,否则为`false`
static isAscii(ch: string): boolean { // 确保输入的是单个字符 if (ch.length !== 1) throw new Error("Input must be a single character"); return ch.charCodeAt(0) < 128; }
AST#method_declaration#Left static isAscii AST#parameter_list#Left ( AST#parameter#Left ch : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
static isAscii(ch: string): boolean { if (ch.length !== 1) throw new Error("Input must be a single character"); return ch.charCodeAt(0) < 128; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/CharUtils.ets#L26-L30
70e5e6102c52ce9e85edf91dc0d837c0eafd8b93
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets
arkts
unregisterDataChangeListener
为对应的LazyForEach组件在数据源处去除listener监听。 @param {DataChangeListener} listener - 监听对象。
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { console.info('remove listener'); this.listeners.splice(pos, 1); } }
AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { console.info('remove listener'); this.listeners.splice(pos, 1); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L64-L70
605c48423c90ddfd910df58f86e9c581af858a76
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/DialogHelper.ets
arkts
logInfo
info级别日志打印 @param message 日志内容
function logInfo(message: string): void { LogUtils.info('DialogHelper', message); }
AST#function_declaration#Left function logInfo AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
function logInfo(message: string): void { LogUtils.info('DialogHelper', message); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L203-L205
ddc3ee38840deb4b32eaeae1632f7b2bc1e77500
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isSetIterator
Check whether the entered value is the iterator type of set. @param { Object } value - A Set iterator value @returns { boolean } Returns true if the value is an iterator returned for a built-in Set instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isSetIterator(value: Object): boolean;
AST#method_declaration#Left isSetIterator AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
isSetIterator(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1334-L1334
58b496f9b0fa584239b10a2d5f236f86f0e8a05b
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showDebug
print debug level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showDebug(tag: string, log: string) { console.debug(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static showDebug(tag: string, log: string) { console.debug(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets#L38-L40
2a0bc984213bac4dcc7d69262edb38727407e723
gitee
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/model/WeatherData.ets
arkts
天气数据接口
export interface WeatherNow { temp: string; // 温度 text: string; // 天气描述 humidity: string; // 湿度 windDir: string; // 风向 windScale: string; // 风力等级 icon: string; // 天气图标代码 }
AST#export_declaration#Left export AST#interface_declaration#Left interface WeatherNow AST#object_type#Left { AST#type_member#Left temp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 温度 AST#type_member#Left text : AST#type_annotation#L...
export interface WeatherNow { temp: string; text: string; humidity: string; windDir: string; windScale: string; icon: string; }
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/model/WeatherData.ets#L2-L9
b1b2b0df3d05281ceb8efdabffaab22d0ab7da42
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets
arkts
touchInLeftThumb
是否触摸在左边的条状物 @param event @returns
touchInLeftThumb(event?: GestureEvent): boolean { let pointX:number = this.clearUndefined(event?.fingerList[0].localX); let pointY:number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
AST#method_declaration#Left touchInLeftThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent 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#pri...
touchInLeftThumb(event?: GestureEvent): boolean { let pointX:number = this.clearUndefined(event?.fingerList[0].localX); let pointY:number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L353-L358
2b4818e0b4c4bd580a54fc265b859eb73ec6bb65
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/entity/UserEntity.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class User { public token: String; public expiresIn: String; //过期时间 public refreshToken: String; //刷新token public expiresAt: String; //时间 public tokenType: String; //token类型 constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) { this.toke...
AST#export_declaration#Left export AST#class_declaration#Left class User AST#class_body#Left { AST#property_declaration#Left public token : AST#type_annotation#Left AST#primary_type#Left String AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public expires...
export class User { public token: String; public expiresIn: String; public refreshToken: String; public expiresAt: String; public tokenType: String; constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) { this.token = token; this.expiresI...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/entity/UserEntity.ets#L16-L30
6cb9db6c0c8922226ef8759fc779a1e22be1aae5
gitee
cljhwt/Gemini3_to_ArkTS.git
11507c45be72ecccef2f757eaf024c2b8617ad34
ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets
arkts
alphaTypeToString
Alpha 类型转换为字符串
function alphaTypeToString(alpha: number): string { // 不同API版本枚举名可能为 AlphaType 或 PixelMapAlphaType,按你的SDK调整 switch (alpha) { case 0: return 'ALPHA_TYPE_UNKNOWN'; case 1: return 'ALPHA_TYPE_OPAQUE'; case 2: return 'ALPHA_TYPE_PREMUL'; case 3: return 'ALPHA_TYPE_UNPREMUL'; ...
AST#function_declaration#Left function alphaTypeToString AST#parameter_list#Left ( AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
function alphaTypeToString(alpha: number): string { switch (alpha) { case 0: return 'ALPHA_TYPE_UNKNOWN'; case 1: return 'ALPHA_TYPE_OPAQUE'; case 2: return 'ALPHA_TYPE_PREMUL'; case 3: return 'ALPHA_TYPE_UNPREMUL'; default: return `ALPHA_TYPE_UNKNOWN(${alpha})`; ...
https://github.com/cljhwt/Gemini3_to_ArkTS.git/blob/11507c45be72ecccef2f757eaf024c2b8617ad34/ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets#L69-L82
291e0ecd5971c290cb7ff18d2fdfa9d36ce2e252
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/ListSlideToHistory.ets
arkts
ListSlideToHistoryComponent
公共常亮存放LazyForEach数据实体 功能描述: 在长列表场景时,当用户在浏览过程中打断时,列表会从第一项开始重新加载,此时我们使用scrollToIndex跳转到某个列表项时,当开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题,影响用户体验。因此我们使用currentOffset方法获取并记录偏移量,然后使用scrollTo方法跳转到上次浏览记录功能,可以流畅滑动到上次列表的位置。 推荐场景: 长列表滑动到指定列表项动效 核心组件: 1. ListSlideToHistory 实现步骤: 1.使用LazyForEach+cacheCount+@Reusable实现懒...
@Component export struct ListSlideToHistoryComponent { @State cachedCountNumber: number = 3; // 懒加载缓存数 @State firstIndex: number = 0; // 当前显示在屏幕上的子组件索引值,用来控制下方按钮跳转 listScroller: ListScroller = new ListScroller(); // scroller控制器 historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset readonly DEFAULT_OFFSET: numbe...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListSlideToHistoryComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right cachedCountNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
@Component export struct ListSlideToHistoryComponent { @State cachedCountNumber: number = 3; @State firstIndex: number = 0; listScroller: ListScroller = new ListScroller(); historyOffset: number = 0; readonly DEFAULT_OFFSET: number = 1000; readonly ANIMATION_DURATION: number = 500; readonly SWITCH_B...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/ListSlideToHistory.ets#L67-L175
6a59d57b8c0ae6b3da9fec24a6d1e00fe1dd78b8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
fsyncSync
同步文件数据,以同步方法。 @param fd number 已打开的文件描述符。
static fsyncSync(fd: number) { fs.fsyncSync(fd); }
AST#method_declaration#Left static fsyncSync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressi...
static fsyncSync(fd: number) { fs.fsyncSync(fd); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L744-L746
2b298149bb213b969edc772be7c31ce52f073178
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets
arkts
initialize
初始化分析服务
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, 'analytics_prefs'); // 加载存储的数据 await this.loadStoredData(); // 初始化预定义的用户细分 this.initializeDefaultSegments(); /...
AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, 'analytics_prefs'); await this.loadStoredData(); this.initializeDefaultSegments(); this.initializePre...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L309-L329
3e5a55dde1875d0effc09576e51d5963aa6efa0b
github
2763981847/Accounting-app.git
cf8302a42588ecce1561b82e8533798157157257
entry/src/main/ets/viewmodel/PanelColors.ets
arkts
面板颜色数组 此数组包含用于显示数据面板的预定义颜色。
export const panelColors: Array<string> = [ 'rgb(248,178,9)', 'rgb(243,70,14)', 'rgb(232,87,150)', 'rgb(161,53,246)', 'rgb(79,76,247)', 'rgb(5,126,254)', 'rgb(81,181,227)', 'rgb(108,209,76)', 'rgb(143,143,143)' ]
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left panelColors : 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 string AST#primary_type#Right AST#type_annotation#Right > ...
export const panelColors: Array<string> = [ 'rgb(248,178,9)', 'rgb(243,70,14)', 'rgb(232,87,150)', 'rgb(161,53,246)', 'rgb(79,76,247)', 'rgb(5,126,254)', 'rgb(81,181,227)', 'rgb(108,209,76)', 'rgb(143,143,143)' ]
https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/viewmodel/PanelColors.ets#L6-L16
dd347de18824bff4779370461e5ea3ee1737f5fb
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/ArtistDetailModel.ets
arkts
@param artistId @returns
export function fetchArtistData(artistId: number): Promise<ArtistDetailData> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artists', { queryParams }); if (result['code'] === 200) { let artist = new ArtistDe...
AST#export_declaration#Left export AST#function_declaration#Left function fetchArtistData AST#parameter_list#Left ( AST#parameter#Left artistId : 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#Le...
export function fetchArtistData(artistId: number): Promise<ArtistDetailData> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artists', { queryParams }); if (result['code'] === 200) { let artist = new ArtistDe...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/ArtistDetailModel.ets#L84-L106
2ad6ef04f36ddae91c567765ea4241608171d110
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
get
读取键值,若不存在返回默认值 @param {string} key 键 @param {preferences.ValueType} defaultValue 默认值 @returns {Promise<preferences.ValueType>} 读取到的值
async get(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.get(key, defaultValue); } catch (error) { throw this.wrapError(error, `读取键 ${key} 失败`); } }
AST#method_declaration#Left async get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left p...
async get(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.get(key, defaultValue); } catch (error) { throw this.wrapError(error, `读取键 ${key} 失败`); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L61-L68
517826ad7c29b67309252f65dd5b30f0ea9a8414
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
arkts
lessThan
判断是否小于另一个DayOf对象 @param other - 另一个DayOf对象
lessThan(other: DayOf): boolean { return this.compareTo(other) < 0; }
AST#method_declaration#Left lessThan AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right A...
lessThan(other: DayOf): boolean { return this.compareTo(other) < 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L114-L116
5365724832b9e7626b1717e7218b3da46447f266
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
getData
从数据源获取指定索引值的数据项 @param index 数据源索引值 @return 对应索引值的数据项
public getData(index: number): string { return this.regionArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
public getData(index: number): string { return this.regionArray[index]; }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets#L210-L212
309608688771901789e70ece937a9c89276c05d3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets
arkts
[Start function_add_har1]
export function addHar1(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am har1, %d + %d = %d', a, b, c); let harName = 'har2'; import(harName).then((ns: ESObject) => { console.info('DynamicImport addHar2 4 + 5 = ' + ns.addHar2(4, 5)); }); return c; }
AST#export_declaration#Left export AST#function_declaration#Left function addHar1 AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type...
export function addHar1(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am har1, %d + %d = %d', a, b, c); let harName = 'har2'; import(harName).then((ns: ESObject) => { console.info('DynamicImport addHar2 4 + 5 = ' + ns.addHar2(4, 5)); }); return c; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/src/main/ets/utils/Calc.ets#L17-L26
1ec6ce334bbf4c82b2557b538754a73a23e263fd
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
getFriendList
获取好友列表
static getFriendList(myId: string): Promise<ResponseDao<FriendItem[]>> { // 获取当前token const token = NetworkUtil.getAuthToken(); // 确保token存在 if (!token) { console.error("未找到认证token,请先登录"); return Promise.reject("未找到认证token,请先登录"); } const params: FriendListParams = { myId }; r...
AST#method_declaration#Left static getFriendList AST#parameter_list#Left ( AST#parameter#Left myId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
static getFriendList(myId: string): Promise<ResponseDao<FriendItem[]>> { const token = NetworkUtil.getAuthToken(); if (!token) { console.error("未找到认证token,请先登录"); return Promise.reject("未找到认证token,请先登录"); } const params: FriendListParams = { myId }; return new Promise((resol...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L408-L453
de8e6501da72b4c5fd1f47f26ec86f0225ff04e5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/DataSet.ets
arkts
setEntries
Sets the array of entries that this DataSet represents, and calls notifyDataSetChanged() @return
public setEntries(entries: JArrayList<T>): void { this.mEntries = entries; this.notifyDataSetChanged(); }
AST#method_declaration#Left public setEntries AST#parameter_list#Left ( AST#parameter#Left entries : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
public setEntries(entries: JArrayList<T>): void { this.mEntries = entries; this.notifyDataSetChanged(); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L168-L171
f2369aaa4b37f93aaaf27e05773e027f43c23d93
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/CustomScan/customscan/Index.ets
arkts
CustomScanPage
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 { CustomScanPage } from './src/main/ets/pages/CustomScanPage';
AST#export_declaration#Left export { CustomScanPage } from './src/main/ets/pages/CustomScanPage' ; AST#export_declaration#Right
export { CustomScanPage } from './src/main/ets/pages/CustomScanPage';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/CustomScan/customscan/Index.ets#L16-L16
118370398bcae6dc2fbf8df76873f5dd821deb44
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/feedback/src/main/ets/navigation/FeedbackSubmitNav.ets
arkts
FeedbackSubmitNav
@file 提交反馈页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function FeedbackSubmitNav(): void { FeedbackSubmitPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function FeedbackSubmitNav 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_cus...
@Builder export function FeedbackSubmitNav(): void { FeedbackSubmitPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/navigation/FeedbackSubmitNav.ets#L8-L11
0d65afcf68d803b1731e8c392e04536f1526899b
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/model/ImageKnifeOption.ets
arkts
请求回调
export interface OnLoadCallBack { // 请求开始 onLoadStart?: (request?: ImageKnifeRequest) => void; // 请求成功 onLoadSuccess?: (data: string | PixelMap | undefined, imageKnifeData: ImageKnifeData, request?: ImageKnifeRequest) => void; // 请求结束 onLoadFailed?: (err: string, request?: ImageKnifeRequest) => void; //...
AST#export_declaration#Left export AST#interface_declaration#Left interface OnLoadCallBack AST#object_type#Left { // 请求开始 AST#type_member#Left onLoadStart ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left request ? : AST#type_annotation#Left AST#primary_type#Left ImageKnif...
export interface OnLoadCallBack { onLoadStart?: (request?: ImageKnifeRequest) => void; onLoadSuccess?: (data: string | PixelMap | undefined, imageKnifeData: ImageKnifeData, request?: ImageKnifeRequest) => void; onLoadFailed?: (err: string, request?: ImageKnifeRequest) => void; onLoadCancel?: (reas...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeOption.ets#L94-L105
b88d81cd18b1da2cbd347625f57854c8194c9aa5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
getRawFileAnimationData
从 rawfile 资源文件夹中获取 json 动画对象 @param path 资源文件路径
getRawFileAnimationData(path: string): Object { const context: Context = ContextUtil.getUIAbilityCtx(); const data: Uint8Array = context.resourceManager.getRawFileContentSync(path) const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }) return JSON.parse(decoder.decodeToString(data)) }
AST#method_declaration#Left getRawFileAnimationData AST#parameter_list#Left ( AST#parameter#Left path : 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 Object AST#primar...
getRawFileAnimationData(path: string): Object { const context: Context = ContextUtil.getUIAbilityCtx(); const data: Uint8Array = context.resourceManager.getRawFileContentSync(path) const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }) return JSON.parse(decoder.decodeToString(data)) }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L36-L41
533f699002b7a0c8a34ae32e2df9d56fc79a5311
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
removeFromCart
从购物车移除
async removeFromCart(productId: string): Promise<void> { this.cartItems = this.cartItems.filter(item => item.productId !== productId); await this.saveCart(); }
AST#method_declaration#Left async removeFromCart AST#parameter_list#Left ( AST#parameter#Left productId : 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_typ...
async removeFromCart(productId: string): Promise<void> { this.cartItems = this.cartItems.filter(item => item.productId !== productId); await this.saveCart(); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L92-L95
a35e0fd64dd22596dd5da31051b0e505beeabe12
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyProving/DevelopmentGuidelines/AnonymousKeyProof/entry/src/main/ets/pages/AnonymousKeyProof.ets
arkts
anonAttestKeyItem
4.证明密钥
function anonAttestKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<huks.HuksReturnResult>((resolve, reject) => { try { huks.anonAttestKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { ...
AST#function_declaration#Left function anonAttestKeyItem AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left AS...
function anonAttestKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<huks.HuksReturnResult>((resolve, reject) => { try { huks.anonAttestKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyProving/DevelopmentGuidelines/AnonymousKeyProof/entry/src/main/ets/pages/AnonymousKeyProof.ets#L139-L154
abc3f400fa7632be8bdea69b3810086b4ce1306c
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/pages/RegisterPage.ets
arkts
httpRequest
释放HTTP客户端资源
httpRequest.destroy();
AST#method_declaration#Left httpRequest AST#ERROR#Left . destroy AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
httpRequest.destroy();
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/RegisterPage.ets#L192-L192
9e1be007e1100fb398c4495a3a8c4ac8752cfdae
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PickerOptions Object @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class PickerOptions extends photoAccessHelper.BaseSelectOptions { /** * Support set checkBox color * * @type { ?string } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ checkBoxColor?: string; /** * Support set backgroundColo...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class PickerOptions extends AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . BaseSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#clas...
export declare class PickerOptions extends photoAccessHelper.BaseSelectOptions { checkBoxColor?: string; backgroundColor?: string; gridMargin?: Margin; photoBrowserMargin?: Margin; gridStartOffset?: number; gridEndOffset?: number; isRepeatSelectSupported?: boolean; checkbo...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L335-L548
8ca2726474d9c6acb9c45e7c3fb84d88aa933272
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
modifyNode
Modify the node name. Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Modify the node name. Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node. @syscap Sy...
modifyNode(): void;
AST#method_declaration#Left modifyNode 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#method_declaration#Right
modifyNode(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L528-L528
8c8936e1cefccbf463e4061430bb468215f6c523
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets
arkts
headerRefresh
[EndExclude quick_start] 1、Refresh Loading Animation Component.
@Builder headerRefresh(): void { Column() { LoadingProgress() .color(Color.Black) .opacity(0.6) .width(36) .height(36) } .justifyContent(FlexAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right headerRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element...
@Builder headerRefresh(): void { Column() { LoadingProgress() .color(Color.Black) .opacity(0.6) .width(36) .height(36) } .justifyContent(FlexAlign.Center) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets#L130-L140
4a6d80e19f2d30af2552f239264ae597dc0e0ed1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
getArray
获取数组值(从JSON字符串解析) @param key 键 @param defaultValue 默认值 @returns 数组值
async getArray<T>(key: string, defaultValue: T[] = []): Promise<T[]> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T[]; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Failed t...
AST#method_declaration#Left async getArray 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#Rig...
async getArray<T>(key: string, defaultValue: T[] = []): Promise<T[]> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T[]; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Failed t...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L183-L194
7df66a09d8ad104519390bceb2f6d3c7419359d7
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
redirect
@deprecated @see {ZRouter.getInstance().redirect} @param name
public static redirect(name: string) { ZRouter.getRouterMgr().redirect<ObjectOrNull>(name) }
AST#method_declaration#Left public static redirect AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#...
public static redirect(name: string) { ZRouter.getRouterMgr().redirect<ObjectOrNull>(name) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L427-L429
0986fd50b042b5488dc2b2a91fafd204cc60d68f
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets
arkts
sign
对数据进行签名,异步 @param dataBlob 待签名数据 @param priKey 私钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。 @returns
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> { let signer = cryptoFramework.createSign(algName); await signer.init(priKey); let signData = await signer.sign(dataBlob); return signData; }
AST#method_declaration#Left static async sign 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#parameter#Left priKe...
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> { let signer = cryptoFramework.createSign(algName); await signer.init(priKey); let signData = await signer.sign(dataBlob); return signData; }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L290-L295
ff77b7888ee30e133fed7963a7869ca60bc9e092
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/WindowSafeAreaState.ets
arkts
获取全局窗口安全区状态实例;若不存在则创建 @returns {WindowSafeAreaState} 全局窗口安全区状态 @example const state = getWindowSafeAreaState();
export function getWindowSafeAreaState(): WindowSafeAreaState { return AppStorageV2.connect<WindowSafeAreaState>( WindowSafeAreaState, WINDOW_SAFE_AREA_STATE_KEY, () => new WindowSafeAreaState() )!; }
AST#export_declaration#Left export AST#function_declaration#Left function getWindowSafeAreaState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WindowSafeAreaState AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re...
export function getWindowSafeAreaState(): WindowSafeAreaState { return AppStorageV2.connect<WindowSafeAreaState>( WindowSafeAreaState, WINDOW_SAFE_AREA_STATE_KEY, () => new WindowSafeAreaState() )!; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/WindowSafeAreaState.ets#L75-L81
e03df3ed2d3f678e5a940a3ef12d6aaacfe74f50
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/GoodsData.ets
arkts
GoodsData is used to initialize the GoodsComponent.
export default class GoodsData { goodsName: Resource = $r('app.string.goods_list_item_1'); price: string = ''; originalPrice: string = ''; discounts: Resource = $r('app.string.goods_list_item_1_save'); label: Resource = $r('app.string.goods_list_activity_new'); goodsImg: Resource = $rawfile('index/good1.png...
AST#export_declaration#Left export default AST#class_declaration#Left class GoodsData AST#class_body#Left { AST#property_declaration#Left goodsName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expre...
export default class GoodsData { goodsName: Resource = $r('app.string.goods_list_item_1'); price: string = ''; originalPrice: string = ''; discounts: Resource = $r('app.string.goods_list_item_1_save'); label: Resource = $r('app.string.goods_list_activity_new'); goodsImg: Resource = $rawfile('index/good1.png...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/GoodsData.ets#L19-L27
3793ca27c5295fc751668365553cc8e80f503e9e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
取消当前应用所有已发布的通知 @returns {Promise<void>} void
export async function cancelAll(): Promise<void> { return notificationManager.cancelAll(); }
AST#export_declaration#Left export AST#function_declaration#Left async function cancelAll 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#Rig...
export async function cancelAll(): Promise<void> { return notificationManager.cancelAll(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L324-L326
1668424c96420d68dca7dfbdda24acde31fd48b3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets
arkts
redraw
Redraw the track.
redraw(): void { this.canvasContext.clearRect(0, 0, this.canvasContext.width, this.canvasContext.height); this.positionList.forEach((position) => { Logger.info('Index', `redraw position=${JSON.stringify(position)}`); if (position.isFirstPosition) { this.canvasContext.beginPath(); thi...
AST#method_declaration#Left redraw AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A...
redraw(): void { this.canvasContext.clearRect(0, 0, this.canvasContext.width, this.canvasContext.height); this.positionList.forEach((position) => { Logger.info('Index', `redraw position=${JSON.stringify(position)}`); if (position.isFirstPosition) { this.canvasContext.beginPath(); thi...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets#L141-L157
830ce1e0c1f603f405598bad84a828606747d588
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initializeNotifications
初始化通知系统
private async initializeNotifications(): Promise<void> { try { const notificationManager = SimpleNotificationManager.getInstance(); // 初始化通知权限 const permissionsGranted = await notificationManager.initializeNotifications(); if (permissionsGranted) { hilog.info(0x0000, 'EntryAbility',...
AST#method_declaration#Left private async initializeNotifications 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#R...
private async initializeNotifications(): Promise<void> { try { const notificationManager = SimpleNotificationManager.getInstance(); const permissionsGranted = await notificationManager.initializeNotifications(); if (permissionsGranted) { hilog.info(0x0000, 'EntryAbility', 'Notifica...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/entryability/EntryAbility.ets#L33-L51
e65498f0c90b290cadbc45f2c2f0d40f9c6bbe0b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderListPage.ets
arkts
构建订单列表页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.order_list"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderListContent() }); OrderGoodsModal({ ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.order_li...
build() { AppNavDestination({ title: $r("app.string.order_list"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderListContent() }); OrderGoodsModal({ ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderListPage.ets#L28-L56
680bde14d4a55766f0ce64ce09fadc148732bb98
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
点赞动态 @param id 动态ID
export function likePost(id: number): Promise<void> { try { console.info(`点赞动态, id: ${id}`); // 获取当前用户会话 const userSession = UserSession.getInstance(); // 确保用户已登录 if (!userSession.isLoggedIn()) { console.error('用户未登录,无法点赞'); return Promise.reject(new Error('用户未登录,请先登录')); ...
AST#export_declaration#Left export AST#function_declaration#Left function likePost AST#parameter_list#Left ( AST#parameter#Left id : 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#primar...
export function likePost(id: number): Promise<void> { try { console.info(`点赞动态, id: ${id}`); const userSession = UserSession.getInstance(); if (!userSession.isLoggedIn()) { console.error('用户未登录,无法点赞'); return Promise.reject(new Error('用户未登录,请先登录')); } cons...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L829-L859
5f1a51ee4d2c40dd2851fa65272292143633f551
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/CalendarPage.ets
arkts
buildUpcomingBirthdays
构建即将到来的生日列表
@Builder buildUpcomingBirthdays() { Column({ space: 12 }) { Row() { Text(this.selectedDate ? `${this.selectedDate} 生日` : '即将到来的生日') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .layoutWeight(1) if (!this.selectedDate) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUpcomingBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compon...
@Builder buildUpcomingBirthdays() { Column({ space: 12 }) { Row() { Text(this.selectedDate ? `${this.selectedDate} 生日` : '即将到来的生日') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .layoutWeight(1) if (!this.selectedDate) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L379-L409
03a582fa899c2f8d212a3f59facc9127792902b9
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Privacy/PrivacyManager.ets
arkts
get
单例模式实现
static get shared(): PrivacyManager { if (!PrivacyManager.instance) { PrivacyManager.instance = new PrivacyManager(); } return PrivacyManager.instance; }
AST#method_declaration#Left static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PrivacyManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement...
static get shared(): PrivacyManager { if (!PrivacyManager.instance) { PrivacyManager.instance = new PrivacyManager(); } return PrivacyManager.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Privacy/PrivacyManager.ets#L14-L19
d16e3b6c02904a468ad2fef9aaf11778b4a57aee
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
initTencentCos
MARK: - 初始化腾讯云COS
private initTencentCos(): void { //////////////////////////////////////////////////////////// ///Cos配置鸿蒙版: https://cloud.tencent.com/document/product/436/112125 //////////////////////////////////////////////////////////// // 服务配置 let cosXmlServiceConfig = new CosXmlServiceConfig(StringEncoder.remo...
AST#method_declaration#Left private initTencentCos AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //////////////////////////////////////////////////////////// ///Cos配置鸿蒙版: https://clou...
private initTencentCos(): void { let cosXmlServiceConfig = new CosXmlServiceConfig(StringEncoder.removedSalt(CosConfig.region)!!); CosXmlBaseService.initDefaultService( getAppContext(), cosXmlServiceConfig ) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L42-L57
9b219ce9e054ab9ed7ed26167a58ce070fb064c5
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/basic_expression_operation/binary_expression_add_assignment_001_T.ets
arkts
Introduction 基础表达式运算-二元运算-加等
export function binary_expression_add_assignment_001_T(taint_src : string) { let t = "_"; t += taint_src; taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function binary_expression_add_assignment_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 ...
export function binary_expression_add_assignment_001_T(taint_src : string) { let t = "_"; t += taint_src; taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/basic_expression_operation/binary_expression_add_assignment_001_T.ets#L6-L10
187897e43e52bd8debc2cae5a9306c7e1de9c338
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multimodaltransion/Index.ets
arkts
HalfModalWindowComponent
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 { HalfModalWindowComponent } from './src/main/ets/view/HalfModalWindow';
AST#export_declaration#Left export { HalfModalWindowComponent } from './src/main/ets/view/HalfModalWindow' ; AST#export_declaration#Right
export { HalfModalWindowComponent } from './src/main/ets/view/HalfModalWindow';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/Index.ets#L15-L15
f5c4110629a2226160fb05d8efc86495ff808d31
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets
arkts
getXPx
returns the x-position of the highlight in pixels
public getXPx(): number { return this.mXPx; }
AST#method_declaration#Left public getXPx 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 getXPx(): number { return this.mXPx; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L121-L123
71f27c2b40aab40f1eadf0ec8f97aa0980916fbd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
getNotificationSettings
获取通知设置 @returns 通知设置
async getNotificationSettings(): Promise<NotificationSettings> { const settings = await this.getSettings(); return settings.notification; }
AST#method_declaration#Left async getNotificationSettings 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 NotificationSettings AST#primary_type#Right AST#type_anno...
async getNotificationSettings(): Promise<NotificationSettings> { const settings = await this.getSettings(); return settings.notification; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L191-L194
d5b1e4b75715b144ddcb75260c7d1ca76cd8c08f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets
arkts
iconAndDescription
自定义构建函数,将重复使用的UI元素抽象成一个方法。此处样式为:上方图标下方文字
@Builder iconAndDescription(icon: Resource, description: string | Resource, iconSize?: Size, radius?: number, handleClick?: () => void) { Column() { Image(icon) .size(iconSize === undefined ? { height: $r('app.integer.slidetohideanddisplace_icon_default_height'), width: $r('a...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right iconAndDescription AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_ann...
@Builder iconAndDescription(icon: Resource, description: string | Resource, iconSize?: Size, radius?: number, handleClick?: () => void) { Column() { Image(icon) .size(iconSize === undefined ? { height: $r('app.integer.slidetohideanddisplace_icon_default_height'), width: $r('a...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets#L92-L111
e04faef013e0489e193e124ea40939178769c468
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
parseCsvContent
解析CSV内容
private parseCsvContent() { if (!this.csvContent.trim()) { this.csvParseResult = null; return; } this.csvParseResult = CsvParser.parseCsvContent(this.csvContent); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `CSV parsed: ${this.csvParseResult.validRows}/${this.csvParseRe...
AST#method_declaration#Left private parseCsvContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST...
private parseCsvContent() { if (!this.csvContent.trim()) { this.csvParseResult = null; return; } this.csvParseResult = CsvParser.parseCsvContent(this.csvContent); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `CSV parsed: ${this.csvParseResult.validRows}/${this.csvParseRe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L801-L810
f6299b6d41d6c00eb5a3f116b890bd3bc3e9a8b5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets
arkts
videoLinkSpanBuilder
带有图标的视频链接Span组件
@Builder videoLinkSpanBuilder(item: MyCustomSpan) { ContainerSpan() { ImageSpan(this.videoLinkIcon) .height($r('app.integer.styled_text_video_link_icon_height')) .verticalAlign(ImageSpanAlignment.CENTER) .onClick(() => { setTimeout(() => { this.clickSpanId = '';...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoLinkSpanBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left MyCustomSpan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
@Builder videoLinkSpanBuilder(item: MyCustomSpan) { ContainerSpan() { ImageSpan(this.videoLinkIcon) .height($r('app.integer.styled_text_video_link_icon_height')) .verticalAlign(ImageSpanAlignment.CENTER) .onClick(() => { setTimeout(() => { this.clickSpanId = '';...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets#L120-L152
ca4bb2aa11190aab96e32d44ebd246404e602160
gitee
TianQvQ/WeChat_ArkTs.git
077ddcdb8e8032f71f45540461fbd66f2d49c973
entry/src/main/ets/Toptag/StatusBarManager.ets
arkts
immerseColor
沉浸式状态栏颜色和状态栏icon 一般推荐这个方案,但这个目前仅是api先支持,部分系统还未跟进支持(目前大多数设备无效) 在Ability或Component中使用都可
static async immerseColor(color?: string, light?: boolean) { // 获取当前应用窗口 let windowClass: window.Window = await window.getLastWindow(getContext()) // 将状态栏和导航栏的背景色设置为跟应用窗口相同的颜色 await windowClass.setWindowSystemBarProperties({ navigationBarColor: color, statusBarColor: color, navigationB...
AST#method_declaration#Left static async immerseColor AST#parameter_list#Left ( AST#parameter#Left color ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left light ? : AST#type_annotation#Left AST#primary_type#Left boolean AS...
static async immerseColor(color?: string, light?: boolean) { let windowClass: window.Window = await window.getLastWindow(getContext()) await windowClass.setWindowSystemBarProperties({ navigationBarColor: color, statusBarColor: color, navigationBarContentColor: color, statusBarC...
https://github.com/TianQvQ/WeChat_ArkTs.git/blob/077ddcdb8e8032f71f45540461fbd66f2d49c973/entry/src/main/ets/Toptag/StatusBarManager.ets#L14-L26
6f7f7569a74cff2c95547ee43660091299e9b21d
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imagesToVideo
图片序列合成视频 @param inputPattern 输入图片路径模式,如 "/path/frame_%04d.jpg" @param output 输出视频路径 @param fps 视频帧率,默认 25
public static imagesToVideo(inputPattern: string, output: string, fps: number = 25): string[] { return [ 'ffmpeg', '-framerate', fps.toString(), '-i', inputPattern, '-c:v', FFmpegFactory.HW_CODEC, '-pix_fmt', 'yuv420p', '-y', output ]; }
AST#method_declaration#Left public static imagesToVideo AST#parameter_list#Left ( AST#parameter#Left inputPattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left stri...
public static imagesToVideo(inputPattern: string, output: string, fps: number = 25): string[] { return [ 'ffmpeg', '-framerate', fps.toString(), '-i', inputPattern, '-c:v', FFmpegFactory.HW_CODEC, '-pix_fmt', 'yuv420p', '-y', output ]; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L277-L286
cc8e354abf269c752fc4f639a7a66136261f14b8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor(count: number) { for (let i = 0; i < count; i++) { this.dataArray.push(i); } } // 获取索引对应的数据 public getData(index: number): number { return...
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#...
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor(count: number) { for (let i = 0; i < count; i++) { this.dataArray.push(i); } } public getData(index: number): number { return this.dataAr...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L17-L142
e1e18901461a461f5db2b9b1b085fabf66c0d621
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/init_process.ets
arkts
history
Inits history. @param t0 Start time of the whole initialization process.
function history(storage: LocalStorage) { AppStorage.setOrCreate('bunch_of_history', new bunch_of_history()); // Initialize statuses AppStorage.setOrCreate('reindexing_history', undefined); AppStorage.setOrCreate('history_index_loading', undefined); AppStorage.setOrCreate('history_index_saving', undefined); ...
AST#function_declaration#Left function history AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_s...
function history(storage: LocalStorage) { AppStorage.setOrCreate('bunch_of_history', new bunch_of_history()); AppStorage.setOrCreate('reindexing_history', undefined); AppStorage.setOrCreate('history_index_loading', undefined); AppStorage.setOrCreate('history_index_saving', undefined); AppStorage.setOrCrea...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L544-L557
aeb3e0cf7faad42569497ce54ec17446994139a5
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/PaletteComponent.ets
arkts
PaletteComponent
画板组件
@ComponentV2 export struct PaletteComponent { @Param @Require eventListener: PaletteEventListener; private currentScale: number = 1; private color: string = '#DB2904'; private brushSize: number = LINE_WIDTH; private canvasContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(new RenderingContextSet...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PaletteComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right eventListener : AST#type_annotation#Left AST#p...
@ComponentV2 export struct PaletteComponent { @Param @Require eventListener: PaletteEventListener; private currentScale: number = 1; private color: string = '#DB2904'; private brushSize: number = LINE_WIDTH; private canvasContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(new RenderingContextSet...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/PaletteComponent.ets#L45-L112
0801fbdebf59990c75364e8621aaad98033a276a
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/personal/MinePage.ets
arkts
fetchDreamStats
获取梦想统计数据
async fetchDreamStats(userId: number) { try { console.info(`开始获取梦想统计数据, userId: ${userId}`); // 使用ApiService中的方法获取梦想统计数据 const stats = await ApiService.getDreamStats(userId); if (stats) { this.dreamStats = stats; console.info(`成功获取梦想统计数据: ${JSON.stringify(stats)...
AST#method_declaration#Left async fetchDreamStats AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Le...
async fetchDreamStats(userId: number) { try { console.info(`开始获取梦想统计数据, userId: ${userId}`); const stats = await ApiService.getDreamStats(userId); if (stats) { this.dreamStats = stats; console.info(`成功获取梦想统计数据: ${JSON.stringify(stats)}`); } else { ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/MinePage.ets#L76-L109
e49144d2b028d5362d4d8b02c3ffb849d70c9c83
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
aboutToDisappear
页面生命周期 - 页面即将消失
aboutToDisappear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToDisappear'); }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_ex...
aboutToDisappear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToDisappear'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L78-L80
bfc6a7eab0c443f59714a052546533f03561db1c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/ReportsPage.ets
arkts
buildReportsList
构建报告列表
@Builder buildReportsList() { if (this.getFilteredReports().length === 0) { this.buildEmptyState(); return; } Scroll() { Column({ space: 8 }) { ForEach(this.getFilteredReports(), (report: AnalyticsReport) => { this.buildReportCard(report) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildReportsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left A...
@Builder buildReportsList() { if (this.getFilteredReports().length === 0) { this.buildEmptyState(); return; } Scroll() { Column({ space: 8 }) { ForEach(this.getFilteredReports(), (report: AnalyticsReport) => { this.buildReportCard(report) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/ReportsPage.ets#L276-L287
964f940d734276b6c2742c5ea305df172771c664
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
空查询参数对象
export const EmptyParams: QueryParams = {};
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EmptyParams : AST#type_annotation#Left AST#primary_type#Left QueryParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AS...
export const EmptyParams: QueryParams = {};
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L215-L215
a68b7f73d09b65ff3713ae997011fd3a6ae526e0
github
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/PreferenceModel.ets
arkts
ensurePreferenceInitialized
确保首选项已初始化
private async ensurePreferenceInitialized() { if (preference === null) { await this.getPreferencesFromStorage(); } }
AST#method_declaration#Left private async ensurePreferenceInitialized 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 preference AST#expression#Right === AST#ex...
private async ensurePreferenceInitialized() { if (preference === null) { await this.getPreferencesFromStorage(); } }
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L8-L12
8b3419122c7ae19e74f53e36c76bcfc743349876
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/TitleBar.ets
arkts
TitleBar
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct TitleBar { private title: Resource = $r('app.string.explore'); private image: Resource = $r('app.media.addfriend') build() { Column() { Row() { Stack() { Row() { Text(this.title) .fontFamily('HarmonyHeiTi-Bold') .fontSiz...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resou...
@Component export struct TitleBar { private title: Resource = $r('app.string.explore'); private image: Resource = $r('app.media.addfriend') build() { Column() { Row() { Stack() { Row() { Text(this.title) .fontFamily('HarmonyHeiTi-Bold') .fontSiz...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/TitleBar.ets#L16-L55
c8f89648bbd350f28bc4f1644354cf35f48f0334
gitee