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_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WebApplicationJump/entry/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 { /** * Original page router name. */ static readonly ORIGIN_PAGE: string = 'OriginPage'; /** * Full Screen Size. */ static readonly FULL_SCREEN: string = '100%'; /** * Web page router name. */ static readonly WEB_PAGE: string = 'WebPage'; /** * Original page...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /** * Original page router name. */ AST#property_declaration#Left static readonly ORIGIN_PAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export class Constants { static readonly ORIGIN_PAGE: string = 'OriginPage'; static readonly FULL_SCREEN: string = '100%'; static readonly WEB_PAGE: string = 'WebPage'; static readonly ORIGIN_PAGE_CHINESE: string = '原生页面'; static readonly WEB_PAGE_CHINESE: string = 'Web页面'; static read...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebApplicationJump/entry/src/main/ets/common/Constants.ets#L16-L54
b5a2e48918b8c003026ec100a7fada28038517eb
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
渲染布局 @returns {void} 无返回值 @example RowSpaceAroundTop() { Text("A"); Text("B"); Text("C"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L...
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1324-L1339
f12f8182ccb672f03385349bac740e5a5ed2f157
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
时间分布数据接口
export interface TimeDistributionItem { label: string; hours: number; color: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TimeDistributionItem AST#object_type#Left { AST#type_member#Left label : 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 hours : AST#type_annota...
export interface TimeDistributionItem { label: string; hours: number; color: string; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L9-L13
ddd70b5b7e0ffd30612db50a5ef7c5113579bd23
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets
arkts
submitToMemory
保存数据到内存中 @param key 键值 @param data 数据
submitToMemory(key: string, data: ResponseDataType) { this.cache.put(key, data); }
AST#method_declaration#Left submitToMemory 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 data : AST#type_annotation#Left AST#primary_type#Left ResponseDataType AST#primary...
submitToMemory(key: string, data: ResponseDataType) { this.cache.put(key, data); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets#L54-L56
4395c2915b542314b81356d7762b9c37dedd4006
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/StatsManager.ets
arkts
unlockAchievement
解锁成就
private unlockAchievement(achievementId: string): void { if (!this.stats.achievements.unlocked.includes(achievementId)) { this.stats.achievements.unlocked.push(achievementId); this.notifyListeners('achievementUnlocked', { achievementId }); } }
AST#method_declaration#Left private unlockAchievement AST#parameter_list#Left ( AST#parameter#Left achievementId : 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 A...
private unlockAchievement(achievementId: string): void { if (!this.stats.achievements.unlocked.includes(achievementId)) { this.stats.achievements.unlocked.push(achievementId); this.notifyListeners('achievementUnlocked', { achievementId }); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L282-L287
d9fc3a4125b83a7b3e0fd198d0a0b0aa48f15294
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
getProviderInfo
获取提供商信息
getProviderInfo(provider: LLMProvider): LLMInfo | null { return this.providers.get(provider) || null; }
AST#method_declaration#Left getProviderInfo AST#parameter_list#Left ( AST#parameter#Left provider : AST#type_annotation#Left AST#primary_type#Left LLMProvider 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#L...
getProviderInfo(provider: LLMProvider): LLMInfo | null { return this.providers.get(provider) || null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L275-L277
4e96a843af199412553c404841a86581db2860c6
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
Constructor.
constructor() { this.limitRect = new RectF(); this.imageRect = new RectF(); this.cropRect = new RectF(); this.ratio = new Ratio(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO); let screenWidth = Math.ceil(ScreenManager.getInstance().getWinWidth()); let screenHeight = Math.ceil(Scr...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . limitRect AST#member...
constructor() { this.limitRect = new RectF(); this.imageRect = new RectF(); this.cropRect = new RectF(); this.ratio = new Ratio(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO); let screenWidth = Math.ceil(ScreenManager.getInstance().getWinWidth()); let screenHeight = Math.ceil(Scr...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L53-L63
2ce0ce77ac91395f4c5432eea3b24384bd1dc6ae
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/model/OffsetModel.ets
arkts
OffsetModel
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Observed export class OffsetModel { // 当前移动偏移量 X public currentX: number; // 当前移动偏移量 Y public currentY: number; // 最后的偏移量 X public lastX: number = 0; // 最后的偏移量 Y public lastY: number = 0; constructor(currentX: number = 0, currentY: number = 0) { this.currentX = currentX; this.currentY = curr...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class OffsetModel AST#class_body#Left { // 当前移动偏移量 X AST#property_declaration#Left public currentX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declar...
@Observed export class OffsetModel { public currentX: number; public currentY: number; public lastX: number = 0; public lastY: number = 0; constructor(currentX: number = 0, currentY: number = 0) { this.currentX = currentX; this.currentY = currentY; } reset(): void { this.currentX...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/OffsetModel.ets#L16-L47
1943d3dc9d59ec4589e21d3e2df25800b2633b8d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
删除当前应用所有的通知渠道 @returns {Promise<void>} void
export async function removeAll(): Promise<void> { return notificationManager.removeAllSlots(); }
AST#export_declaration#Left export AST#function_declaration#Left async function removeAll 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 removeAll(): Promise<void> { return notificationManager.removeAllSlots(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L407-L409
739a3500b8449bae8ac7bb3643b3551c19e5b48c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/home/Home.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface Articles { icon: string | Resource title: string | Resource disc: string | Resource }
AST#export_declaration#Left export AST#interface_declaration#Left interface Articles AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_a...
export interface Articles { icon: string | Resource title: string | Resource disc: string | Resource }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/home/Home.ets#L16-L20
f1fb26637973f861cae7880850d5205dab1b67da
gitee
batiluoxuanwan/MomentFlow.git
e57aa461223abca74f48893afc2ccf7c2d73e9b8
frontend/entry/src/main/ets/api/UserApi.ets
arkts
register
注册
static async register(user: User, code: string): Promise<User | null> { return request<User>(`${BASE_URL}/register`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ username: user.username, email: user.email, pa...
AST#method_declaration#Left static async register AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static async register(user: User, code: string): Promise<User | null> { return request<User>(`${BASE_URL}/register`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ username: user.username, email: user.email, pa...
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/UserApi.ets#L60-L71
fa00befd53c0fbbd892199b4e1dad741551c2437
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/viewmodel/EntryViewModel.ets
arkts
@file 应用入口 ViewModel,负责沉浸式窗口、安全区与断点监听初始化 @author Joker.X
export default class EntryViewModel { /** * 窗口能力适配器 */ private readonly windowAdapter: WindowAdapter = new WindowAdapter( getWindowSafeAreaState(), getBreakpointState() ); /** * 入口页面初始化 * 由 EntryPage.aboutToAppear 调用,统一触发窗口相关初始化 * @param {Context} context - 组件上下文 * @returns {void} 无返回...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryViewModel AST#class_body#Left { /** * 窗口能力适配器 */ AST#property_declaration#Left private readonly windowAdapter : AST#type_annotation#Left AST#primary_type#Left WindowAdapter AST#primary_type#Right AST#type_annotation#Right = AST#expre...
export default class EntryViewModel { private readonly windowAdapter: WindowAdapter = new WindowAdapter( getWindowSafeAreaState(), getBreakpointState() ); aboutToAppear(context: common.Context): void { this.windowAdapter.init(context); } aboutToDisappear(): void { this.windowAdapter...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/viewmodel/EntryViewModel.ets#L10-L37
74a162fb46f8ecf01bf3c6d8a644c72eed885850
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
[EndExclude power_entry_ability]
onWindowStageCreate(windowStage: window.WindowStage): void { // [StartExclude power_entry_ability] // Main window is created, set main page for this ability hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { if (err.code) {...
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
onWindowStageCreate(windowStage: window.WindowStage): void { hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { if (err.code) { hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON....
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets#L23-L51
132a647525bcd4b7babe66749dc75cdd21c7e19b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ResourceUtils.ets
arkts
/获取string
export function getString(res: ResourceStr): string { return ResourceUtils.resourceToString(res) }
AST#export_declaration#Left export AST#function_declaration#Left function getString AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST...
export function getString(res: ResourceStr): string { return ResourceUtils.resourceToString(res) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ResourceUtils.ets#L74-L76
08c85ada0245b325d78956bdd509920f5dbb7872
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getMultiQuestionCount
获取单选题数量 @returns
public getMultiQuestionCount(): number { return this.examDetails.filter(item => item.questionType === QuestionTypeEnum.CHECK_BOX).length; }
AST#method_declaration#Left public getMultiQuestionCount 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#me...
public getMultiQuestionCount(): number { return this.examDetails.filter(item => item.questionType === QuestionTypeEnum.CHECK_BOX).length; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L260-L262
17badba3d3b5f6f7c3fae1768834974f87cba187
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/StatsManager.ets
arkts
updateDailyData
更新每日数据
private async updateDailyData(): Promise<void> { const today = DateUtils.getTodayKey(); // 如果今天还没有数据,创建新的日统计 if (!this.stats.dailyStats[today]) { this.stats.dailyStats[today] = { tasksCompleted: 0, tasksTotal: 0, focusTime: 0, pomodoroSessions: 0, achievements:...
AST#method_declaration#Left private async updateDailyData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > A...
private async updateDailyData(): Promise<void> { const today = DateUtils.getTodayKey(); if (!this.stats.dailyStats[today]) { this.stats.dailyStats[today] = { tasksCompleted: 0, tasksTotal: 0, focusTime: 0, pomodoroSessions: 0, achievements: [] }; } ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L118-L142
141c51e6a6f2b203a234a10fb0dde6d2654c6270
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/src/main/ets/utils/Constants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const TOAST_BOTTOM: number = 200;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TOAST_BOTTOM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaratio...
export const TOAST_BOTTOM: number = 200;
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/src/main/ets/utils/Constants.ets#L16-L16
8a7d82c06418480dce99eefe6cc1415b1057af87
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/picturepreviewsample/PicturePreviewSample.ets
arkts
PicturePreviewSample
图片预览使用案例 功能说明:本示例介绍使用List、LazyForEach、matrix4、组合手势实现图片预览功能 推荐场景:需要图片预览的场景 核心组件: 1. PicturePreview:实现图片预览的布局和循环设置多图预览 2. PicturePreviewImage : 具体某个图片预览 实现步骤: 1. 数据准备:首先构建一个需要预览的图片数组 @example @State imageList: string[] = [$r("app.media.picturepreview_image")]; 2. 数据准备:创建好主轴方向 @example @State listDirection: Axis = Axi...
@Component export struct PicturePreviewSample { @State imageList: string[] = []; @State listDirection: Axis = Axis.Horizontal; aboutToAppear(): void { let imageSource:string = $r("app.media.picturepreview_image") as ESObject; this.imageList.push( imageSource, imageSource, imageSource ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PicturePreviewSample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST...
@Component export struct PicturePreviewSample { @State imageList: string[] = []; @State listDirection: Axis = Axis.Horizontal; aboutToAppear(): void { let imageSource:string = $r("app.media.picturepreview_image") as ESObject; this.imageList.push( imageSource, imageSource, imageSource ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/picturepreviewsample/PicturePreviewSample.ets#L39-L56
4b50bf662a01f5c51b00d281c87753f9a6a047d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/PageRepository.ets
arkts
getHomeData
获取首页数据 @returns 首页数据
async getHomeData(): Promise<NetworkResponse<Home>> { return this.networkDataSource.getHomeData(); }
AST#method_declaration#Left async getHomeData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#t...
async getHomeData(): Promise<NetworkResponse<Home>> { return this.networkDataSource.getHomeData(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/PageRepository.ets#L26-L28
1db49a390c674e4aeaabda2ef58c382af8df3518
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/DateUtils.ets
arkts
timestampToDate
时间戳转日期
static timestampToDate(timestamp: number): Date { return new Date(timestamp); }
AST#method_declaration#Left static timestampToDate AST#parameter_list#Left ( AST#parameter#Left timestamp : 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 Date AST#prim...
static timestampToDate(timestamp: number): Date { return new Date(timestamp); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L60-L62
aa258b1f50aa1cb2cb797bbe080869116df9a01c
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SegmentButtonV2.d.ets
arkts
MultiCapsuleSegmentButtonV2
Defines the segmented button with capsule style. @struct CapsuleSegmentButtonV2 @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@ComponentV2 export declare struct MultiCapsuleSegmentButtonV2 { /** * Sets the items of the segmented button. * * @type { SegmentButtonV2Items } * @readonly * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Require @P...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct MultiCapsuleSegmentButtonV2 AST#component_body#Left { /** * Sets the items of the segmented button. * * @type { SegmentButtonV2Items } * @readonly * @...
@ComponentV2 export declare struct MultiCapsuleSegmentButtonV2 { @Require @Param readonly items: SegmentButtonV2Items; @Require @Param readonly selectedIndexes: number[]; @Event $selectedIndexes: OnSelectedIndexesChange; @Event onItemClicked?: Callback<numb...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L1239-L1616
f2bebb6ab1e299634337cc2294d2053eadcc0edc
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
debug
标识应用是否处于调试模式,取值为true表示应用处于调试模式,取值为false表示应用处于非调试模式。 @returns
static debug(): boolean { return AppUtil.getAppInfoSync().debug; }
AST#method_declaration#Left static debug 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#return_statement#Left return AST#expression#Left AST#member_expression...
static debug(): boolean { return AppUtil.getAppInfoSync().debug; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L560-L562
61c045e82564b63b7e8966117eed68b6b400579b
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/viewmodel/ShotCutCardData.ets
arkts
添加的快捷卡片
export const addCardTypeList: HomeCardItemEntity[] = [] // 管理机
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left addCardTypeList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HomeCardItemEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Le...
export const addCardTypeList: HomeCardItemEntity[] = []
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/ShotCutCardData.ets#L174-L176
13d4e2a2c55eb173ec8da709c54b3ddfff3fb3e0
github
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/components/MusicPlayerBar.ets
arkts
startAnimation
简单的模拟动画
private startAnimation() { this.timerId = setInterval(() => { this.barHeights = this.barHeights.map((_, index) => this.getBarHeight(index)); }, 120); // 稍微加快刷新率更流畅 }
AST#method_declaration#Left private startAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expressi...
private startAnimation() { this.timerId = setInterval(() => { this.barHeights = this.barHeights.map((_, index) => this.getBarHeight(index)); }, 120); }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/MusicPlayerBar.ets#L28-L32
fb8e6862e9e69399a3017415a1d4ecdf5ae7233d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets
arkts
createSessionBackup
[End get_local_cap_ability] 应用备份数据
function createSessionBackup(): backup.SessionBackup { let generalCallbacks: backup.GeneralCallbacks = { // onFileReady为服务回调给应用侧数据完成的通知,建议开发者在该接口内不要进行过多的耗时实现,可以通过异步线程实现file.fd数据的处理 onFileReady: (err: BusinessError, file: backup.File) => { if (err) { Logger.error('onFileReady err: ' + JSON.string...
AST#function_declaration#Left function createSessionBackup AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left backup . SessionBackup AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#stateme...
function createSessionBackup(): backup.SessionBackup { let generalCallbacks: backup.GeneralCallbacks = { onFileReady: (err: BusinessError, file: backup.File) => { if (err) { Logger.error('onFileReady err: ' + JSON.stringify(err)); } try { let bundlePath = filesDir + '/' + fi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets#L66-L121
e48e3f5a91f80405045c3119877885c075f767ce
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
用户首选项处理器,基于轻量级数据库的数据存储和管理工具。
export default class PreferencesHandler { static instance: PreferencesHandler = new PreferencesHandler(); private preferences: data_preferences.Preferences | null = null; private defaultValue = ''; private listeners: PreferencesListener[]; private constructor() { this.listeners = new Array(); } /** ...
AST#export_declaration#Left export default AST#class_declaration#Left class PreferencesHandler AST#class_body#Left { AST#property_declaration#Left static instance : AST#type_annotation#Left AST#primary_type#Left PreferencesHandler AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expressio...
export default class PreferencesHandler { static instance: PreferencesHandler = new PreferencesHandler(); private preferences: data_preferences.Preferences | null = null; private defaultValue = ''; private listeners: PreferencesListener[]; private constructor() { this.listeners = new Array(); } p...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L8-L77
190be86781eae49adc0ef2017154a47355c8c192
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/ContactPage.ets
arkts
loadFriendList
在 loadFriendList 方法中添加 finally 块确保重置加载状态
async loadFriendList() { console.log('开始加载好友列表'); this.isLoading = true; this.errorMessage = ''; this.allContacts = []; this.contactGroups = []; try { // 确保存储已初始化 await appState.waitForStorageReady(); // 检查登录状态 if (!AppStorage.get('isLoggedIn')) { this.errorMes...
AST#method_declaration#Left async loadFriendList 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#Right ....
async loadFriendList() { console.log('开始加载好友列表'); this.isLoading = true; this.errorMessage = ''; this.allContacts = []; this.contactGroups = []; try { await appState.waitForStorageReady(); if (!AppStorage.get('isLoggedIn')) { this.errorMessage = '用户未登录,请先登录';...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L61-L123
d9a6bbf701a8cb9f9bcec841dcedcd81e26eadb5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/barCharts/BarChartNegativePage.ets
arkts
menuCallback
标题栏菜单回调
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let barData = this.model.getBarData(); if (!barD...
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expressio...
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let barData = this.model.getBarData(); if (!barD...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/barCharts/BarChartNegativePage.ets#L82-L97
f36bc3a51a305a23ac67997b4e0898c287033e26
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets
arkts
setDrawIndex
设置当前绘制函数的下标
setDrawIndex(index: number) { if (index >= 0 && index < this.drawFunctions.length) { this.currentDrawIndex = index; this.invalidate(); // 触发重绘 } }
AST#method_declaration#Left setDrawIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statemen...
setDrawIndex(index: number) { if (index >= 0 && index < this.drawFunctions.length) { this.currentDrawIndex = index; this.invalidate(); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets#L95-L100
a54fab962d0d2ca70429a89d0c4f5c9d37fb1ef6
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setGridDashedLine
Enables the grid line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance. @param effect the DashPathEffect
public setGridDashedLine(effect: DashPathEffect): void { this.mGridDashPathEffect = effect; }
AST#method_declaration#Left public setGridDashedLine AST#parameter_list#Left ( AST#parameter#Left effect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void A...
public setGridDashedLine(effect: DashPathEffect): void { this.mGridDashPathEffect = effect; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L575-L577
0a546deaae44fec491ddbfa172d87411433774d0
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
tryBuildTreeFromNested
尝试从已包含 children 的数据中构建树 @param {Category[]} categories - 原始分类列表 @returns {CategoryTree[]} 构建后的树结构
private tryBuildTreeFromNested(categories: Category[]): CategoryTree[] { const hasChildren: boolean = categories.some((item: Category): boolean => { return (item.children ?? []).length > 0; }); if (!hasChildren) { return []; } return categories.map((item: Category): CategoryTree => this....
AST#method_declaration#Left private tryBuildTreeFromNested AST#parameter_list#Left ( AST#parameter#Left categories : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
private tryBuildTreeFromNested(categories: Category[]): CategoryTree[] { const hasChildren: boolean = categories.some((item: Category): boolean => { return (item.children ?? []).length > 0; }); if (!hasChildren) { return []; } return categories.map((item: Category): CategoryTree => this....
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L251-L259
cc2921efd7a2a2db6b24369f21948cfb6e8e258c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
mergeSecuritySettings
合并安全设置
private mergeSecuritySettings(current: SecuritySettings, updates: Partial<SecuritySettings>): SecuritySettings { const result: SecuritySettings = { level: updates.level !== undefined ? updates.level : current.level, biometricAuth: updates.biometricAuth !== undefined ? updates.biometricAuth : current.bio...
AST#method_declaration#Left private mergeSecuritySettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left SecuritySettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#L...
private mergeSecuritySettings(current: SecuritySettings, updates: Partial<SecuritySettings>): SecuritySettings { const result: SecuritySettings = { level: updates.level !== undefined ? updates.level : current.level, biometricAuth: updates.biometricAuth !== undefined ? updates.biometricAuth : current.bio...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L588-L597
18df7e74adbe3373e38a4fe7a3dc8ab0dce9b732
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
arkts
buildContactItem
构建联系方式项
@Builder buildContactItem(label: string, value: string, icon: Resource, onTap?: () => void) { Row({ space: 12 }) { Image(icon) .width(20) .height(20) .fillColor('#007AFF') Column({ space: 2 }) { Text(label) .fontSize(12) .fontColor('#666666') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactItem AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#L...
@Builder buildContactItem(label: string, value: string, icon: Resource, onTap?: () => void) { Row({ space: 12 }) { Image(icon) .width(20) .height(20) .fillColor('#007AFF') Column({ space: 2 }) { Text(label) .fontSize(12) .fontColor('#666666') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L493-L525
51734b7ed13d4f8db067127b8e0f4e1cf75c3e5b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinU.ets
arkts
SpinU
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinU { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; @Local angle3: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinU AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinU { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; @Local angle3: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinU.ets#L22-L95
7b1b0d7854f5d6bf0cc47438a4d6072a19cfd0fa
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets
arkts
getWindowRect
获取当前主窗口的尺寸 @returns
async getWindowRect(): Promise<window.Rect | undefined> { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } if (!this.mainWindow) { this.mainWindow = await this.windowStage.getMainWindow(); } const mainWinProp = this.mainWindow.getWindowPr...
AST#method_declaration#Left async getWindowRect 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#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Rect AST#quali...
async getWindowRect(): Promise<window.Rect | undefined> { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } if (!this.mainWindow) { this.mainWindow = await this.windowStage.getMainWindow(); } const mainWinProp = this.mainWindow.getWindowPr...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets#L66-L78
110e5d51628d881a105e2990789c834cc446c944
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Dialog.ets
arkts
setOptions
设置对话框选项
setOptions(options: promptAction.BaseDialogOptions) { this.options = options; // 将传入的选项赋值给实例变量 }
AST#method_declaration#Left setOptions AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . BaseDialogOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A...
setOptions(options: promptAction.BaseDialogOptions) { this.options = options; }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L26-L28
952de8081c649a057511c05c8cad682904c8d6cb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets
arkts
getMenuTranslateOptions
获取标题展开时,继续下拉的菜单栏Translate参数 @returns {TranslateOptions} 标题展开后继续下拉的菜单栏Translate参数
getMenuTranslateOptions(): TranslateOptions { return { y: Math.max(-this.curOffset, 0) }; }
AST#method_declaration#Left getMenuTranslateOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TranslateOptions AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left A...
getMenuTranslateOptions(): TranslateOptions { return { y: Math.max(-this.curOffset, 0) }; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L186-L188
fdafddb9f13840e08a364c121129e26065468c90
gitee
openharmony/base_location
724370a03f6f23ddc07c8eb9f49dfc61ab716bdb
services/location_ui/entry/src/main/ets/common/PermissionUtils.ets
arkts
checkBluetoothShareCallerBluetoothPermission
校验蓝牙分享普通ability调用方权限:蓝牙服务允许作为调用方拉起
checkBluetoothShareCallerBluetoothPermission(want: Want): boolean { const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string; const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number; console.info(TAG, `checkBluetoothPermission callerUid `...
AST#method_declaration#Left checkBluetoothShareCallerBluetoothPermission AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
checkBluetoothShareCallerBluetoothPermission(want: Want): boolean { const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string; const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number; console.info(TAG, `checkBluetoothPermission callerUid `...
https://github.com/openharmony/base_location/blob/724370a03f6f23ddc07c8eb9f49dfc61ab716bdb/services/location_ui/entry/src/main/ets/common/PermissionUtils.ets#L32-L43
7976cbc6abd99503614856f2e9f9016e77b4fc3e
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/DateUtils.ets
arkts
isYesterday
判断是否为昨天
static isYesterday(date: Date): boolean { const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); return date.getFullYear() === yesterday.getFullYear() && date.getMonth() === yesterday.getMonth() && date.getDate() === yesterday.getDate(); }
AST#method_declaration#Left static isYesterday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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...
static isYesterday(date: Date): boolean { const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); return date.getFullYear() === yesterday.getFullYear() && date.getMonth() === yesterday.getMonth() && date.getDate() === yesterday.getDate(); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L92-L98
25e85c0232894eaee6ecadd07b76d954b5e554d8
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/interface/TimeScaleOption.ets
arkts
Visual options for the time scale (ticks and labels).
export interface TimeScaleOption { /** Line width for tick marks. */ scaleLineWidth: number; /** Base tick height (the "big tick" usually doubles this). */ scaleLineHeight: number; /** Color of tick marks. */ scaleLineColor: string | number | CanvasGradient | CanvasPattern; /** Color of time labels. */...
AST#export_declaration#Left export AST#interface_declaration#Left interface TimeScaleOption AST#object_type#Left { /** Line width for tick marks. */ AST#type_member#Left scaleLineWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** Ba...
export interface TimeScaleOption { scaleLineWidth: number; scaleLineHeight: number; scaleLineColor: string | number | CanvasGradient | CanvasPattern; scaleTextColor: string | number | CanvasGradient | CanvasPattern; scaleAlignment: ScaleAlignment; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/interface/TimeScaleOption.ets#L20-L37
8f6d9b023af1464cd6373e605596790855eddc58
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Utils.ets
arkts
one digit or two number convert into two digit time format
export function padTo2Digits(num: number) { return num.toString().padStart(2, '0'); }
AST#export_declaration#Left export AST#function_declaration#Left function padTo2Digits AST#parameter_list#Left ( AST#parameter#Left num : 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#s...
export function padTo2Digits(num: number) { return num.toString().padStart(2, '0'); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Utils.ets#L36-L38
a364bbf51d63f7dd6d129e5c944ef24b8f3450f8
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/viewmodel/SettingData.ets
arkts
用户设置
export const SET_USER_TYPE = "1" // 安防设置
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SET_USER_TYPE = AST#expression#Left "1" AST#expression#Right AST#variable_declarator#Right // 安防设置 AST#variable_declaration#Right AST#export_declaration#Right
export const SET_USER_TYPE = "1"
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/SettingData.ets#L2-L4
d097f7b862cc783f47f38dbaadd30fe816ad3309
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
@huaweicloud/iot-device-sdk/src/main/ets/client/CustomOptions.d.ets
arkts
自定义连接选项
export declare class CustomOptions { /** * 是否使用自动重连功能 */ private _reConnect; set reConnect(value: boolean); get reConnect(): boolean; /** * 退避系数, 默认为1000,单位毫秒 */ private _backoff; set backoff(value: number); get backoff(): number; /** * 最小重连时间,默认为1000,单位毫秒 ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class CustomOptions AST#class_body#Left { /** * 是否使用自动重连功能 */ AST#property_declaration#Left private _reConnect ; AST#property_declaration#Right AST#method_declaration#Left set AST#ERROR#Left reConnect AST#ERRO...
export declare class CustomOptions { private _reConnect; set reConnect(value: boolean); get reConnect(): boolean; private _backoff; set backoff(value: number); get backoff(): number; private _minBackoff; set minBackoff(value: number); get minBackoff(): number; ...
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/CustomOptions.d.ets#L5-L45
30350c91f3c8056769ded9b14ba0b1d8b0257e52
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildImportButton
构建导入按钮
@Builder buildImportButton(type: string) { Button() { Row({ space: 8 }) { if (this.isProcessing) { LoadingProgress() .width('16vp') .height('16vp') .color('#ffffff') } Text(this.isProcessing ? '导入中...' : `开始${type}导入`) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildImportButton AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo...
@Builder buildImportButton(type: string) { Button() { Row({ space: 8 }) { if (this.isProcessing) { LoadingProgress() .width('16vp') .height('16vp') .color('#ffffff') } Text(this.isProcessing ? '导入中...' : `开始${type}导入`) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L654-L678
c8b57e080a440fdf02b57a463271d8bf353e5c84
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets
arkts
uploadFile
上传文件
async uploadFile() { //上传文件使用的分隔符 let boundary: string = '----ShandongCaoxianNB666MyBabyBoundary' + (await systemDateTime.getCurrentTime(true)).toString() //选择要上传的文件的内容 let fileContent: string = buf2String(this.readContentFromFile(this.uploadFilePath)) let segments = this.uploadFilePath.split('/')...
AST#method_declaration#Left async uploadFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //上传文件使用的分隔符 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
async uploadFile() { let boundary: string = '----ShandongCaoxianNB666MyBabyBoundary' + (await systemDateTime.getCurrentTime(true)).toString() let fileContent: string = buf2String(this.readContentFromFile(this.uploadFilePath)) let segments = this.uploadFilePath.split('/') let fileName = ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets#L114-L149
ed5b7fee59f00f17ab4b8af9bbc5312bca70dcd2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/CustomLoadingDialog.ets
arkts
CustomLoadingDialog
Custom dialog for loading.
@CustomDialog export struct CustomLoadingDialog { private controller: CustomDialogController; private content: string | Resource = ''; build() { Column() { LoadingProgress() .width($r('app.integer.video_create_gif_dialog_loading_width')) .height($r('app.integer.video_create_gif_dialog_l...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomLoadingDialog AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Righ...
@CustomDialog export struct CustomLoadingDialog { private controller: CustomDialogController; private content: string | Resource = ''; build() { Column() { LoadingProgress() .width($r('app.integer.video_create_gif_dialog_loading_width')) .height($r('app.integer.video_create_gif_dialog_l...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/CustomLoadingDialog.ets#L19-L40
827725f64a582d5692ab4714126e3c0747ebb8ff
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
arkts
getBorderWidth
获取日期选中框宽度(仅用于月视图和周视图) @param day 日期信息 @param month 月 @param currentSelectDay 当前选择的日期 @param calendarViewType 日历视图类型 @returns 返回颜色
static getBorderWidth(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType): number { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && currentSelectDay.date === day.dayInfo.date; const...
AST#method_declaration#Left static getBorderWidth AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left Day AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
static getBorderWidth(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType): number { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && currentSelectDay.date === day.dayInfo.date; const...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L112-L127
3e478c82d207bfdd67ec76927678d8342289f8ca
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationContentUtil.ets
arkts
initBasicNotificationContent
init basic notification content @param basicContent @return return the created NotificationContent
initBasicNotificationContent( basicContent: notification.NotificationBasicContent ): notification.NotificationContent { return { notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 通知内容类型 normal: basicContent // 基本类型通知内容 }; }
AST#method_declaration#Left initBasicNotificationContent 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#Righ...
initBasicNotificationContent( basicContent: notification.NotificationBasicContent ): notification.NotificationContent { return { notificationContentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent }; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationContentUtil.ets#L24-L31
cf54b4c2cd86294bb4073d07b7cab518e320e055
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/pages/SampleCodePage.ets
arkts
filterSamples
过滤示例代码
filterSamples() { let filtered = this.codeSamples; // 按分类过滤 if (this.selectedCategory !== '全部') { filtered = filtered.filter(sample => sample.category === this.selectedCategory); } // 按搜索文本过滤 if (this.searchText.trim() !== '') { const searchLower = this.searchText.toLowerCase(); ...
AST#method_declaration#Left filterSamples AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filtered = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . codeSample...
filterSamples() { let filtered = this.codeSamples; if (this.selectedCategory !== '全部') { filtered = filtered.filter(sample => sample.category === this.selectedCategory); } if (this.searchText.trim() !== '') { const searchLower = this.searchText.toLowerCase(); filtered = fil...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/SampleCodePage.ets#L2236-L2255
1254b140f1e30344a8aab2c99e00c43d5c607375
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/constants/DefaultConfigs.ets
arkts
合并用户配置和默认配置 @param userConfig - 用户配置 @returns 合并后的完整配置
export function mergeSwipeConfig(userConfig?: SwipeConfig): Required<SwipeConfig> { const merged: Required<SwipeConfig> = { maxVisibleCards: DEFAULT_SWIPE_CONFIG.maxVisibleCards, minStackSize: DEFAULT_SWIPE_CONFIG.minStackSize, rotationAngle: DEFAULT_SWIPE_CONFIG.rotationAngle, scaleRatio: DEFAULT_SWI...
AST#export_declaration#Left export AST#function_declaration#Left function mergeSwipeConfig AST#parameter_list#Left ( AST#parameter#Left userConfig ? : AST#type_annotation#Left AST#primary_type#Left SwipeConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann...
export function mergeSwipeConfig(userConfig?: SwipeConfig): Required<SwipeConfig> { const merged: Required<SwipeConfig> = { maxVisibleCards: DEFAULT_SWIPE_CONFIG.maxVisibleCards, minStackSize: DEFAULT_SWIPE_CONFIG.minStackSize, rotationAngle: DEFAULT_SWIPE_CONFIG.rotationAngle, scaleRatio: DEFAULT_SWI...
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/constants/DefaultConfigs.ets#L92-L136
bd2d60062641d739f4e9dd6ca74c563e364f78d6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
arkts
特殊字符键盘数据,真实业务场景网络请求下发的数据
export const specialKeyData: IKeyAttribute[] = [ { label: '!', value: '!', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: '@', value: '@', fontSize: 16, fontColor: Color.White, backgroundC...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left specialKeyData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IKeyAttribute [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ A...
export const specialKeyData: IKeyAttribute[] = [ { label: '!', value: '!', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: '@', value: '@', fontSize: 16, fontColor: Color.White, backgroundC...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L732-L1074
29219fb32d5955257db9e6e679b142ff3da7d384
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/LinearSearch.ets
arkts
findMin
查找最小元素 @param arr 数组 @returns 最小元素的索引,如果数组为空则返回-1
public static findMin(arr: number[]): number { if (!arr || arr.length === 0) { return -1; } let minIndex = 0; for (let i = 1; i < arr.length; i++) { if (arr[i] < arr[minIndex]) { minIndex = i; } } return minIndex; }
AST#method_declaration#Left public static findMin AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le...
public static findMin(arr: number[]): number { if (!arr || arr.length === 0) { return -1; } let minIndex = 0; for (let i = 1; i < arr.length; i++) { if (arr[i] < arr[minIndex]) { minIndex = i; } } return minIndex; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/LinearSearch.ets#L111-L124
3a7bffff3b6fd94c712d9727d489142adabc04ba
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
统计数据类型
export interface StatisticsData { overview: OverviewStats; birthday: BirthdayStats; greeting: GreetingStats; usage: UsageStats; trend: TrendStats; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StatisticsData AST#object_type#Left { AST#type_member#Left overview : AST#type_annotation#Left AST#primary_type#Left OverviewStats AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left birthday : AST#type...
export interface StatisticsData { overview: OverviewStats; birthday: BirthdayStats; greeting: GreetingStats; usage: UsageStats; trend: TrendStats; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L119-L125
2a39848850088a22ad20be8c5e78d77f55a7d594
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
registerDataChangeListener
注册数据改变的监听器 @param listener
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener 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#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets#L228-L232
ff9243908c1e5410fa0d06df7968c210991dc32e
gitee
zhangyuhang0914/ArkTs-HarmonyOs.git
c9773cad7ebeee413f98ee1a57cc8fba91fecf7d
entry/src/main/ets/skeleton/CommonSkeleton.ets
arkts
CommonSkeleton
TODO-通用骨架屏---BuilderParams只能支持一个参数,多个参数不支持闭包的写法,这个很纠结。。。。目前只能简单的内置骨架屏了
@Component export struct CommonSkeleton { @State dataList: Array<string> = new Array(5) aboutToAppear() { for (let index = 0; index < 3; index++) { this.dataList.push('') } } build() { List({ space: 10 }) { ForEach(this.dataList, (item, index) => { ListItem() { this.i...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonSkeleton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argu...
@Component export struct CommonSkeleton { @State dataList: Array<string> = new Array(5) aboutToAppear() { for (let index = 0; index < 3; index++) { this.dataList.push('') } } build() { List({ space: 10 }) { ForEach(this.dataList, (item, index) => { ListItem() { this.i...
https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/skeleton/CommonSkeleton.ets#L4-L44
6ab06fd2cf83f98bf3f9f21004d441ce1b80c8d2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
窗口Stage销毁时的回调
onWindowStageDestroy(): void { console.log('[EntryAbility] Ability onWindowStageDestroy'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onWindowStageDestroy'); this.windowStage = undefined; }
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 { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp...
onWindowStageDestroy(): void { console.log('[EntryAbility] Ability onWindowStageDestroy'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onWindowStageDestroy'); this.windowStage = undefined; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L58-L62
9eda7ec8cbaf07733186227c9063eb4d679eff1c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
getThemeModeDescription
获取主题模式描述
private getThemeModeDescription(mode: ThemeMode): string { switch (mode) { case ThemeMode.LIGHT: return '浅色主题'; case ThemeMode.DARK: return '深色主题'; case ThemeMode.SYSTEM: return '跟随系统'; default: return '跟随系统'; } }
AST#method_declaration#Left private getThemeModeDescription AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode 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 getThemeModeDescription(mode: ThemeMode): string { switch (mode) { case ThemeMode.LIGHT: return '浅色主题'; case ThemeMode.DARK: return '深色主题'; case ThemeMode.SYSTEM: return '跟随系统'; default: return '跟随系统'; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L582-L593
5447dae717d26217e5547de6bdf25e368af7cc8d
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/annotation/Service.ets
arkts
预留,后面会替代@Service @param param @returns
export function ZService(param: Param){ return Object }
AST#export_declaration#Left export AST#function_declaration#Left function ZService AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Param AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#stat...
export function ZService(param: Param){ return Object }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/annotation/Service.ets#L16-L18
7ccb14522a92273fd3486f7f22504932a12b5868
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ResourceUtils.ets
arkts
/获取带格式化的string
export function getStringF(resFormat: ResourceStr, ...args: (number | string)[]): string { if (args && args.length > 0) { const format = getString(resFormat) return util.format(format, ...args)/// ✅ 注意这里加了 ... } return getString(resFormat) }
AST#export_declaration#Left export AST#function_declaration#Left function getStringF AST#parameter_list#Left ( AST#parameter#Left resFormat : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... args : AST#ERROR#Left AST...
export function getStringF(resFormat: ResourceStr, ...args: (number | string)[]): string { if (args && args.length > 0) { const format = getString(resFormat) return util.format(format, ...args) } return getString(resFormat) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ResourceUtils.ets#L79-L85
93e1435ce273c17257f2b4f4f81e907578f4f7e5
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets
arkts
clear
清空所有数据
public async clear(): Promise<void> { try { await this.ensureInitialized(); await this.preferences?.clear(); await this.preferences?.flush(); console.info('清空所有数据成功'); } catch (error) { console.error('清空所有数据失败:', error); throw new Error('清空所有数据失败'); } }
AST#method_declaration#Left public async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
public async clear(): Promise<void> { try { await this.ensureInitialized(); await this.preferences?.clear(); await this.preferences?.flush(); console.info('清空所有数据成功'); } catch (error) { console.error('清空所有数据失败:', error); throw new Error('清空所有数据失败'); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L111-L121
521a6568f32f985741a437f44748a68c80a8bddd
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/BillData.ets
arkts
saveBill
保存账单
static async saveBill(bill: BillItem): Promise<void> { try { console.info('BillDataManager: 开始保存账单'); const bills = await BillDataManager.getAllBills(); console.info('BillDataManager: 当前账单数量:', bills.length); bills.unshift(bill); // 添加到列表开头 const jsonData = JSON.stringify(bills); ...
AST#method_declaration#Left static async saveBill AST#parameter_list#Left ( AST#parameter#Left bill : AST#type_annotation#Left AST#primary_type#Left BillItem 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#...
static async saveBill(bill: BillItem): Promise<void> { try { console.info('BillDataManager: 开始保存账单'); const bills = await BillDataManager.getAllBills(); console.info('BillDataManager: 当前账单数量:', bills.length); bills.unshift(bill); const jsonData = JSON.stringify(bills); console.i...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/BillData.ets#L24-L37
af97d10e3d3a09b1b8391298f978b39b64b6b37f
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/UserModel.ets
arkts
isLoggedIn
检查是否已登录
static async isLoggedIn(): Promise<boolean> { const currentUser = await UserManager.getCurrentUser(); return currentUser !== null && currentUser !== ''; }
AST#method_declaration#Left static async isLoggedIn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#...
static async isLoggedIn(): Promise<boolean> { const currentUser = await UserManager.getCurrentUser(); return currentUser !== null && currentUser !== ''; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L195-L198
68eb86ca6c5b9714a5a6117982e4a8a8f4acde8e
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/components/MainPage.ets
arkts
MainPage
Copyright 2024 Huawei Cloud IoT Authors 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, softwa...
@Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/components/MainPage.ets#L15-L30
363e86a386f04001d15cccaa0032e6b59d39dc9f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
getHighlightByTouchPoint
Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the CombinedChart. @param x @param y @return @Override
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { LogUtil.log("Can't select by touch. No data set."); return null; } else { let highlighter = this.getHighlighter(); if (!highlighter) { return null } let h: Highlight |...
AST#method_declaration#Left public getHighlightByTouchPoint AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { LogUtil.log("Can't select by touch. No data set."); return null; } else { let highlighter = this.getHighlighter(); if (!highlighter) { return null } let h: Highlight |...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L113-L130
082d3225f4dbeee7f9831e82fefa55efeb29ad65
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ImageUtil.ets
arkts
compressPhoto
图片压缩,返回压缩后的图片文件路径 @param uri:原始待压缩图片的PixelMap对象 @param maxSize:指定图片的压缩目标大小,单位kb @param imageFormat:当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。 @returns filePath:返回文件压缩路径
static async compressPhoto(uri: string, maxSize: number, imageFormat?: string): Promise<string> { imageFormat = imageFormat ?? PreviewUtil.getMimeType(FileUtil.getFileExtention(uri)); let srcFile = await FileUtil.open(uri, fs.OpenMode.READ_ONLY); let pixelMap = await ImageUtil.createImageSource(srcFile.fd)....
AST#method_declaration#Left static async compressPhoto AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxSize : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
static async compressPhoto(uri: string, maxSize: number, imageFormat?: string): Promise<string> { imageFormat = imageFormat ?? PreviewUtil.getMimeType(FileUtil.getFileExtention(uri)); let srcFile = await FileUtil.open(uri, fs.OpenMode.READ_ONLY); let pixelMap = await ImageUtil.createImageSource(srcFile.fd)....
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L366-L376
1005df59e532a5550d09a693f36d35b082bf7d51
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
getOffset
计算水平或者竖直的偏移量
getOffset(coordinateAxis: string, location: number[]): number { if (coordinateAxis === 'x') { return this.setOffsetXByOrientation(location); } return this.setOffsetYByOrientation(location); }
AST#method_declaration#Left getOffset AST#parameter_list#Left ( AST#parameter#Left coordinateAxis : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left location : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Lef...
getOffset(coordinateAxis: string, location: number[]): number { if (coordinateAxis === 'x') { return this.setOffsetXByOrientation(location); } return this.setOffsetYByOrientation(location); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L199-L204
48361cf5fb9d4738100e6ea54ecab9d03154e664
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
commonModule/src/main/ets/utils/HttpUtils.ets
arkts
put
PUT请求
static put<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.PUT, params) }
AST#method_declaration#Left static put AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ,...
static put<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.PUT, params) }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/utils/HttpUtils.ets#L76-L78
8b53aba4497686a8ab9d8d217f1739e4425da217
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
isNotBlank
判断字符串是否为非空和空白符(空白符包括空格、制表符、全角空格和不间断空格)true为非空,否则false @param str @returns
static isNotBlank(str: string | undefined | null): boolean { return false === StrUtil.isBlank(str); }
AST#method_declaration#Left static isNotBlank AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Ri...
static isNotBlank(str: string | undefined | null): boolean { return false === StrUtil.isBlank(str); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L86-L88
6fffdaab81fd6f33d7071650b6a6f8527cdf449f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets
arkts
sign
签名 @param str 需要签名的字符串 @param priKey 私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64) - 不传默认为base64 @returns string 签名对象
static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.sign(str, priKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, resultCoding, false); }
AST#method_declaration#Left static sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right...
static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.sign(str, priKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, resultCoding, false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets#L45-L48
58fc7824e127af4c9a444d7e03b1b6286cbc563f
gitee
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/model/CalendarUtil.ets
arkts
getWeekDays
获取指定日期所在周的7天日期对象
static getWeekDays(currentDate: Date): Date[] { let days: Date[] = []; let currentDayOfWeek = currentDate.getDay(); // 0-6 // 计算本周第一天(周日) let startOfWeek = new Date(currentDate); startOfWeek.setDate(currentDate.getDate() - currentDayOfWeek); for (let i = 0; i < 7; i++) { let tempDate = n...
AST#method_declaration#Left static getWeekDays AST#parameter_list#Left ( AST#parameter#Left currentDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Le...
static getWeekDays(currentDate: Date): Date[] { let days: Date[] = []; let currentDayOfWeek = currentDate.getDay(); let startOfWeek = new Date(currentDate); startOfWeek.setDate(currentDate.getDate() - currentDayOfWeek); for (let i = 0; i < 7; i++) { let tempDate = new Date(startOfWeek)...
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/model/CalendarUtil.ets#L34-L48
c2c07505db45bf33f95a245dffd171ad9b42e090
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets
arkts
ActionButtonBuilder
Build subcomponents using @Builder
@Builder function ActionButtonBuilder() { // ... }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function ActionButtonBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // ... } AST#builder_function_body#Right AST#decorated_function_declaration#Right
@Builder function ActionButtonBuilder() { }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets#L69-L72
b6138c285ad68a38c60ec00396001e34dd05e803
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getWeekDays
获取某周的所有日期 @param weekNum 距离本周的周数。本周用0表示,负数表示过去周,正数表示未来周,以此类推。 @returns 返回某周的所有日期
static getWeekDays(weekNum: number): Day[][] { // 获取当前日期 const CURRENT_DATE = new Date(); // 获取当前日期是本周的周几(0-6,其中0代表周日,1代表周一,以此类推) const WEEK_DAY = CURRENT_DATE.getDay(); // 计算并设置目标周的第一天(周日)的日期 const BEGIN_DATE = new Date(CURRENT_DATE.getTime() - WEEK_DAY * Constants.TOTAL_MILLISECONDS_IN_DAY + ...
AST#method_declaration#Left static getWeekDays AST#parameter_list#Left ( AST#parameter#Left weekNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left...
static getWeekDays(weekNum: number): Day[][] { const CURRENT_DATE = new Date(); 是本周的周几(0-6,其中0代表周日,1代表周一,以此类推) const WEEK_DAY = CURRENT_DATE.getDay(); const BEGIN_DATE = new Date(CURRENT_DATE.getTime() - WEEK_DAY * Constants.TOTAL_MILLISECONDS_IN_DAY + (Constants.DAYS_IN_WEEK * weekNum) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L170-L202
7608b0b95e8939712bcf207f0a9987ed00492da7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
getDarkTheme
获取深色主题
private getDarkTheme(): ColorTheme | null { return this.colorThemes.find(t => t.isDark) || null; }
AST#method_declaration#Left private getDarkTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ColorTheme AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statem...
private getDarkTheme(): ColorTheme | null { return this.colorThemes.find(t => t.isDark) || null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L811-L813
2879a667b51c0edf8000cf09024a4d4afd080d65
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
setTypeface
sets a specific Typeface for the labels @param tf
public setTypeface(tf: FontWeight /*Typeface*/): void { this.mTypeface = tf; }
AST#method_declaration#Left public setTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*Typeface*/ ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
public setTypeface(tf: FontWeight ): void { this.mTypeface = tf; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L109-L111
4726daceca62e2d6b0a15168742e10601a95c4d2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/SoundEffect/SEManager.ets
arkts
removeEventListeners
移除事件监听器
private removeEventListeners(): void { if (!this.soundPool) return; this.soundPool.off('loadComplete'); // this.soundPool.off('playFinishedWithStreamId'); this.soundPool.off('error'); }
AST#method_declaration#Left private removeEventListeners 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#if_statement#Left if ( AST#expression#Left AST#member_exp...
private removeEventListeners(): void { if (!this.soundPool) return; this.soundPool.off('loadComplete'); this.soundPool.off('error'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L294-L300
d3c134e2be59951768afcdd4cda9e03c4ff5c1d4
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.ets
arkts
A search_engine object, which consists of a label and the search engine link. @param label The name of the search engine. @param link The link of the search engine, '%s' in which will be replaced with real search keywords.
constructor(label: string, content: string) { this.label = label; this.url = content; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left label : 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...
constructor(label: string, content: string) { this.label = label; this.url = content; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L99-L102
e8efb861427fa783b6e3b9788f7fc240f5df2242
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/DialogOptions.ets
arkts
确认AlertDialog参数类
export class ConfirmDialogOptions extends DialogOptions { confirm?: ButtonOptions | ResourceStr; }
AST#export_declaration#Left export AST#class_declaration#Left class ConfirmDialogOptions extends AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left confirm ? : AST#type_annotation#Left AST#union_type#Left AST#...
export class ConfirmDialogOptions extends DialogOptions { confirm?: ButtonOptions | ResourceStr; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L66-L68
5c345b845196567b754209f95c6ecd6ea3543eb8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ShareImagePage.ets
arkts
chatItem
聊天item @param data 聊天item数据 @param index item的索引值
@Builder chatItem(data: textDetailData, index: number) { Flex({ direction: data.userId === 1 ? FlexDirection.Row : FlexDirection.RowReverse, alignItems: ItemAlign.Center }) { // 用户头像 Image(data.profilePicture) .objectFit(ImageFit.Fill) .width($r('app.integer.share_image...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right chatItem AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left textDetailData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Le...
@Builder chatItem(data: textDetailData, index: number) { Flex({ direction: data.userId === 1 ? FlexDirection.Row : FlexDirection.RowReverse, alignItems: ItemAlign.Center }) { Image(data.profilePicture) .objectFit(ImageFit.Fill) .width($r('app.integer.share_image_page_u...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ShareImagePage.ets#L86-L124
511336849fe1b861f9b61ad292c76cd872997275
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/utils/DecodeUtil.ets
arkts
getResourceFd
Async get resource fd. @return file fd.
async function getResourceFd(component: UIContext): Promise<number> { const context = component.getHostContext()!; const resourceMgr = context.resourceManager; let res = -1; try { let imageBuffer = await resourceMgr.getMediaContent($r('app.media.ic_low').id); let filePath = context.cacheDir + '/low.jpg'...
AST#function_declaration#Left async function getResourceFd AST#parameter_list#Left ( AST#parameter#Left component : 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#primary_type#Left AS...
async function getResourceFd(component: UIContext): Promise<number> { const context = component.getHostContext()!; const resourceMgr = context.resourceManager; let res = -1; try { let imageBuffer = await resourceMgr.getMediaContent($r('app.media.ic_low').id); let filePath = context.cacheDir + '/low.jpg'...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/utils/DecodeUtil.ets#L27-L41
a93a5ab5ace88aa9df96c0f5b423766a92dcc66d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/CalendarPage.ets
arkts
initializePage
初始化页面
private async initializePage(): Promise<void> { try { this.loading = true; await this.loadCalendarData(); await this.loadUpcomingBirthdays(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize calendar page: ${error}`); } finally { ...
AST#method_declaration#Left private async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS...
private async initializePage(): Promise<void> { try { this.loading = true; await this.loadCalendarData(); await this.loadUpcomingBirthdays(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize calendar page: ${error}`); } finally { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L53-L63
8e1afddc0efc05b00915ca711cffc689e93d325c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
onRightListScroll
处理右侧列表滚动事件 @param {number} startIndex - 当前可见起始索引 @returns {void} 无返回值
onRightListScroll(startIndex: number): void { if (startIndex < 0) { return; } if (this.isSideBarScrolling) { return; } if (startIndex !== this.selectedCategoryIndex) { this.selectedCategoryIndex = startIndex; } }
AST#method_declaration#Left onRightListScroll AST#parameter_list#Left ( AST#parameter#Left startIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_...
onRightListScroll(startIndex: number): void { if (startIndex < 0) { return; } if (this.isSideBarScrolling) { return; } if (startIndex !== this.selectedCategoryIndex) { this.selectedCategoryIndex = startIndex; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L101-L111
76cf8565f378528f4a4a8d4e884520fc29edab79
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/goods/GoodsNavigator.ets
arkts
toComment
跳转到商品评价 @param {number} goodsId - 商品 ID @returns {void} 无返回值
static toComment(goodsId: number): void { const params: GoodsIdParam = { goodsId }; navigateTo(GoodsRoutes.Comment, params); }
AST#method_declaration#Left static toComment AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type...
static toComment(goodsId: number): void { const params: GoodsIdParam = { goodsId }; navigateTo(GoodsRoutes.Comment, params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsNavigator.ets#L26-L29
effb80a22452715ab8426e96a863fd9bc1be583f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
onCreate(want) { globalThis.abilityWant = want; }
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info(CommonConstants.ENTRY_ABILITY_TAG, 'onWindowStageCreate'); windowStage.loadContent('pages/LauncherPage', (err, data) => { if (err.code) { Logger.error(CommonConstants.ENTRY_ABILITY_TAG, 'Failed to load the content. Cause:' + ...
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info(CommonConstants.ENTRY_ABILITY_TAG, 'onWindowStageCreate'); windowStage.loadContent('pages/LauncherPage', (err, data) => { if (err.code) { Logger.error(CommonConstants.ENTRY_ABILITY_TAG, 'Failed to load the content. Cause:' + ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets#L29-L38
7660a3d374176ebae09d567db4b7987848003797
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets
arkts
setSpeaker
设置是否打开扬声器
setSpeaker(speaker: boolean): void { AudioManagerModel.setSpeaker(speaker); }
AST#method_declaration#Left setSpeaker AST#parameter_list#Left ( AST#parameter#Left speaker : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
setSpeaker(speaker: boolean): void { AudioManagerModel.setSpeaker(speaker); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L161-L163
d135e11292cb66d708c3edc449c03090a50800d0
gitee
CongDuang/PlayHarmony.git
674a0459e1b20db9de8c837dff6a8d1f06330e79
entry/src/main/ets/pages/main/view/OfficialAccountView.ets
arkts
getProjectCategory
获取项目分类
private async getProjectCategory() { const resp = await HttpUtil.getInstance().get<CategoryModel[], undefined>('/wxarticle/chapters/json'); if (resp.errorCode === ErroCode.OK && resp.data && resp.data.length > 0) { this.categoryList = resp.data; } }
AST#method_declaration#Left private async getProjectCategory AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#L...
private async getProjectCategory() { const resp = await HttpUtil.getInstance().get<CategoryModel[], undefined>('/wxarticle/chapters/json'); if (resp.errorCode === ErroCode.OK && resp.data && resp.data.length > 0) { this.categoryList = resp.data; } }
https://github.com/CongDuang/PlayHarmony.git/blob/674a0459e1b20db9de8c837dff6a8d1f06330e79/entry/src/main/ets/pages/main/view/OfficialAccountView.ets#L25-L30
c31a4cc5b4bb3028dfb46cf815d03ab19a5aed84
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets
arkts
initDmInstance
Initializing Device Management Objects.
initDmInstance(dealDeviceInfo: Function) { this.dealDeviceInfo = dealDeviceInfo; try { deviceManager.createDeviceManager(getContext(this).applicationInfo.name, (err, data) => { if (err) { Logger.error(TAG, 'createDeviceManager errCode:' + err.code + ',errMessage:' + err.message); ...
AST#method_declaration#Left initDmInstance AST#parameter_list#Left ( AST#parameter#Left dealDeviceInfo : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_st...
initDmInstance(dealDeviceInfo: Function) { this.dealDeviceInfo = dealDeviceInfo; try { deviceManager.createDeviceManager(getContext(this).applicationInfo.name, (err, data) => { if (err) { Logger.error(TAG, 'createDeviceManager errCode:' + err.code + ',errMessage:' + err.message); ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets#L33-L48
826356ff6d98b812f716d66b33c30ad455014a53
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
parseCartList
解析购物车列表 @param {CartJson[]} jsonList JSON 数据列表 @returns {Cart[]} 购物车列表
private parseCartList(jsonList: CartJson[]): Cart[] { const result: Cart[] = []; for (const item of jsonList) { const cart = new Cart(); cart.goodsId = item.goodsId ?? 0; cart.goodsName = item.goodsName ?? ""; cart.goodsMainPic = item.goodsMainPic ?? ""; // 解析规格列表 const spe...
AST#method_declaration#Left private parseCartList AST#parameter_list#Left ( AST#parameter#Left jsonList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartJson [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota...
private parseCartList(jsonList: CartJson[]): Cart[] { const result: Cart[] = []; for (const item of jsonList) { const cart = new Cart(); cart.goodsId = item.goodsId ?? 0; cart.goodsName = item.goodsName ?? ""; cart.goodsMainPic = item.goodsMainPic ?? ""; const specs: CartG...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L162-L192
da82ca62795ea348484c5c1555c30d5f792fdb18
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
getCacheSize
获取缓存大小(估算)
static async getCacheSize(): Promise<number> { try { const keys = await StorageManager.getAllKeys(); let totalSize = 0; for (const key of keys) { const value = await StorageManager.getString(key, ''); totalSize += key.length + value.length; } return totalSize; } cat...
AST#method_declaration#Left static async getCacheSize 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 number AST#primary_type#Right AST#type_annotation#Right > AST...
static async getCacheSize(): Promise<number> { try { const keys = await StorageManager.getAllKeys(); let totalSize = 0; for (const key of keys) { const value = await StorageManager.getString(key, ''); totalSize += key.length + value.length; } return totalSize; } cat...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L210-L223
8a97107025d99db259d098297e7490b88b6fc67e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getFactor
Returns the factor that is needed to transform values into pixels. @return
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange; }
AST#method_declaration#Left public getFactor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content ...
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L182-L185
da3ea92483ddb379a5e87d13d43fbd6c3fb45188
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/constants/RouterConstants.ets
arkts
Indicates the key of the routerMap table in the RouterModule.
export class RouterNameConstants { static readonly ENTRY_HAP: string = 'EntryHap_Router'; }
AST#export_declaration#Left export AST#class_declaration#Left class RouterNameConstants AST#class_body#Left { AST#property_declaration#Left static readonly ENTRY_HAP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'EntryHap_Router' AST#expre...
export class RouterNameConstants { static readonly ENTRY_HAP: string = 'EntryHap_Router'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/constants/RouterConstants.ets#L28-L30
8aff961343feea9af976a884169ffd12a8c9bce8
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
Created by Philipp Jahoda on 09/06/16.
export default abstract class BarLineScatterCandleBubbleRenderer extends DataRenderer { /** * buffer for storing the current minimum and maximum visible x */ protected mXBounds: XBounds | null = null; constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) { super(animator, viewPortHandl...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BarLineScatterCandleBubbleRenderer extends AST#type_annotation#Left AST#primary_type#Left DataRenderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * buffer for storing the current minimum and maximum v...
export default abstract class BarLineScatterCandleBubbleRenderer extends DataRenderer { protected mXBounds: XBounds | null = null; constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) { super(animator, viewPortHandler); if (this.mAnimator) { this.mXBounds = new XBounds(this.mAnim...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets#L70-L113
5841557ced5cfa352c3f7bbe794365568162915c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
翻译键值对接口
export interface TranslationKeys {
AST#export_declaration#Left export AST#interface_declaration#Left interface TranslationKeys AST#object_type#Left { AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface TranslationKeys {
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L63-L63
a31aadda1fa7047799808d43778ec274194413c7
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/favorites/FavoriteTabContent.ets
arkts
loadFavoriteMerchants
加载收藏的商家数据 根据 favoriteIds 从数据源中获取完整的商家信息
private async loadFavoriteMerchants(): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Loading favorite merchants...'); this.isLoading = true; // 如果没有收藏,直接返回空列表 if (!this.favoriteIds || this.favoriteIds.length === 0) { this.favoriteMerchants = []; this.isLoading = false; ...
AST#method_declaration#Left private async loadFavoriteMerchants 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#Rig...
private async loadFavoriteMerchants(): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Loading favorite merchants...'); this.isLoading = true; if (!this.favoriteIds || this.favoriteIds.length === 0) { this.favoriteMerchants = []; this.isLoading = false; hilog.info(DO...
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/favorites/FavoriteTabContent.ets#L50-L92
4bd055908cb212999d82ef3d25bde65a328ccbaa
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/constants/BreakpointConstants.ets
arkts
Constants for breakpoint.
export class BreakpointConstants { /** * Breakpoints that represent small device types. */ static readonly BREAKPOINT_SM: string = 'sm'; /** * Breakpoints that represent middle device types. */ static readonly BREAKPOINT_MD: string = 'md'; /** * Breakpoints that represent large device types. ...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /** * Breakpoints that represent small device types. */ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
export class BreakpointConstants { static readonly BREAKPOINT_SM: string = 'sm'; static readonly BREAKPOINT_MD: string = 'md'; static readonly BREAKPOINT_LG: string = 'lg'; static readonly GRID_ROW_COLUMNS: number[] = [4, 8, 12]; static readonly GRID_COLUMN_SPANS: number[] = [4, 8, 12]; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/constants/BreakpointConstants.ets#L19-L44
0af0dfb96f0a394a858e6e595826389a918ab0bd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ReminderInfo.ets
arkts
Reminder info
export default class ReminderInfo { publishReminder: Function = () => {}; cancelReminder: Function = () => {}; hasNotificationId: Function = () => {}; }
AST#export_declaration#Left export default AST#class_declaration#Left class ReminderInfo AST#class_body#Left { AST#property_declaration#Left publishReminder : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parame...
export default class ReminderInfo { publishReminder: Function = () => {}; cancelReminder: Function = () => {}; hasNotificationId: Function = () => {}; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ReminderInfo.ets#L19-L23
57991c91cb58b5388133d0acba3143b9cdc570d4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
arkts
getSoftListData
获取软件耗电统计 @return {Array<BatteryStatsModel>} listItems
async getSoftListData(): Promise<Array<BatteryStatsModel>> { return new Promise(async (resolve, reject) => { let appFlags = bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT; let listItems: BatteryStatsModel[] = []; try { if (!this.applications || this.applications.length === 0) {...
AST#method_declaration#Left async getSoftListData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_an...
async getSoftListData(): Promise<Array<BatteryStatsModel>> { return new Promise(async (resolve, reject) => { let appFlags = bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT; let listItems: BatteryStatsModel[] = []; try { if (!this.applications || this.applications.length === 0) {...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L41-L62
7cb79660d7517ddf44d9d05943e31724fd5e0421
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
updateFocusTime
更新任务专注时间
async updateFocusTime(id: number, additionalMinutes: number): Promise<boolean> { const task = this.getTaskById(id); if (!task) return false; const currentTimeRecord: TaskTimeRecord = task.timeRecord || { startTime: undefined, endTime: undefined, totalTimeSpent: 0, focusTime: 0, ...
AST#method_declaration#Left async updateFocusTime 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#Left additionalMinutes : AST#type_annotation#Left AST#primary_type#Left number AS...
async updateFocusTime(id: number, additionalMinutes: number): Promise<boolean> { const task = this.getTaskById(id); if (!task) return false; const currentTimeRecord: TaskTimeRecord = task.timeRecord || { startTime: undefined, endTime: undefined, totalTimeSpent: 0, focusTime: 0, ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L356-L381
27e9ba093021cd8e7ca9cc2e10275ad7030dfdd8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/Index.ets
arkts
StatusBarAnimationComponent
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 { StatusBarAnimationComponent } from './src/main/ets/view/StatusBarAnimation';
AST#export_declaration#Left export { StatusBarAnimationComponent } from './src/main/ets/view/StatusBarAnimation' ; AST#export_declaration#Right
export { StatusBarAnimationComponent } from './src/main/ets/view/StatusBarAnimation';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/Index.ets#L16-L16
bdca6fb218a13822bc1065453c9f6f71cd6a08e7
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/common/bean/TabItemData.ets
arkts
Tab item data entity.
export class TabItemData { /** * Original image of the tabs. */ imageOriginal: Resource; /** * Active image of the tabs.This image is displayed when you click the tab. */ imageActivated: Resource; /** * Tab title. */ title: Resource; }
AST#export_declaration#Left export AST#class_declaration#Left class TabItemData AST#class_body#Left { /** * Original image of the tabs. */ AST#property_declaration#Left imageOriginal : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declarati...
export class TabItemData { imageOriginal: Resource; imageActivated: Resource; title: Resource; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/common/bean/TabItemData.ets#L4-L19
992eda23dd280811eb43821581ae41a392eafe80
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/PlayerDemo.ets
arkts
setAVPlayerCallback
注册avplayer回调函数。
setAVPlayerCallback(avPlayer: media.AVPlayer) { // seek操作结果回调函数。 avPlayer.on('seekDone', (seekDoneTime: number) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // error回调监听函数,当avplayer在操作过程中出现错误时,调用reset接口触发重置流程。 avPlayer.on('error', (err: BusinessError) => { ...
AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERR...
setAVPlayerCallback(avPlayer: media.AVPlayer) { avPlayer.on('seekDone', (seekDoneTime: number) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) avPlayer.on('error', (err: BusinessError) => { console.error(`Invoke avPlayer failed, code is ${err.code}, messa...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/PlayerDemo.ets#L30-L53
03cb0ae3beb9cf679b26f1639346bddf44d48cef
gitee