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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
startNewSession
开始新会话
private startNewSession(): void { this.currentSessionId = `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; this.sessionStartTime = Date.now(); const eventData: AppLaunchEventData = { sessionId: this.currentSessionId, timestamp: new Date().toISOString() }; this.tra...
AST#method_declaration#Left private startNewSession 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#expression_statement#Left AST#expression#Left AST#assignment_e...
private startNewSession(): void { this.currentSessionId = `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; this.sessionStartTime = Date.now(); const eventData: AppLaunchEventData = { sessionId: this.currentSessionId, timestamp: new Date().toISOString() }; this.tra...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L313-L322
d35f5f897544f3f67e50c35b1476faaf69dca3c9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Tools/FlipClock/entry/src/main/ets/common/AlarmClock.ets
arkts
getDeviceType
获取设备类型
async getDeviceType(){ try { let deviceType = deviceInfo.deviceType; Logger.info(`deviceType` + JSON.stringify(deviceType)); if (deviceType === 'default') { this.isDefault = true; } else { this.isDefault = false; } } catch (e) { Logger.info(`getSync unexpected...
AST#method_declaration#Left async getDeviceType AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left deviceType = AST#expression#Left AST#...
async getDeviceType(){ try { let deviceType = deviceInfo.deviceType; Logger.info(`deviceType` + JSON.stringify(deviceType)); if (deviceType === 'default') { this.isDefault = true; } else { this.isDefault = false; } } catch (e) { Logger.info(`getSync unexpected...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Tools/FlipClock/entry/src/main/ets/common/AlarmClock.ets#L62-L74
277703cb1bc8dfeee6c08b3db586c4f10097087c
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/BoyerMoore.ets
arkts
findAllMatches
在文本中查找模式串的所有出现位置 @param text 文本字符串 @param pattern 模式串 @returns 所有匹配位置的数组
static findAllMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const badCharTable: Map<string, number> = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable: number[] = BoyerMoore.buildGoodSu...
AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static findAllMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const badCharTable: Map<string, number> = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable: number[] = BoyerMoore.buildGoodSu...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BoyerMoore.ets#L12-L43
717cae91b448ad6b2f55ab2f8735a218e7f3ceae
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
leftThumbUpdate
更新左边滑块位置
leftThumbUpdate(deltaX: number) { let deltaPx = deltaX; // 左边距 if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) { deltaPx = this.leftPadding - this.leftThumbRect[0]; } // 右边距 if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - thi...
AST#method_declaration#Left leftThumbUpdate AST#parameter_list#Left ( AST#parameter#Left deltaX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#L...
leftThumbUpdate(deltaX: number) { let deltaPx = deltaX; if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) { deltaPx = this.leftPadding - this.leftThumbRect[0]; } if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - this.leftRightP...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets#L324-L353
d2f0fab62bee82f42f1de6d2b4a9f365b3cbf30d
gitee
DEMON-coding/HarmonyOs-Clock-Demo.git
f3c71a3d5ac478d463dfed068b89582104d2f9f6
entry/src/main/ets/common/utils/NotificationUtil.ets
arkts
请求打开通知权限
export function requestNotificationPermission(context: common.UIAbilityContext) { notificationManager.requestEnableNotification(context).then(() => { console.info('通知权限已开启'); }).catch((err: Error) => { console.error('开启通知权限失败: ' + JSON.stringify(err)); }); }
AST#export_declaration#Left export AST#function_declaration#Left function requestNotificationPermission AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotat...
export function requestNotificationPermission(context: common.UIAbilityContext) { notificationManager.requestEnableNotification(context).then(() => { console.info('通知权限已开启'); }).catch((err: Error) => { console.error('开启通知权限失败: ' + JSON.stringify(err)); }); }
https://github.com/DEMON-coding/HarmonyOs-Clock-Demo.git/blob/f3c71a3d5ac478d463dfed068b89582104d2f9f6/entry/src/main/ets/common/utils/NotificationUtil.ets#L8-L14
bccb253bc3076b44d83e0d87db02bf6f6d709962
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/Toast.ets
arkts
showCustomDialog
显示自定义底部弹窗 @param builder - 自定义弹窗内容构建器,需使用`@Builder`修饰的函数 @param autoCancel: true 允许用户点击空白处关闭Dialog @remarks - 弹窗默认从屏幕底部弹出 - 自动处理软键盘冲突(避让模式) - 错误会通过console.error输出 @example ```typescript @Builder function MyDialog() { Column() { Text("自定义内容") } } showCustomDialog(()=>{this.MyDialog()}); ```
static showCustomDialog(builder: CustomBuilder, autoCancel: boolean = true, isBgTransparent: boolean = false, onDisappear?: ()=>void ): void { promptAction.openCustomDialog({ builder: builder, // 传入自定义UI构建器 isModal:true, autoCancel: autoCancel, showInSubWindow:false, alignment: Dialog...
AST#method_declaration#Left static showCustomDialog AST#parameter_list#Left ( AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left autoCancel : AST#type_annotation#Left AST#primary_type#Left bo...
static showCustomDialog(builder: CustomBuilder, autoCancel: boolean = true, isBgTransparent: boolean = false, onDisappear?: ()=>void ): void { promptAction.openCustomDialog({ builder: builder, isModal:true, autoCancel: autoCancel, showInSubWindow:false, alignment: DialogAlignment.Cen...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/Toast.ets#L176-L199
d3523286fae8877cbe058d168f447a6d6c036a41
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/DFXStateManagement/src/main/ets/view/DFXStateBeforeOptimization.ets
arkts
uiStyle的属性被多个组件使用
build() { Column() { // 使用状态变量的组件 SpecialImage({ specialImageUiStyle: this.uiStyle }) Stack() { Column() { Image($r('app.media.icon')) .opacity($r('app.float.icon_opacity')) .scale({ x: this.uiStyle.scaleX, y: this...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 使用状态变量的组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpecialImage ( AST#component_parameters#Le...
build() { Column() { SpecialImage({ specialImageUiStyle: this.uiStyle }) Stack() { Column() { Image($r('app.media.icon')) .opacity($r('app.float.icon_opacity')) .scale({ x: this.uiStyle.scaleX, y: this.uiStyle.sca...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/DFXStateManagement/src/main/ets/view/DFXStateBeforeOptimization.ets#L72-L147
b4d17d840ce05f404ed4298a43cd27102e66f472
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets
arkts
toEntryAbilitySecond
Navigate to the Second Page of EntryAbility.
toEntryAbilitySecond() { router.pushUrl({ url: 'pages/Second', params: { src: textMessage, count: CommonConstants.NUM_VALUES[0] } }); }
AST#method_declaration#Left toEntryAbilitySecond AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#m...
toEntryAbilitySecond() { router.pushUrl({ url: 'pages/Second', params: { src: textMessage, count: CommonConstants.NUM_VALUES[0] } }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets#L36-L44
d0c90cd919d12e82c4bc8d6fcad548b319b1e159
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/ReminderService.ets
arkts
deleteReminder
删除提醒。 @param reminderId number 提醒的 ID
public deleteReminder(reminderId: number) { reminderAgent.cancelReminder(reminderId); }
AST#method_declaration#Left public deleteReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left...
public deleteReminder(reminderId: number) { reminderAgent.cancelReminder(reminderId); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/ReminderService.ets#L43-L45
f8991d8e60a859df94a2116478eb06cac0cff86a
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
getTaskStats
获取任务统计信息
getTaskStats(): TaskStats { const total = this.tasks.length; const completed = this.getCompletedTasks().length; const pending = this.getPendingTasks().length; const overdue = this.getOverdueTasks().length; const todayTasks = this.getTodayTasks(); const todayCompleted = todayTasks.filter(task => ...
AST#method_declaration#Left getTaskStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left total =...
getTaskStats(): TaskStats { const total = this.tasks.length; const completed = this.getCompletedTasks().length; const pending = this.getPendingTasks().length; const overdue = this.getOverdueTasks().length; const todayTasks = this.getTodayTasks(); const todayCompleted = todayTasks.filter(task => ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L491-L515
235ce0090cdbead008d3b17933dc2e534123d13e
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/alias/alias_001_T.ets
arkts
Introduction 别名
export function alias_001_T(taint_src : string) { let a = new A(); let b = a; b.data = taint_src; taint.Sink(a.data); }
AST#export_declaration#Left export AST#function_declaration#Left function alias_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ...
export function alias_001_T(taint_src : string) { let a = new A(); let b = a; b.data = taint_src; taint.Sink(a.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/alias/alias_001_T.ets#L6-L12
0157fe25d90abe9b3aa7c47fedb72d6157b2a06b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
3D颜色接口
export interface Color3D { r: number; g: number; b: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Color3D AST#object_type#Left { AST#type_member#Left r : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left g : AST#type_annotation#Left AST#primary...
export interface Color3D { r: number; g: number; b: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L88-L92
84a8b2388bb2e4defe2f63fc4d37ae80eac06148
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
getSm4EncryptProperties
Sm4加密密钥属性信息
function getSm4EncryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, ...
AST#function_declaration#Left function getSm4EncryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri...
function getSm4EncryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L68-L95
34773698b8ace6d848b155553d59b78c0b6402b7
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
Event Listening. @interface WatchEvent @syscap SystemCapability.FileManagement.File.FileIO @since 20
export interface WatchEvent { /** * File name. * * @type { string } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ readonly fileName: string; /** * Event happened. * * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File...
AST#export_declaration#Left export AST#interface_declaration#Left interface WatchEvent AST#object_type#Left { /** * File name. * * @type { string } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left readonly AST#ERROR#Left fileName AST#ERROR#Right ...
export interface WatchEvent { readonly fileName: string; readonly event: number; readonly cookie: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4176-L4206
aa725bd6f0a3727ea2bda23cd0caddfa6d39a01f
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/ime/text/Key/KeyCode.ets
arkts
,
export const SPACE = 32;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SPACE = AST#expression#Left 32 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const SPACE = 32;
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/text/Key/KeyCode.ets#L16-L16
5e3db6b4457faf502dde8b084609c70691367c3a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
reset
重置数据
private reset() { this.show = !this.show; this.showCity = false; this.showArea = false; this.selectData = new cascadeCity(); this.currentList = new Array(); this.selectIndex = 0; this.currentList = this.getProvinceData(); }
AST#method_declaration#Left private reset 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 . show AST#member_expression#Right = A...
private reset() { this.show = !this.show; this.showCity = false; this.showArea = false; this.selectData = new cascadeCity(); this.currentList = new Array(); this.selectIndex = 0; this.currentList = this.getProvinceData(); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L134-L142
4ee1defa8aafa319675642fd76ed7825c8b7db0f
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
buildConfirmDialog
构建确认弹窗
@Builder buildConfirmDialog() { Column() { Column() { // 顶部装饰 Row() { Text('✨') .fontSize(24) } .width(60) .height(60) .backgroundColor('#E8F4FD') .borderRadius(30) .justifyContent(FlexAlign.Center) .margin({ botto...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildConfirmDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_...
@Builder buildConfirmDialog() { Column() { Column() { Row() { Text('✨') .fontSize(24) } .width(60) .height(60) .backgroundColor('#E8F4FD') .borderRadius(30) .justifyContent(FlexAlign.Center) .margin({ bottom: 20 }...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L960-L1060
a6b521a92227c9dfe4b03cfabb3ab860b2867495
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/NavAttributeModifier.ets
arkts
NavWidthRangeAttrModifier
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 NavWidthRangeAttrModifier implements AttributeModifier<NavigationAttribute> { isApplicationSet: boolean = false; minHomeWidth: Percentage = '50%'; maxHomeWidth: Percentage = '50%'; applyNormalAttribute(instance: NavigationAttribute): void { if (this.isApplicationSet) { instance...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class NavWidthRangeAttrModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NavigationAttribute AST#primary_type#Right...
@Observed export class NavWidthRangeAttrModifier implements AttributeModifier<NavigationAttribute> { isApplicationSet: boolean = false; minHomeWidth: Percentage = '50%'; maxHomeWidth: Percentage = '50%'; applyNormalAttribute(instance: NavigationAttribute): void { if (this.isApplicationSet) { instance...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/NavAttributeModifier.ets#L16-L27
93129515682ed0be420092a701b92272fcaca83a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/ByteCodeCache.ets
arkts
aboutToAppear
[Start about_to_appear]
aboutToAppear(): void { try { webview.WebviewController.customizeSchemes([this.scheme1]) } catch (error) { let e: business_error.BusinessError = error as business_error.BusinessError; console.error(`ErrorCode: ${e.code}, Message: ${e.message}`); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST...
aboutToAppear(): void { try { webview.WebviewController.customizeSchemes([this.scheme1]) } catch (error) { let e: business_error.BusinessError = error as business_error.BusinessError; console.error(`ErrorCode: ${e.code}, Message: ${e.message}`); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/ByteCodeCache.ets#L14-L21
de03bf9754f9e60ba193d5018e6b62639d65dbf0
gitee
Duke_Bit/ElfRefresh
56faf5431c1643ec5ae227dc854a31b391778b2c
library/src/main/ets/model/ElfRefreshHeader.ets
arkts
ElfRefreshHeader
@author duke @description 下拉刷新控制器
@ObservedV2 export class ElfRefreshHeader { /** * 最大位移量 */ maxTranslate: number /** * 容器高度 */ @Trace height: number /** * 当前状态 */ @Trace state: RefreshState /** * 下拉过程中的百分比 */ @Trace percent: number /** * 下拉过程中的位移量 */ @Trace offset: number /** * 内部API请勿外部调...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class ElfRefreshHeader AST#ERROR#Left { /** * 最大位移量 */ AST#property_declaration#Left maxTranslate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right /** * 容器高度 ...
@ObservedV2 export class ElfRefreshHeader { maxTranslate: number @Trace height: number @Trace state: RefreshState @Trace percent: number @Trace offset: number setOffset(offset: number) { this.offset = offset if (this.height != 0) { this.percent = this.offset / this.h...
https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/library/src/main/ets/model/ElfRefreshHeader.ets#L7-L44
ebf832db971d98fa6ece71d4af09a3433fea768f
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/SettingsStorage.ets
arkts
清除所有设置(恢复默认)
export async function resetAllSettings(): Promise<void> { const settings = getSettingsInstance(); await settings.set("defaultSiteT", false); await settings.set("vibrationON", true); await settings.set("holdCheckON", true); await settings.set("buttonPositionRIGHT", false); await settings.set("the...
AST#export_declaration#Left export AST#function_declaration#Left async function resetAllSettings 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_t...
export async function resetAllSettings(): Promise<void> { const settings = getSettingsInstance(); await settings.set("defaultSiteT", false); await settings.set("vibrationON", true); await settings.set("holdCheckON", true); await settings.set("buttonPositionRIGHT", false); await settings.set("the...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L95-L103
edb2ddfc60fdfd60c3d37832f35649aec6a9a29d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
deepCopy
深度拷贝 @param obj 被拷贝对象 @returns
static deepCopy<T>(obj: T): T { return ObjectUtils.deepCopy<T>(obj); }
AST#method_declaration#Left static deepCopy AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right )...
static deepCopy<T>(obj: T): T { return ObjectUtils.deepCopy<T>(obj); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L116-L118
2b29fc6e041c68b4bc15032e475c2e817715146d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
消息反应接口
export interface MessageReaction { emoji: string; count: number; users: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MessageReaction AST#object_type#Left { AST#type_member#Left emoji : 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 count : AST#type_annotation#...
export interface MessageReaction { emoji: string; count: number; users: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L80-L84
65d23b9091d20b5b1b9997e8537c524e4fc8e367
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/SubscriptionManager.ets
arkts
deleteSubscription
删除订阅
deleteSubscription(id: string): boolean { const result = this.subscriptions.delete(id) if (result) { this.saveSubscriptions() console.info('✅ 删除订阅成功:', id) } return result }
AST#method_declaration#Left deleteSubscription AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type...
deleteSubscription(id: string): boolean { const result = this.subscriptions.delete(id) if (result) { this.saveSubscriptions() console.info('✅ 删除订阅成功:', id) } return result }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L71-L78
e0e80dcdb62d0c04536afe32f6507b5f63fb61ce
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
getRelationName
以下是各种个性化替换的辅助方法
private getRelationName(contact: Contact): string { const prefix = this.getRelationText(contact.relation); return `${prefix}${contact.name}`; }
AST#method_declaration#Left private getRelationName AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
private getRelationName(contact: Contact): string { const prefix = this.getRelationText(contact.relation); return `${prefix}${contact.name}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L583-L586
9ab88ab2bed549c8aafb83545c74e9f64dc90ae4
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets
arkts
AI正常返回的信息
export class ChatResponse { public choices: Array<Choice> = new Array() public object: string = "" public usage: Usage = new Usage(0, 0, 0) public created: number = 0 public system_fingerprint: string = "" public model: string = "" public id: string = "" constructor
AST#export_declaration#Left export AST#ERROR#Left class ChatResponse { AST#property_declaration#Left public choices : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Choice AST#primary_type#Right AST#type_annotation#Righ...
export class ChatResponse { public choices: Array<Choice> = new Array() public object: string = "" public usage: Usage = new Usage(0, 0, 0) public created: number = 0 public system_fingerprint: string = "" public model: string = "" public id: string = "" constructor
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets#L49-L58
67b0af9537d1f045fb494b7f9a2d9c5673614075
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/world.ets
arkts
calcPerStepVal
计算一次挖掘的步长值
function calcPerStepVal(world: WORLD): number { /* * 计算一次挖掘的步长: 用户等级 + 地图级别修正 + 用户幸运修正 + 当前矿坑深度修正 + * */ // 基础进度 const base = utils.getRandomInt(90, 100) / 100 // 等级 修正 const level = 0 // 随机修正 const random = utils.getRandomInt(1,3) / 10 // 地图修正 const mapIndex = 0 // 幸运修正 const randomInt = ut...
AST#function_declaration#Left function calcPerStepVal AST#parameter_list#Left ( AST#parameter#Left world : AST#type_annotation#Left AST#primary_type#Left WORLD AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
function calcPerStepVal(world: WORLD): number { const base = utils.getRandomInt(90, 100) / 100 const level = 0 const random = utils.getRandomInt(1,3) / 10 const mapIndex = 0 const randomInt = utils.getRandomInt(0, 100) const luck = randomInt < world.player.attr.luck ? utils.getRandomInt(0,...
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L91-L114
a32fd9a0f7a601172db5c6d9af30333700e3594c
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
concat
视频拼接
public static concat(inputFiles: string[], output: string): string[] { const cmd: string[] = ['ffmpeg', '-c:v', FFmpegFactory.HW_CODEC]; for (let i = 0; i < inputFiles.length; i++) { cmd.push('-i', inputFiles[i]); } let filterInputs = ''; for (let i = 0; i < inputFiles.length; i++) { f...
AST#method_declaration#Left public static concat AST#parameter_list#Left ( AST#parameter#Left inputFiles : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annota...
public static concat(inputFiles: string[], output: string): string[] { const cmd: string[] = ['ffmpeg', '-c:v', FFmpegFactory.HW_CODEC]; for (let i = 0; i < inputFiles.length; i++) { cmd.push('-i', inputFiles[i]); } let filterInputs = ''; for (let i = 0; i < inputFiles.length; i++) { f...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L172-L193
a325263a96259efefccf78389c5934dd9ebafb6c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdCardUtil.ets
arkts
getProvinceCodeByIdCard
根据身份编号获取户籍省份编码,只支持15或18位身份证号码 @param idCard 身份编码 @return 省份编码
static getProvinceCodeByIdCard(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } let len = idCard.length; if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) { let province = IdCardUtil.PROVINCE_CODES.get(idCard....
AST#method_declaration#Left static getProvinceCodeByIdCard AST#parameter_list#Left ( AST#parameter#Left idCard : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
static getProvinceCodeByIdCard(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } let len = idCard.length; if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) { let province = IdCardUtil.PROVINCE_CODES.get(idCard....
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L235-L249
965e5788cb4400ba8acf26952a0c2b42cdd3334d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
toEntity
将领域模型转换为数据库实体 @param {Cart} cart 购物车领域模型 @returns {CartEntity} 数据库实体
private toEntity(cart: Cart): CartEntity { const entity: CartEntity = new CartEntity(); entity.goodsId = cart.goodsId; entity.goodsName = cart.goodsName; entity.goodsMainPic = cart.goodsMainPic; entity.specJson = JSON.stringify(cart.spec ?? []); return entity; }
AST#method_declaration#Left private toEntity AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CartEntity AST#primary_typ...
private toEntity(cart: Cart): CartEntity { const entity: CartEntity = new CartEntity(); entity.goodsId = cart.goodsId; entity.goodsName = cart.goodsName; entity.goodsMainPic = cart.goodsMainPic; entity.specJson = JSON.stringify(cart.spec ?? []); return entity; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L166-L173
3a2de14874b6d96cc97576f3bf0d6b2bbdef2354
github
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
getWeatherByLocation
根据位置获取天气
private async getWeatherByLocation(latitude: number, longitude: number) { try { let httpRequest = http.createHttp(); let response = await httpRequest.request(Config.API.WEATHER_BY_LOCATION, { method: http.RequestMethod.POST, extraData: JSON.stringify({ latitude: latitude, ...
AST#method_declaration#Left private async getWeatherByLocation AST#parameter_list#Left ( AST#parameter#Left latitude : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left longitude : AST#type_annotation#Left AST#primary_type#Lef...
private async getWeatherByLocation(latitude: number, longitude: number) { try { let httpRequest = http.createHttp(); let response = await httpRequest.request(Config.API.WEATHER_BY_LOCATION, { method: http.RequestMethod.POST, extraData: JSON.stringify({ latitude: latitude, ...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L227-L260
400d47ce64998f04183f263ed89b6ae115528bb5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/Book.ets
arkts
CigenData.ts
export class CigenData { cigenId : number | null = null cigenName : string | null = null textDb : string | null = null static equals(lhs: CigenData, rhs: CigenData): boolean { return lhs.cigenId === rhs.cigenId } constructor(json?: Record<string, Object>) { if (json) { this.cigenId ...
AST#export_declaration#Left export AST#class_declaration#Left class CigenData AST#class_body#Left { AST#property_declaration#Left cigenId AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#R...
export class CigenData { cigenId : number | null = null cigenName : string | null = null textDb : string | null = null static equals(lhs: CigenData, rhs: CigenData): boolean { return lhs.cigenId === rhs.cigenId } constructor(json?: Record<string, Object>) { if (json) { this.cigenId ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/Book.ets#L74-L96
206bc48de542d55940a4e7765e76852822b413bc
github
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/common/bean/FarmBean.ets
arkts
JSON_to
给一个JSON对象,返回一个FarmBean
static JSON_to(message):FarmBean{ var temp:FarmBean = new FarmBean( message.fieldId, message.name, message.temperature, message.humidity, message.co2, message.lumination, message.soilHumidity, message.sensor_IP, message.sensor_port, message. NPK, message.PH, messa...
AST#method_declaration#Left static JSON_to AST#parameter_list#Left ( AST#parameter#Left message AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FarmBean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
static JSON_to(message):FarmBean{ var temp:FarmBean = new FarmBean( message.fieldId, message.name, message.temperature, message.humidity, message.co2, message.lumination, message.soilHumidity, message.sensor_IP, message.sensor_port, message. NPK, message.PH, messa...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/bean/FarmBean.ets#L81-L97
9fa90ef7c1a677fabd0570feceb54cb71af563f1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/toast/ToastUtils.ets
arkts
showBreakAll
显示强制截断换行 Toast @param {string | ResourceStr} message - 提示内容 @returns {void} 无返回值
static showBreakAll(message: string | ResourceStr): void { IBestToast.show({ wordBreak: "break-all", message: message }); }
AST#method_declaration#Left static showBreakAll AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#...
static showBreakAll(message: string | ResourceStr): void { IBestToast.show({ wordBreak: "break-all", message: message }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L119-L124
44d9edeba12499b6f0626b33bedc436ff37268c9
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets
arkts
deleteData
4-删除数据
deleteData(key: string) { let promise = dataPreferences.delete(key); promise.then(() => { this.showToastMessage($r('app.string.data_delete_msg')); console.info("成功删除"+key+"值对应数据"); }).catch((err: BusinessError) => { console.error("删除"+key+"值对应数据失败 =" + err.code + ", message =" + err.messag...
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let ...
deleteData(key: string) { let promise = dataPreferences.delete(key); promise.then(() => { this.showToastMessage($r('app.string.data_delete_msg')); console.info("成功删除"+key+"值对应数据"); }).catch((err: BusinessError) => { console.error("删除"+key+"值对应数据失败 =" + err.code + ", message =" + err.messag...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets#L82-L90
5dbe075599148ce09a9f48fdcf3d7a8e9e73c78e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ArrayUtil.ets
arkts
TODO 集合工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ArrayUtil { /** * 判断集合是否为非空集合。 * @param array * @returns */ static isNotEmpty<T>(array: T[]): boolean { return undefined !== array && null !== array && array.length !== 0; } /** * 判断集合是否为空集合。 * @param array * @returns */ static isEmpty<T>(array: T[]): boolean { ...
AST#export_declaration#Left export AST#class_declaration#Left class ArrayUtil AST#class_body#Left { /** * 判断集合是否为非空集合。 * @param array * @returns */ AST#method_declaration#Left static isNotEmpty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#para...
export class ArrayUtil { static isNotEmpty<T>(array: T[]): boolean { return undefined !== array && null !== array && array.length !== 0; } static isEmpty<T>(array: T[]): boolean { return array === undefined || array === null || array.length === 0; } static removeEmpty(arr: string[]): st...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L24-L188
4117036527470d57797e3e080b08c4227cac7814
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestDownload.ets
arkts
downloadFile
失败回调 下载文件
async downloadFile(folder: string, url: string, callback: (progress: number, isSuccess: boolean, localPath: string) => void) { logger.info(TAG, 'downloadFile,url:' + url); // Found an ongoing download task, prompted and returned. let tasks = await request.agent.search({ state: request.agent.State....
AST#method_declaration#Left async downloadFile AST#parameter_list#Left ( AST#parameter#Left folder : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
async downloadFile(folder: string, url: string, callback: (progress: number, isSuccess: boolean, localPath: string) => void) { logger.info(TAG, 'downloadFile,url:' + url); let tasks = await request.agent.search({ state: request.agent.State.RUNNING, action: request.agent.Action.DOWNLOAD, ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestDownload.ets#L41-L133
8ee1256bd1c616237e7a63e91b8c7e2dd1ff0208
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
arkts
initUIConfig
/ 初始化Loading(在全局入口 page 处挂载)
public static initUIConfig(context: UIContext) { JhProgressHUD.initXTPromptHUDConfig(context) }
AST#method_declaration#Left public static initUIConfig AST#parameter_list#Left ( AST#parameter#Left context : 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#builder_function_body#Left { AST#expression_statement...
public static initUIConfig(context: UIContext) { JhProgressHUD.initXTPromptHUDConfig(context) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L34-L36
b6c9e6814d776fa2ea31eb66d532cfedcbd2af6f
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
saveCart
保存购物车
private async saveCart(): Promise<void> { try { await StorageManager.setString('cart', JSON.stringify(this.cartItems)); this.notifyListeners(); } catch (error) { Logger.error('CartService', `Failed to save cart: ${String(error)}`); } }
AST#method_declaration#Left private async saveCart 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...
private async saveCart(): Promise<void> { try { await StorageManager.setString('cart', JSON.stringify(this.cartItems)); this.notifyListeners(); } catch (error) { Logger.error('CartService', `Failed to save cart: ${String(error)}`); } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L64-L71
5e92b6f738dc0555a4daaa47a84852d5dcf6fe58
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/TreadUtil.ets
arkts
根据参数由TaskPool处理pixelMap @param pixelMap 源数据 @param lastAdjustData 之前的饱和度值 @param currentAdjustData 将要调整到饱和度值 @param taskNum 开启的线程任务数 @param isParamsByTransfer 参数是否通过传递方式传参 @param callback 线程处理结束后的回调 @returns
export async function pixelMapProcessByTaskPool(pixelMap: image.PixelMap, lastAdjustData: number, currentAdjustData: number, taskNum: number, isParamsByTransfer: boolean, callback?: Callback<ArrayBuffer>): Promise<void> { let arrayBuffer: ArrayBuffer = await convertPixelMapToArrayBuffer(pixelMap); let taskPoolGroup...
AST#export_declaration#Left export AST#function_declaration#Left async function pixelMapProcessByTaskPool AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Ri...
export async function pixelMapProcessByTaskPool(pixelMap: image.PixelMap, lastAdjustData: number, currentAdjustData: number, taskNum: number, isParamsByTransfer: boolean, callback?: Callback<ArrayBuffer>): Promise<void> { let arrayBuffer: ArrayBuffer = await convertPixelMapToArrayBuffer(pixelMap); let taskPoolGroup...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/TreadUtil.ets#L32-L49
6dda371602954037917c595f9c8f9bd450b11da6
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets
arkts
这个是 Worker 使用,之所以要用两个,是因为 Sendable 在有些类里面不能成为成员变量
export class AppData { appIndex: number = -1; appId: string = ''; jsAppVersion: string = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class AppData AST#class_body#Left { AST#property_declaration#Left appIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#ex...
export class AppData { appIndex: number = -1; appId: string = ''; jsAppVersion: string = ''; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets#L15-L19
2c6d0d7fa478968d5af1e8ad7b5d81a66437f5d7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets
arkts
setVoiceScene
设置通话场景 AudioVolumeGroupManager.setAudioScene用于调整音频场景,属于系统接口。 目前版本(4.0.7.1之后)已实现自动切换AudioScene。 对于非系统应用,若使用AudioRenderer播放VOICE_CALL类型的音频, 则调用start函数时会自动切换至AUDIO_SCENE_VOICE_CHAT, 播放结束后自动切换回默认场景,无需调用setAudioScene。
async setVoiceScene(calling: boolean): Promise<void> { Logger.info(TAG,`setVoiceScene ${calling}`); if (!this.mAudioManager) { return; } try { if (calling) { await this.mAudioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); Logger.info(TAG,`setVoiceScene AUDIO_...
AST#method_declaration#Left async setVoiceScene AST#parameter_list#Left ( AST#parameter#Left calling : 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 AST#generic_type#...
async setVoiceScene(calling: boolean): Promise<void> { Logger.info(TAG,`setVoiceScene ${calling}`); if (!this.mAudioManager) { return; } try { if (calling) { await this.mAudioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); Logger.info(TAG,`setVoiceScene AUDIO_...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets#L63-L80
34d22d54d37c7779bc1214cf55f9ba3a5a3e586c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SimpleCalculator/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Full percent. */ static readonly FULL_PERCENT: string = '100%'; /** * Operator Collection. */ static readonly OPERATORS: string = '+-×÷'; /** * Operators with high precedence. */ static readonly OPERATORS_PRIORITY: string = '×÷'; /** * Addition....
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full percent. */ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export class CommonConstants { static readonly FULL_PERCENT: string = '100%'; static readonly OPERATORS: string = '+-×÷'; static readonly OPERATORS_PRIORITY: string = '×÷'; static readonly ADD: string = '+'; static readonly MIN: string = '-'; static readonly MUL: string = '×'; s...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SimpleCalculator/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L109
27f82597fabc478abe9e58e5f6ac60bb5c7902f7
gitee
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/pages/DustMonitoringPage.ets
arkts
fetchData
获取数据的方法
async fetchData() { this.isLoading = true; try { // 调用静态方法获取灰尘监测数据 this.dustList = await DustService.getDustList(); } catch (error) { console.error('获取灰尘监测数据失败:', error); // 错误提示 promptAction.showToast({ message: '获取灰尘监测数据失败,请检查网络连接', duration: 2000 }); ...
AST#method_declaration#Left async fetchData 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 . isLoading AST#member_...
async fetchData() { this.isLoading = true; try { this.dustList = await DustService.getDustList(); } catch (error) { console.error('获取灰尘监测数据失败:', error); promptAction.showToast({ message: '获取灰尘监测数据失败,请检查网络连接', duration: 2000 }); } finally { thi...
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DustMonitoringPage.ets#L17-L33
f7b476eff3c983870654d37b42243cbb3aae64f6
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/AchievementManager.ets
arkts
initializeDefaultAchievements
初始化默认成就到数据库
async initializeDefaultAchievements(): Promise<void> { try { const existingAchievements = await this.databaseManager.getAllAchievements() if (existingAchievements.length === 0) { const defaultAchievements = this.getDefaultAchievements() for (const achievement of defaultAchievements) { ...
AST#method_declaration#Left async initializeDefaultAchievements 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...
async initializeDefaultAchievements(): Promise<void> { try { const existingAchievements = await this.databaseManager.getAllAchievements() if (existingAchievements.length === 0) { const defaultAchievements = this.getDefaultAchievements() for (const achievement of defaultAchievements) { ...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/AchievementManager.ets#L20-L33
f6c02ceb0ed604ec68f3f04905567b926935c364
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/component/CustomDialog.ets
arkts
promptPopup
弹窗函数
promptPopup() { Logger.info(`promptPopup start`); try { promptAction.showToast({ message: $r('app.string.authorization_reminder'), // 弹窗延迟时间 duration: 2000 }); } catch (error) { let message = (error as BusinessError).message; let code = (error as BusinessError...
AST#method_declaration#Left promptPopup 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 Logger AST#expression#Right . info AST#...
promptPopup() { Logger.info(`promptPopup start`); try { promptAction.showToast({ message: $r('app.string.authorization_reminder'), duration: 2000 }); } catch (error) { let message = (error as BusinessError).message; let code = (error as BusinessError).code; ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/component/CustomDialog.ets#L38-L51
9e6836a1ae1440bbd35af07afb009e2f48f3ae0c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/flexibleCapability/FlexibleCapability2.ets
arkts
slider
Bottom slider - resize container by dragging the slider control.
@Builder slider() { Slider({ value: this.rate * 100, min: 55, max: 80 }) .blockColor(Color.White) .width('60%') .onChange((value: number) => { this.rate = value / 100; }) .position({ x: '20%', y: '80%' }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right slider AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Slider ( AST#component_parameters#Left { AST#component_parameter#Le...
@Builder slider() { Slider({ value: this.rate * 100, min: 55, max: 80 }) .blockColor(Color.White) .width('60%') .onChange((value: number) => { this.rate = value / 100; }) .position({ x: '20%', y: '80%' }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/flexibleCapability/FlexibleCapability2.ets#L23-L32
dbde637477c84a39747bf5f3db0f27adb576a97b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/MySetConstants.ets
arkts
Common constants for all features.
export default class MySetConstants { /** * 自动刷新 */ static readonly SET_REFRESH: string = 'setRefresh'; /** * 自动跳转最近阅读 */ static readonly SET_JUMP: string = 'setJump'; /** * 默认启用替换净化 */ static readonly SET_REPLACE: string = 'setReplace'; /** *返回时提示放入书架 */ static readonly SET_T...
AST#export_declaration#Left export default AST#class_declaration#Left class MySetConstants AST#class_body#Left { /** * 自动刷新 */ AST#property_declaration#Left static readonly SET_REFRESH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 's...
export default class MySetConstants { static readonly SET_REFRESH: string = 'setRefresh'; static readonly SET_JUMP: string = 'setJump'; static readonly SET_REPLACE: string = 'setReplace'; static readonly SET_TIP: string = 'setTip'; static readonly SET_IMG_ANTI: string = 'setImgAnti'; ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/MySetConstants.ets#L19-L74
5f93516d4d51b2522aefaf1084c117d4c8547494
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets
arkts
copySelFile2Sandbox
复制选中文件到沙箱
copySelFile2Sandbox(selectFile: string): boolean { let context = getContext(this) let segments = selectFile.split('/') //文件名称 let fileName = segments[segments.length-1] //计划复制到的目标路径 let realUri = context.cacheDir + "/" + fileName //复制选择的文件到沙箱cache文件夹 try { let file = fs.openSync(se...
AST#method_declaration#Left copySelFile2Sandbox AST#parameter_list#Left ( AST#parameter#Left selectFile : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri...
copySelFile2Sandbox(selectFile: string): boolean { let context = getContext(this) let segments = selectFile.split('/') let fileName = segments[segments.length-1] let realUri = context.cacheDir + "/" + fileName try { let file = fs.openSync(selectFile); fs.copyFileSync(file....
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets#L175-L192
1daba02d33910eeb39fbb656694ce12253db1019
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisLineWidth
Sets the width of the border surrounding the chart in vp. @param width
public setAxisLineWidth(width: number): void { this.mAxisLineWidth = Utils.handleDataValues(width); }
AST#method_declaration#Left public setAxisLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
public setAxisLineWidth(width: number): void { this.mAxisLineWidth = Utils.handleDataValues(width); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L285-L287
dd653ce1c307f3ffa2ddefc0f3ee2387fb6d0328
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/CalendarPage.ets
arkts
loadUpcomingBirthdays
加载即将到来的生日
private async loadUpcomingBirthdays(): Promise<void> { try { this.upcomingBirthdays = await this.contactService.getUpcomingBirthdayContacts(30); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load upcoming birthdays: ${error}`); } }
AST#method_declaration#Left private async loadUpcomingBirthdays 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 loadUpcomingBirthdays(): Promise<void> { try { this.upcomingBirthdays = await this.contactService.getUpcomingBirthdayContacts(30); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load upcoming birthdays: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L83-L89
74000cd110adf48c4d2dae707b96b79a76a4d861
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets
arkts
getDayData
收取数据
async getDayData() { let httpRequest=http.createHttp(); let encodeduserId = encodeURIComponent(this.userId); // 编码中文 let encodedDate = encodeURIComponent(this.firstDayOfWeek); // 起始日期 let url = address.IP+`/getWeekPracticeInfo?userId=${encodeduserId}&startDate=${encodedDate}`; try { let respo...
AST#method_declaration#Left async getDayData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
async getDayData() { let httpRequest=http.createHttp(); let encodeduserId = encodeURIComponent(this.userId); let encodedDate = encodeURIComponent(this.firstDayOfWeek); let url = address.IP+`/getWeekPracticeInfo?userId=${encodeduserId}&startDate=${encodedDate}`; try { let response=await http...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L210-L248
9f2a7b0e4cdcf54ebeab4f5b3bbb25c2d1ebc5be
github
buqiuz/game-puzzle.git
605dc0fac0738466db308a8ba255b5e9094c52ac
entry/build/default/generated/profile/default/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const BUNDLE_NAME = 'ohos.samples.gamepuzzle';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'ohos.samples.gamepuzzle' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BUNDLE_NAME = 'ohos.samples.gamepuzzle';
https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
48fdfc60821c5c2a267e3abc706077864061d194
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RandomUtil.ets
arkts
getRandomNumber
生成指定范围内的随机数 @return 随机数
static getRandomNumber(min: number, max: number): number { return Math.floor(Math.random() * (max - min) + min); }
AST#method_declaration#Left static getRandomNumber AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
static getRandomNumber(min: number, max: number): number { return Math.floor(Math.random() * (max - min) + min); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RandomUtil.ets#L50-L52
844dfbe6fef0cf4b507c43065931bdb2f61d8836
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
stringToUint8Array
字符串转Uint8Array @param str 要转换的字符串 @returns Uint8Array
private stringToUint8Array(str: string): Uint8Array { // 方案1:推荐使用buffer.from(API 9+) return new Uint8Array(buffer.from(str, 'utf-8').buffer); // 方案2:TextEncoder标准方案(需处理缓冲区) // const encoder = new util.TextEncoder('utf-8'); // const arr = new Uint8Array(encoder.getEncodedLength(str)); // encoder...
AST#method_declaration#Left private stringToUint8Array 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_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#...
private stringToUint8Array(str: string): Uint8Array { return new Uint8Array(buffer.from(str, 'utf-8').buffer); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L130-L139
b2f78ef77f7809a27a4ee140d5c44f485272caf2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets
arkts
[Start module_load_directly]
export function initialize() { console.log('Module loaded!'); }
AST#export_declaration#Left export AST#function_declaration#Left function initialize 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...
export function initialize() { console.log('Module loaded!'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/module.ets#L17-L19
2782cd35962fa755c18ff30b21db3e1a31bc0ed3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
handleDateClick
处理日期点击事件
private async handleDateClick(week: number, dayOfWeek: number): Promise<void> { const dayNumber: number = this.getDayNumber(week, dayOfWeek); const currentDate = new Date(this.currentYear, this.currentMonth - 1, dayNumber); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[Debug] handleDateClick ...
AST#method_declaration#Left private async handleDateClick AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOfWeek : AST#type_annotation#Left AST#primary_type#Left number ...
private async handleDateClick(week: number, dayOfWeek: number): Promise<void> { const dayNumber: number = this.getDayNumber(week, dayOfWeek); const currentDate = new Date(this.currentYear, this.currentMonth - 1, dayNumber); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[Debug] handleDateClick ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4226-L4297
9eac3fe674aa0337c680b4b4fcba13a8ab47b2eb
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/AvatarComponent.ets
arkts
getEmotionColorBlend
根据情绪返回颜色叠加效果
private getEmotionColorBlend(): Color | string { if (this.emotion === 'angry') { return 'rgba(255, 45, 45, 0.2)'; // 红色叠加 } else if (this.emotion === 'sad') { return 'rgba(43, 76, 138, 0.15)'; // 蓝色叠加 } else if (this.emotion === 'happy' || this.emotion === 'excited') { return 'rgba(255, 14...
AST#method_declaration#Left private getEmotionColorBlend AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Color AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_s...
private getEmotionColorBlend(): Color | string { if (this.emotion === 'angry') { return 'rgba(255, 45, 45, 0.2)'; } else if (this.emotion === 'sad') { return 'rgba(43, 76, 138, 0.15)'; } else if (this.emotion === 'happy' || this.emotion === 'excited') { return 'rgba(255, 143, 177, 0.1)';...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/AvatarComponent.ets#L572-L581
33daf823db030a6c20a545f5223206f2a49688f7
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/cs/Index.ets
arkts
CsGraph
@file cs 模块统一导出 @author Joker.X
export { CsGraph } from "./src/main/ets/navigation/CsGraph";
AST#export_declaration#Left export { CsGraph } from "./src/main/ets/navigation/CsGraph" ; AST#export_declaration#Right
export { CsGraph } from "./src/main/ets/navigation/CsGraph";
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/cs/Index.ets#L6-L6
0a4054a35ae0b64121187012c1d0664d23e8ceb5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets
arkts
ImageCombination
功能描述:点击完成之后,将选定的用户头像进行拼接,最终合成一个图片进行渲染。 实现原理: 绘制组件 1)使用divideImage2Group函数分割选择的用户头像数据,生成二维数组,已达到群头像排列方式,并设置图片宽高 2)结合二位数组,嵌套2层ForEach组件实现纵向与横向的线性布局,绘制群头像 3)设置id与visibility属性,用于隐藏组件及后续的组件截图 @param {PersonData} imageArr - 已选择的联系人头像 @param {SnapShotModel | null} snapShotModel - 组件截图属性类
@Component export struct ImageCombination { // ---------------对外暴露变量----------------- // 已选择的联系人头像 imageArr: (ResourceStr | image.PixelMap)[] = []; // 组件截图属性类 snapShotModel: SnapShotModel | null = null; aboutToAppear(): void { if (!this.snapShotModel) { this.snapShotModel = new SnapShotModel(); ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageCombination AST#component_body#Left { // ---------------对外暴露变量----------------- // 已选择的联系人头像 AST#property_declaration#Left imageArr : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_an...
@Component export struct ImageCombination { imageArr: (ResourceStr | image.PixelMap)[] = []; snapShotModel: SnapShotModel | null = null; aboutToAppear(): void { if (!this.snapShotModel) { this.snapShotModel = new SnapShotModel(); } } build() { Column({ space: 2 }) { For...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets#L32-L61
d4d742294150b1b95133c36ed8dfff2e2e4766d2
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
getAuthToken
添加获取token的方法
private static getAuthToken(): string { return authToken; }
AST#method_declaration#Left private static getAuthToken AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left authTok...
private static getAuthToken(): string { return authToken; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L555-L557
a76da65d7b2bfcf73c443ef6cd6d16bb99ad8856
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets
arkts
VerticalAndHorizontalListComponent
listItem的宽度 功能描述: 本示例主要通过List组件绑定Scroller滚动控制器和LazyForEach数据懒加载来实现纵向横向列表联动。 推荐场景: 汽车参数对比,股票信息查看 核心组件: 1. List 2. Scroller 3. LazyForEach 实现步骤: 1. 顶部List0:存放列标题,车型,底部左侧List1:存放行标题,车辆参数信息,底部右侧List3:存放不同车型对应的不同参数信息,List3里每一行内容对应一个List,不同List绑定不同的Scroller对象。 2. List0和List3里每一行内容对应的List的滚动偏移量保持一致,实现横向列表联动。 3. List1和List...
@Component export struct VerticalAndHorizontalListComponent { private carType: string[] = ['车型1', '车型2', '车型3', '车型4', '车型5', '车型6', '车型7', '车型8']; // 顶部List内容,列标题 topListScroller: Scroller = new Scroller(); // 顶部列表(列标题)的滚动控制器 private bottomLeftListScroller: Scroller = new Scroller(); // 底部列表左侧(行标题)的滚动控制器 priva...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VerticalAndHorizontalListComponent AST#component_body#Left { AST#property_declaration#Left private carType : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#prima...
@Component export struct VerticalAndHorizontalListComponent { private carType: string[] = ['车型1', '车型2', '车型3', '车型4', '车型5', '车型6', '车型7', '车型8']; topListScroller: Scroller = new Scroller(); private bottomLeftListScroller: Scroller = new Scroller(); private bottomRightListScroller: Scroller = new Scroller()...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L41-L334
6956d5dcb2e927065a69a78a8a582bc11d8c4a07
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StatusBarUtils.ets
arkts
getStatusBarHeight
获取状态栏的高度,单位为px。 @returns
public static getStatusBarHeight(): number { let windowClass = AppUtils.getMainWindow(); let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); return avoidArea.topRect.height; }
AST#method_declaration#Left public static getStatusBarHeight 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_declarat...
public static getStatusBarHeight(): number { let windowClass = AppUtils.getMainWindow(); let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); return avoidArea.topRect.height; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StatusBarUtils.ets#L44-L48
b469d89a5627c6be898c53417dc9ba4f0c6e8fe5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
日志级别枚举
export enum LogLevel { DEBUG = 'debug', INFO = 'info', WARN = 'warn', ERROR = 'error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum LogLevel AST#enum_body#Left { AST#enum_member#Left DEBUG = AST#expression#Left 'debug' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INFO = AST#expression#Left 'info' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left W...
export enum LogLevel { DEBUG = 'debug', INFO = 'info', WARN = 'warn', ERROR = 'error' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L456-L461
7e168a696af0faadac1315248de065dde4ec84bb
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/PodcastDetailPage.ets
arkts
loadMore
加载更多单集
async loadMore() { if (this.isLoadingMore || !this.hasMore) { return; } this.isLoadingMore = true; // 模拟网络延迟,提升用户体验 setTimeout(() => { this.currentPage++; this.updateDisplayedEpisodes(); this.isLoadingMore = false; console.info(`[PodcastDetailPage] Loaded page ${this.c...
AST#method_declaration#Left async loadMore AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expres...
async loadMore() { if (this.isLoadingMore || !this.hasMore) { return; } this.isLoadingMore = true; setTimeout(() => { this.currentPage++; this.updateDisplayedEpisodes(); this.isLoadingMore = false; console.info(`[PodcastDetailPage] Loaded page ${this.currentPage}`); ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/PodcastDetailPage.ets#L107-L120
c5433effcc5cebb7ae450d0bb8d014f0ac1da262
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/launch/src/main/ets/view/SplashPage.ets
arkts
SplashPage
@file 启动页视图 @author Joker.X
@ComponentV2 export struct SplashPage { /** * 启动页 ViewModel */ @Local private vm: SplashViewModel = new SplashViewModel(); /** * 构建启动页 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: "启动页", viewModel: this.vm }) { this.SplashContent(); } } /** ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SplashPage AST#component_body#Left { /** * 启动页 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left SplashViewMo...
@ComponentV2 export struct SplashPage { @Local private vm: SplashViewModel = new SplashViewModel(); build() { AppNavDestination({ title: "启动页", viewModel: this.vm }) { this.SplashContent(); } } @Builder private SplashContent() { Text("启动页内容视图") } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/view/SplashPage.ets#L8-L37
5fc330da11ace9f0364e0e19032a8ed389ce8625
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/DataManager.ets
arkts
clearAllData
清除所有数据
async clearAllData(): Promise<boolean> { if (!this.preferences) { console.error('Preferences not initialized') return false } try { await this.preferences.clear() await this.preferences.flush() console.info('All data cleared') return true } catch (err) { consol...
AST#method_declaration#Left async clearAllData 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#type_...
async clearAllData(): Promise<boolean> { if (!this.preferences) { console.error('Preferences not initialized') return false } try { await this.preferences.clear() await this.preferences.flush() console.info('All data cleared') return true } catch (err) { consol...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L127-L142
32d616ddb1b0755c8df7db990b0d25736f91071b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/ColumnAttribute.ets
arkts
获取纵向居中 + 水平末尾的 Column 对齐修饰器 @returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器 @example Column() { Text("Hi"); }.attributeModifier(columnCenterEnd());
export function columnCenterEnd(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.End); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function columnCenterEnd AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribute...
export function columnCenterEnd(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.End); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L87-L94
4635258204a291bbc8d005781e7a78f7c94a9003
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardOne.ets
arkts
buildExampleContentPanel
构建例句内容区域
@Builder buildExampleContentPanel() { Column({ space: 5 }) { // 英文例句 WordClickableText({ text:this.word.exampleEn1 || '', highlightWords: this.getHilightTexts(), onWordClick:(word: string)=>{ this.onClickedText(word) } }) Stack(){ if (this...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildExampleContentPanel AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#comp...
@Builder buildExampleContentPanel() { Column({ space: 5 }) { WordClickableText({ text:this.word.exampleEn1 || '', highlightWords: this.getHilightTexts(), onWordClick:(word: string)=>{ this.onClickedText(word) } }) Stack(){ if (this.isHide...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L310-L359
45c40a198ce5250dfdcf8cc180a110a5dd87081c
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
getUrl
获取当前环境的URL
getUrl(env: string): string { switch (env) { case 'ANDROID_EMULATOR': return this.ANDROID_EMULATOR; case 'DEVICE': return this.DEVICE; case 'LOCAL': default: return this.LOCAL; }
AST#method_declaration#Left getUrl AST#parameter_list#Left ( AST#parameter#Left env : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t...
getUrl(env: string): string { switch (env) { case 'ANDROID_EMULATOR': return this.ANDROID_EMULATOR; case 'DEVICE': return this.DEVICE; case 'LOCAL': default: return this.LOCAL; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L50-L59
f596c2e8140a66607357ff60feba7d998a925918
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
sendNotification
发送基础通知(简化版本)
async sendNotification(title: string, content: string): Promise<boolean> { try { // 简化版本:只记录日志,实际通知功能需要真实的设备支持 hilog.info(0x0000, 'SimpleNotificationManager', 'Notification sent: %{public}s, content: %{public}s', title, content); return true; } catch (error) { hilog.error(0x0000, 'Simple...
AST#method_declaration#Left async sendNotification AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
async sendNotification(title: string, content: string): Promise<boolean> { try { hilog.info(0x0000, 'SimpleNotificationManager', 'Notification sent: %{public}s, content: %{public}s', title, content); return true; } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L75-L84
f52f1c331a7c93186f2dacf93eb57a5a299e4b02
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/subscription/SubscriptionInfo.ets
arkts
fromArray
从数组构建 SubscriptionInfo 列表 @param arr JSON数组 @returns SubscriptionInfo 列表
static fromArray(arr: Object[] | null): SubscriptionInfo[] { if (!arr) return []; return arr.map(o => new SubscriptionInfo(o as Record<string, Object>)); }
AST#method_declaration#Left static fromArray AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Object [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_...
static fromArray(arr: Object[] | null): SubscriptionInfo[] { if (!arr) return []; return arr.map(o => new SubscriptionInfo(o as Record<string, Object>)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/subscription/SubscriptionInfo.ets#L30-L33
6dc514c14bae805dabe171e903735d11824ea987
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
setCustomUserAgent
Set custom user agent. @param { string } userAgent - User custom agent information. @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. <br>2. Incorrect parameter types. @throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be a...
setCustomUserAgent(userAgent: string): void;
AST#method_declaration#Left setCustomUserAgent AST#parameter_list#Left ( AST#parameter#Left userAgent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_...
setCustomUserAgent(userAgent: string): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L381-L381
e40f9eab685739373eb382720922c5400e12ed3e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
showTimePickerDialog
显示自定义时间选择器对话框
private showTimePickerDialog(): void { this.showCustomTimeDialog = true; }
AST#method_declaration#Left private showTimePickerDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expressio...
private showTimePickerDialog(): void { this.showCustomTimeDialog = true; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6281-L6283
e5450c575be78106fdd66ef198590b2c2db009de
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
goToAndStop
控制动画画面停止在某一帧或某个时刻 @param value 帧号(值>=0)或时刻(ms) @param isFrame true按帧控制, false按时间控制, 缺省默认false @since 8 @design
goToAndStop(value: number, isFrame?: boolean) { this.animationItem?.goToAndStop(value, isFrame) }
AST#method_declaration#Left goToAndStop AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isFrame ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type...
goToAndStop(value: number, isFrame?: boolean) { this.animationItem?.goToAndStop(value, isFrame) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L198-L200
5bd78818689c440baed6265bb8cb7a98917929fd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/feedback/FeedbackNetworkDataSource.ets
arkts
@file 意见反馈数据源接口 @author Joker.X
export interface FeedbackNetworkDataSource { /** * 提交意见反馈 * @param params 反馈提交请求参数 * @returns 提交结果响应 */ submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>>; /** * 分页查询意见反馈列表 * @param params 分页请求参数 * @returns 反馈分页数据响应 */ getFeedbackPage(params: PageRequest): ...
AST#export_declaration#Left export AST#interface_declaration#Left interface FeedbackNetworkDataSource AST#object_type#Left { /** * 提交意见反馈 * @param params 反馈提交请求参数 * @returns 提交结果响应 */ AST#type_member#Left submitFeedback AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#prima...
export interface FeedbackNetworkDataSource { submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>>; getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>>; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/feedback/FeedbackNetworkDataSource.ets#L7-L21
8620ce7da345a3c55d57f26f4b897e60c848faf4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
generateId
静态方法:生成唯一ID
private static generateId(): string { return `contact_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
AST#method_declaration#Left private static generateId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#templ...
private static generateId(): string { return `contact_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L54-L56
6635782e705d044e542a8676479698a33c9f1818
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
clearCache
清除缓存
clearCache(): void { this.onlineLunarService.clearCache(); }
AST#method_declaration#Left clearCache AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le...
clearCache(): void { this.onlineLunarService.clearCache(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L486-L488
cc74ba2c84caa6209694f9b4307ef428754d0495
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceEvenly
纵向均分 + 水平居中
@ComponentV2 export struct ColumnSpaceEvenly { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceEvenly AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_...
@ComponentV2 export struct ColumnSpaceEvenly { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Paddi...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L545-L620
03e6e0d81dc941ae638ca49adc6fa2f7f4343268
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
DateGroupComponent
日期分组组件(一个大模块)
@Builder DateGroupComponent(date: string, bills: BillItem[]) { Column() { // 日期标题行 Row() { Text(this.formatDateDisplay(date)) .fontSize(13) .fontColor('#999999') Blank() Text(`支: ${this.calculateDayStats(bills).expense}`) .fontSize(12) .f...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DateGroupComponent AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left bills : AST#type_annotation#...
@Builder DateGroupComponent(date: string, bills: BillItem[]) { Column() { Row() { Text(this.formatDateDisplay(date)) .fontSize(13) .fontColor('#999999') Blank() Text(`支: ${this.calculateDayStats(bills).expense}`) .fontSize(12) .fontColor...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L781-L854
dfad3f46e9d05c9f038bdfff1d357cf178e27d16
github
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/pages/SettingPage.ets
arkts
featureItem
功能组件。 @param icon 图标 @param text 标签 @param prompt 点击后的提示语
@Builder featureItem(icon: ResourceStr, text: ResourceStr, fieldName: keyof PersonModel) { Row() { Text(icon) .fontSize($r("sys.float.ohos_id_text_size_body1")) .fontWeight(FontWeight.Bold) .margin($r("app.integer.listitem_overflow_default_margin")) Text(text) .fontSize($...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right featureItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Lef...
@Builder featureItem(icon: ResourceStr, text: ResourceStr, fieldName: keyof PersonModel) { Row() { Text(icon) .fontSize($r("sys.float.ohos_id_text_size_body1")) .fontWeight(FontWeight.Bold) .margin($r("app.integer.listitem_overflow_default_margin")) Text(text) .fontSize($...
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/pages/SettingPage.ets#L208-L223
7e7107f899fd2367572839bd420365bf382ad453
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets
arkts
showBottomSheet
底部弹框 @param options
public static showBottomSheet(options: JhBottomSheetOptions) { if ((options.data ?? []).length == 0) { return } DialogHelper.showBottomSheetDialog({ title: options.title ?? '', titleFontColor: _titleColor, cancelValue: _cancelText, sheets: options.data ?? [], cornerRadius...
AST#method_declaration#Left public static showBottomSheet AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhBottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_con...
public static showBottomSheet(options: JhBottomSheetOptions) { if ((options.data ?? []).length == 0) { return } DialogHelper.showBottomSheetDialog({ title: options.title ?? '', titleFontColor: _titleColor, cancelValue: _cancelText, sheets: options.data ?? [], cornerRadius...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets#L56-L76
783bff7aae4ef28c8f83f84a1e32ca37bae7cb7d
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
removeRecord
移除一条记录 @param record 操作记录
removeRecord(record: OperateRecord): void { if (this.operateRecords.length > 0) { let idx = this.operateRecords.indexOf(record); if (idx >= 0) { this.operateRecords.splice(idx, 1); } this.onRecordsChanged(); } }
AST#method_declaration#Left removeRecord AST#parameter_list#Left ( AST#parameter#Left record : AST#type_annotation#Left AST#primary_type#Left OperateRecord AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
removeRecord(record: OperateRecord): void { if (this.operateRecords.length > 0) { let idx = this.operateRecords.indexOf(record); if (idx >= 0) { this.operateRecords.splice(idx, 1); } this.onRecordsChanged(); } }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L153-L161
af693e602b2f457f2e02fdcebd94daf3ff491fa1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
getNextFestival
获取下一个节日
public static getNextFestival(currentDate: Date): FestivalInfo | null { const currentYear = currentDate.getFullYear(); const currentMonth = currentDate.getMonth() + 1; const currentDay = currentDate.getDate(); // 简化实现:只检查公历节日 const solarFestivals = SOLAR_FESTIVALS.filter(festival => { if ...
AST#method_declaration#Left public static getNextFestival 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#union_type#Left AST#prim...
public static getNextFestival(currentDate: Date): FestivalInfo | null { const currentYear = currentDate.getFullYear(); const currentMonth = currentDate.getMonth() + 1; const currentDay = currentDate.getDate(); const solarFestivals = SOLAR_FESTIVALS.filter(festival => { if (festival.month...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L339-L369
982f735775000a437bdd3bf523e2d259234b284a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets
arkts
getSupportedCamerasFn
获取支持指定的摄像机设备对象
getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> { let supportedCameras: Array<camera.CameraDevice> = []; try { supportedCameras = cameraManager.getSupportedCameras(); logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length...
AST#method_declaration#Left getSupportedCamerasFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#...
getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> { let supportedCameras: Array<camera.CameraDevice> = []; try { supportedCameras = cameraManager.getSupportedCameras(); logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets#L161-L170
fc9556fe1d64d45db10383bb132ba5ec91d10a24
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets
arkts
afterSnapshot
截图之后的操作。 - 恢复滚动组件页面到截图之前的位置 - 取消遮罩层
async afterSnapshot() { this.scroller.scrollTo({ xOffset: this.xOffsetBefore, yOffset: this.yOffsetBefore }); await sleep(Constants.SCROLL_DURATION); this.componentMaskImageZIndex = -1; this.componentMaskImage = undefined; }
AST#method_declaration#Left async afterSnapshot AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Le...
async afterSnapshot() { this.scroller.scrollTo({ xOffset: this.xOffsetBefore, yOffset: this.yOffsetBefore }); await sleep(Constants.SCROLL_DURATION); this.componentMaskImageZIndex = -1; this.componentMaskImage = undefined; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets#L427-L432
c7db8c538146c88aedd206310af39a918343dead
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
displayVersion
产品版本
static displayVersion(): string { return deviceInfo.displayVersion }
AST#method_declaration#Left static displayVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex...
static displayVersion(): string { return deviceInfo.displayVersion }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L113-L115
e632ea50e4ab41e8e4c72f0071b0fcd9eef1319d
gitee
Wayne-007/iMusic.git
ab55f2e57ffe1c6e0a26589047b0187842dc9eb3
entry/src/main/ets/pages/Play.ets
arkts
number2time
把毫秒转成分秒
number2time(number: number) { // 毫秒 → 秒 → 分+秒; 先判断是否大于1分钟 if (number > 60 * 1000) { const s = Math.floor(number / 1000 % 60) const m = Math.floor(number / 1000 / 60) const second = s.toString().padStart(2, '0') const minute = m.toString().padStart(2, '0') return minute + ':' + seco...
AST#method_declaration#Left number2time AST#parameter_list#Left ( AST#parameter#Left number : 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 { // 毫秒 → 秒 → 分+秒; 先判断是否大于1分钟 AST#statement#Left AS...
number2time(number: number) { if (number > 60 * 1000) { const s = Math.floor(number / 1000 % 60) const m = Math.floor(number / 1000 / 60) const second = s.toString().padStart(2, '0') const minute = m.toString().padStart(2, '0') return minute + ':' + second } else { const...
https://github.com/Wayne-007/iMusic.git/blob/ab55f2e57ffe1c6e0a26589047b0187842dc9eb3/entry/src/main/ets/pages/Play.ets#L154-L167
7ab3cb8c24ff049eec0a4f74a2a0032357cecf6f
github
openharmony-tpc/lottieArkTS
82cac19eaeb236c38fc72466a268c1d0d8a481ce
sharedLibrary/Index.ets
arkts
add
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 { add } from "./src/main/ets/utils/Calc"
AST#export_declaration#Left export { add } from "./src/main/ets/utils/Calc" AST#export_declaration#Right
export { add } from "./src/main/ets/utils/Calc"
https://github.com/openharmony-tpc/lottieArkTS/blob/82cac19eaeb236c38fc72466a268c1d0d8a481ce/sharedLibrary/Index.ets#L15-L15
d7db7ebafc932610efc2275545ea5a047555128d
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/event/WanEvents.ets
arkts
取消收藏文章事件
export class UncollectEvent { isSuccess: boolean id: number errMsg?: string constructor
AST#export_declaration#Left export AST#ERROR#Left class UncollectEvent { isSuccess : AST#ERROR#Left boolean id : number errMsg ? : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_decla...
export class UncollectEvent { isSuccess: boolean id: number errMsg?: string constructor
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/event/WanEvents.ets#L63-L68
cebf9257b9cb38dd99927c54f268e84c6ad16ab5
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
AtomicServiceWeb
Declare Component AtomicServiceWeb. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
@Component export declare struct AtomicServiceWeb { /** * The address of the web page to be displayed. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ src: ResourceStr; /** * Sets the controller of the AtomicServic...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceWeb AST#component_body#Left { /** * The address of the web page to be displayed. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI...
@Component export declare struct AtomicServiceWeb { src: ResourceStr; @ObjectLink controller: AtomicServiceWebController; @Prop mixedMode?: MixedMode; @Prop darkMode?: WebDarkMode; @Prop forceDarkAccess?: boolean; navPathStack?: NavPathStack; ...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L27-L160
d22744a70263e7043164d82cfaf8b760594a1b61
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AES.ets
arkts
decodeECB128
解密-ECB模式-128位 @param str 加密的字符串 @param aesKey AES密钥-128位 @returns
static async decodeECB128(str: string, aesKey: string): Promise<string> { return CryptoUtil.decodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128); }
AST#method_declaration#Left static async decodeECB128 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
static async decodeECB128(str: string, aesKey: string): Promise<string> { return CryptoUtil.decodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L211-L213
0f4c2863d09ddab9d3302ea2ca4efb2cd2ed27e3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildCsvInstructions
构建CSV说明和模板
@Builder buildCsvInstructions() { Column({ space: 12 }) { Text('CSV格式导入说明') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text('1. CSV文件需要包含表头行\n2. 必需字段:姓名\n3. 可选字段:关系、性别、电话、邮箱、生日等\n4. 支持中英文字段名') .fontSize(14...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCsvInstructions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen...
@Builder buildCsvInstructions() { Column({ space: 12 }) { Text('CSV格式导入说明') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text('1. CSV文件需要包含表头行\n2. 必需字段:姓名\n3. 可选字段:关系、性别、电话、邮箱、生日等\n4. 支持中英文字段名') .fontSize(14...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L179-L225
ba35df3c5ba331d75ba2d7bc41fd18303ec1cbae
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
accessSync
检查文件是否存在,以同步方法。 @param path 文件应用沙箱路径。 @returns
static accessSync(path: string): boolean { return fs.accessSync(path); }
AST#method_declaration#Left static accessSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
static accessSync(path: string): boolean { return fs.accessSync(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L390-L392
cdc8b9b9bdc205af5a8f913ba0fd9cf58693396b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines the prefix icon option. @interface PrefixIconOptions @extends IconCommonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines the prefix icon option. @interface PrefixIconOptions @extends IconCommonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @...
export interface PrefixIconOptions extends IconCommonOptions {}
AST#export_declaration#Left export AST#interface_declaration#Left interface PrefixIconOptions AST#extends_clause#Left extends IconCommonOptions AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PrefixIconOptions extends IconCommonOptions {}
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L304-L304
8ec932acbf9580e9021649ba23c682137d6d3917
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/AppState.ets
arkts
getInstance
获取单例
public static getInstance(): AppState { if (!AppState.instance) { AppState.instance = new AppState(); } return AppState.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppState AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Lef...
public static getInstance(): AppState { if (!AppState.instance) { AppState.instance = new AppState(); } return AppState.instance; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L70-L75
d5f476542399eefc3604d97dd43198a31834db5a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets
arkts
drawCropButton
Draw crop thick line. @param ctx @param crop
static drawCropButton(ctx: CanvasRenderingContext2D, crop: RectF) { let vp3 = CommonConstants.DEFAULT_BUTTON_WIDTH; let padding = CommonConstants.DEFAULT_BUTTON_PADDING; ctx.lineWidth = vp3; ctx.strokeStyle = CommonConstants.DEFAULT_BUTTON_COLOR; let cornerLength = CommonConstants.DEFAULT_BUTTON_LEN...
AST#method_declaration#Left static drawCropButton AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left crop : AST#type_annotation#Left AST#primary_type#Left Rec...
static drawCropButton(ctx: CanvasRenderingContext2D, crop: RectF) { let vp3 = CommonConstants.DEFAULT_BUTTON_WIDTH; let padding = CommonConstants.DEFAULT_BUTTON_PADDING; ctx.lineWidth = vp3; ctx.strokeStyle = CommonConstants.DEFAULT_BUTTON_COLOR; let cornerLength = CommonConstants.DEFAULT_BUTTON_LEN...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets#L46-L54
1df57e6d8e64fa9585cff828513d1f4e4158bb4d
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/home/HomeTabContent.ets
arkts
handleLoadMore
加载更多处理
private async handleLoadMore() { if (this.isLoadingMore || !this.hasMore) { return; } try { hilog.info(DOMAIN, TAG, 'Loading more data'); this.isLoadingMore = true; // 加载下一页数据 await this.loadMerchantList(this.currentPage + 1, true); hilog.info(DOMAIN, T...
AST#method_declaration#Left private async handleLoadMore AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#L...
private async handleLoadMore() { if (this.isLoadingMore || !this.hasMore) { return; } try { hilog.info(DOMAIN, TAG, 'Loading more data'); this.isLoadingMore = true; await this.loadMerchantList(this.currentPage + 1, true); hilog.info(DOMAIN, TAG, 'More ...
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/HomeTabContent.ets#L175-L197
733a205f94fdf6b4f1fe6fa564908902b4d29fd6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
onThemeTypeChange
切换主题类型
async onThemeTypeChange(type: ThemeType) { try { this.selectedThemeType = type; await this.themeManager.setThemeType(type); this.currentTheme = this.themeManager.getCurrentTheme(); } catch (error) { console.error('Failed to change theme type:', error); } }
AST#method_declaration#Left async onThemeTypeChange AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ThemeType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement...
async onThemeTypeChange(type: ThemeType) { try { this.selectedThemeType = type; await this.themeManager.setThemeType(type); this.currentTheme = this.themeManager.getCurrentTheme(); } catch (error) { console.error('Failed to change theme type:', error); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L88-L96
2f99f33527da4a07f502a5a9a5fa6117e06a6a56
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
rotatePoints
Rotate by point. @param inputs @param angle @param origin @returns
static rotatePoints(inputs: Array<Point>, angle: number, origin: Point): Array<Point> { let alpha = MathUtils.formulaAngle(-angle); let outputs: Array<Point> = []; for (let input of inputs) { let dx = input.x - origin.x; let dy = input.y - origin.y; let output = new Point(origin.x, origin....
AST#method_declaration#Left static rotatePoints AST#parameter_list#Left ( AST#parameter#Left inputs : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Point AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
static rotatePoints(inputs: Array<Point>, angle: number, origin: Point): Array<Point> { let alpha = MathUtils.formulaAngle(-angle); let outputs: Array<Point> = []; for (let input of inputs) { let dx = input.x - origin.x; let dy = input.y - origin.y; let output = new Point(origin.x, origin....
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L93-L105
9b07341f0c7a9731f7098c5424dd1fc44af61dc5
gitee