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
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
hasDefaultNetSync
检查默认数据网络是否被激活,是否有网络
static hasDefaultNetSync(): boolean { return connection.hasDefaultNetSync(); }
AST#method_declaration#Left static hasDefaultNetSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_...
static hasDefaultNetSync(): boolean { return connection.hasDefaultNetSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L60-L62
4f60e1ad763b7a77936a391807d995aae277d986
gitee
smarthane/DrawerLayout.git
0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec
DrawerLayout/src/main/ets/components/DrawerLayout.ets
arkts
toVp
转换VP @param width @param dpi @returns
public static toVp(width: number, dpi?: number): number { let displayObject = display.getDefaultDisplaySync(); let screenDensityDPI = displayObject.densityDPI; return width * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI); }
AST#method_declaration#Left public static toVp 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#Left dpi ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
public static toVp(width: number, dpi?: number): number { let displayObject = display.getDefaultDisplaySync(); let screenDensityDPI = displayObject.densityDPI; return width * ((dpi == null ? this.DEVICE_DPI : dpi) / screenDensityDPI); }
https://github.com/smarthane/DrawerLayout.git/blob/0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec/DrawerLayout/src/main/ets/components/DrawerLayout.ets#L496-L500
08408f90f390b4316b38b57bd427125c7ad50190
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/user/UserManager.ets
arkts
loadPreference
4. 加载偏好设置(严格匹配原始键名)
private loadPreference() { if (!this.prefs) return; this.userId = this.prefs.getSync(Prefs.kUserId, null) as number; this.userName = this.prefs.getSync(Prefs.kUserName, "") as string; this.loginIdentifier = this.prefs.getSync(Prefs.kLoginIdentifier, "") as string; this.loginType ...
AST#method_declaration#Left private loadPreference 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AS...
private loadPreference() { if (!this.prefs) return; this.userId = this.prefs.getSync(Prefs.kUserId, null) as number; this.userName = this.prefs.getSync(Prefs.kUserName, "") as string; this.loginIdentifier = this.prefs.getSync(Prefs.kLoginIdentifier, "") as string; this.loginType ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/UserManager.ets#L73-L81
1459cc34e5780dd6afa93ad8bd7d6a4e6dcf77de
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
hasDirPath
判断是否是完整路径 @param path 文件路径 沙箱路径 /data/storage/ 应用安装路径 /data/app/ 系统路径 /system/ 挂载路径 /mnt/ Download /storage/Users/currentUser/Download/ file://协议 file:///data/storage/el2/base/haps/entry/files/test.txt
static hasDirPath(path: string | undefined): boolean { if (StrUtils.isEmpty(path)) { return false; } const blFull = StrUtils.startsWith(path, "/data/") || StrUtils.startsWith(path, "/system/") || StrUtils.startsWith(path, "/mnt/") || StrUtils.startsWith(path, "file://") || StrUtils.startsW...
AST#method_declaration#Left static hasDirPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right )...
static hasDirPath(path: string | undefined): boolean { if (StrUtils.isEmpty(path)) { return false; } const blFull = StrUtils.startsWith(path, "/data/") || StrUtils.startsWith(path, "/system/") || StrUtils.startsWith(path, "/mnt/") || StrUtils.startsWith(path, "file://") || StrUtils.startsW...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L159-L167
2e82f440935b05143d75db085d83b338c6a673a2
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/IntroductionPage.ets
arkts
resetParameters
Reset all parameters if the list arrive begin by animation.
resetParameters() { this.listPosition = Const.LIST_POSITION_BEGIN; if (this.listPosition === Const.LIST_POSITION_BEGIN && this.isReachStart) { this.imageHeight = Const.FULL_PERCENT_NUMBER; this.arrowIconOpacity = Const.OPACITY_MAX; } this.isReachStart = false; }
AST#method_declaration#Left resetParameters 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 . listPosition AST#member_expression...
resetParameters() { this.listPosition = Const.LIST_POSITION_BEGIN; if (this.listPosition === Const.LIST_POSITION_BEGIN && this.isReachStart) { this.imageHeight = Const.FULL_PERCENT_NUMBER; this.arrowIconOpacity = Const.OPACITY_MAX; } this.isReachStart = false; }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L268-L275
c73333af9f9452f3917ac3ea0a6cec615fca9c93
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getSkipWebLineCount
Returns the modulus that is used for skipping web-lines. @return
public getSkipWebLineCount() { return this.mSkipWebLineCount; }
AST#method_declaration#Left public getSkipWebLineCount AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSkipWebLineCount AST#member_expressio...
public getSkipWebLineCount() { return this.mSkipWebLineCount; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L330-L332
5703b913799eebedc107f6c21ac85430bd7b1a4d
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/Constants.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { public static PROGRESS_EMITTER: string = 'progressEmitter' public static CALLBACK_EMITTER: string = 'callBackEmitter' }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left public static PROGRESS_EMITTER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'progressEmitter' AST#expression...
export class Constants { public static PROGRESS_EMITTER: string = 'progressEmitter' public static CALLBACK_EMITTER: string = 'callBackEmitter' }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/Constants.ets#L15-L18
df7e282ee39126993c303aa7aa58623f55a948de
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/StringBuilder.ets
arkts
@author open_9527 @date 2025/5/15 @desc 描述信息
export class StringBuilder { private value: (string | number | boolean | null)[]; constructor() { this.value = []; } append(str: string | number | boolean | null): StringBuilder { this.value.push(str); return this; } toString(): string { return this.value.join(''); } }
AST#export_declaration#Left export AST#class_declaration#Left class StringBuilder AST#class_body#Left { AST#property_declaration#Left private value : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#...
export class StringBuilder { private value: (string | number | boolean | null)[]; constructor() { this.value = []; } append(str: string | number | boolean | null): StringBuilder { this.value.push(str); return this; } toString(): string { return this.value.join(''); } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/StringBuilder.ets#L6-L22
b351b2a2f8c26937b823d9e512c255d2ec4a314f
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/detail/show/season/ShowSeasonViewModel.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/23 17:13 @Version V1.0 @Description
export class ShowSeasonViewModel extends ListViewModel { private readonly args: ShowSeasonArgs constructor
AST#export_declaration#Left export AST#ERROR#Left class ShowSeasonViewModel extends AST#type_annotation#Left AST#primary_type#Left ListViewModel AST#primary_type#Right AST#type_annotation#Right { private readonly args : ShowSeasonArgs AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ruct...
export class ShowSeasonViewModel extends ListViewModel { private readonly args: ShowSeasonArgs constructor
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/detail/show/season/ShowSeasonViewModel.ets#L12-L16
e434fcc427a67b3fd1bff04fc71cddb7893931cf
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets
arkts
UsbManager
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 { UsbManager } from './src/main/ets/capabilities/UsbManager';
AST#export_declaration#Left export { UsbManager } from './src/main/ets/capabilities/UsbManager' ; AST#export_declaration#Right
export { UsbManager } from './src/main/ets/capabilities/UsbManager';
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets#L16-L16
5b3e993146cc0cf1942b9a0884a96ccb40895e13
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/alias/alias_002_F.ets
arkts
Introduction 别名
export function alias_002_F(taint_src : string) { let _t = taint_src; let a = new A(); let b = a; b.data = "_"; taint.Sink(a.data); }
AST#export_declaration#Left export AST#function_declaration#Left function alias_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ...
export function alias_002_F(taint_src : string) { let _t = taint_src; let a = new A(); let b = a; b.data = "_"; taint.Sink(a.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/alias/alias_002_F.ets#L6-L12
ec3333042c3b704c2f4df00131bee07713478ae5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
清空桌面角标 在应用的桌面图标上呈现。 @returns {Promise<void>} void
export async function clearBadgeNumber(): Promise<void> { return setBadgeNumber(0); }
AST#export_declaration#Left export AST#function_declaration#Left async function clearBadgeNumber 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 clearBadgeNumber(): Promise<void> { return setBadgeNumber(0); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L343-L345
0bd958fea0ec79ec99a848009a6d550e98f0f2a6
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
loadConversations
加载会话列表
private async loadConversations(): Promise<void> { try { const data = await StorageManager.getString(this.CONVERSATIONS_KEY, '[]'); this.conversations = JSON.parse(data) as Conversation[]; } catch (error) { Logger.error('IMManager', `Failed to load conversations: ${String(error)}`); } }
AST#method_declaration#Left private async loadConversations 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 >...
private async loadConversations(): Promise<void> { try { const data = await StorageManager.getString(this.CONVERSATIONS_KEY, '[]'); this.conversations = JSON.parse(data) as Conversation[]; } catch (error) { Logger.error('IMManager', `Failed to load conversations: ${String(error)}`); } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L49-L56
4ce789cc0c4159fd6b760411b3d04b9448ddef9d
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets
arkts
aboutToAppear
[Start negative_of_lazy_for_each] [StartExclude negative_of_lazy_for_each] [EndExclude negative_of_lazy_for_each]
aboutToAppear(): void { // [StartExclude negative_of_lazy_for_each] for (let i = 1; i < 1000; i++) { this.data.pushData(i); } this.item = this.itemGeneratorFunc(0); hilog.info(0x0000, 'Sample', '%{public}s', `item: ${this.item}`); // [EndExclude negative_of_lazy_for_each] }
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 { // [StartExclude negative_of_lazy_for_each] AST#statement#Left AST#for_statement#Left for ( AST...
aboutToAppear(): void { for (let i = 1; i < 1000; i++) { this.data.pushData(i); } this.item = this.itemGeneratorFunc(0); hilog.info(0x0000, 'Sample', '%{public}s', `item: ${this.item}`); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets#L52-L60
d52c9c9d4ac28920b79dc5f516d3d3ee98f52676
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/guide/GuideService.ets
arkts
setBadgeCount
设置角标数字
async setBadgeCount(key: string, count: number): Promise<void> { try { const badgeKey = `${this.BADGE_PREFIX}${key}`; await StorageManager.setNumber(badgeKey, count); Logger.info('GuideService', `Badge count set: ${key} = ${count}`); } catch (error) { Logger.error('GuideService', `Failed...
AST#method_declaration#Left async setBadgeCount AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
async setBadgeCount(key: string, count: number): Promise<void> { try { const badgeKey = `${this.BADGE_PREFIX}${key}`; await StorageManager.setNumber(badgeKey, count); Logger.info('GuideService', `Badge count set: ${key} = ${count}`); } catch (error) { Logger.error('GuideService', `Failed...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L117-L125
98442b31fa719833698b2b871a24215831b5880e
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/player.ets
arkts
用户
export class Person { private _nickname: string = '' private _attrs: t.TPersonAttr private _bag: Item[] = [] private _mapIndex: number = 0 private _level: number = 1 private _exp = 0 private _meditationPoint = 0 isDead: boolean = false constructor
AST#export_declaration#Left export AST#ERROR#Left class Person { AST#property_declaration#Left private _nickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right AST#property_declaration...
export class Person { private _nickname: string = '' private _attrs: t.TPersonAttr private _bag: Item[] = [] private _mapIndex: number = 0 private _level: number = 1 private _exp = 0 private _meditationPoint = 0 isDead: boolean = false constructor
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/player.ets#L11-L21
8cd14931009deba3b3c043b531db28f8fc47d290
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/AlarmManager.ets
arkts
getSavedAlarmTime
获取保存的闹钟时间
public getSavedAlarmTime(): Date { if (!this.prefs) throw new Error('Preferences未初始化'); const hour = Number(this.prefs.getSync('hour', 18)); // 默认18点 const minute = Number(this.prefs.getSync('minute', 0)); // 默认0分 const now = new Date(); now.setHours(hour); now.setMinutes(minute); now.setSec...
AST#method_declaration#Left public getSavedAlarmTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_express...
public getSavedAlarmTime(): Date { if (!this.prefs) throw new Error('Preferences未初始化'); const hour = Number(this.prefs.getSync('hour', 18)); const minute = Number(this.prefs.getSync('minute', 0)); const now = new Date(); now.setHours(hour); now.setMinutes(minute); now.setSeconds(0); no...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/AlarmManager.ets#L39-L49
7f0f4234201567043aa9a77fe5300ea9e14fbec5
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
getAesDecryptProperties
AES解密密钥属性信息
function getAesDecryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 ...
AST#function_declaration#Left function getAesDecryptProperties 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 getAesDecryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L166-L193
d06edf7bf9bdbf612d935facc17727c52a1b96b2
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
notifyDatasetChange
Notify the controller of bulk modification of data
notifyDatasetChange(operations: DataOperation[]): void { this.listeners.forEach(listener => { listener.onDatasetChange(operations); }); }
AST#method_declaration#Left notifyDatasetChange AST#parameter_list#Left ( AST#parameter#Left operations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataOperation [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a...
notifyDatasetChange(operations: DataOperation[]): void { this.listeners.forEach(listener => { listener.onDatasetChange(operations); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L67-L71
b319080e2a78ef5e972160340a794b366a6ab6db
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets
arkts
setId
new function in derived class
setId(id: string) { this.id = id; }
AST#method_declaration#Left setId 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST...
setId(id: string) { this.id = id; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets#L20-L22
d9acf7770fda1a913d89f4e57687503577a5c8e6
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
initialize
初始化路由 @param invoke
public static initialize(invoke?: ((config: ConfigInitializer) => void)) { const config = new ConfigInitializer() config.onDynamicLoadComplete = () => { ZRouter.getRouterMgr().isDynamicLoadedComplete = true ZRouter.getRouterMgr().moduleLoadedListener?.() } config.onRouterMapLoadedComplete = ...
AST#method_declaration#Left public static initialize AST#parameter_list#Left ( AST#parameter#Left invoke ? : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#pri...
public static initialize(invoke?: ((config: ConfigInitializer) => void)) { const config = new ConfigInitializer() config.onDynamicLoadComplete = () => { ZRouter.getRouterMgr().isDynamicLoadedComplete = true ZRouter.getRouterMgr().moduleLoadedListener?.() } config.onRouterMapLoadedComplete = ...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L44-L60
59d7618fc3e926a0960ec488e184bbea1d53e62e
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets
arkts
聊天角色类型枚举
export enum ChatRoleType { // 助理 Assistant = "assistant", // 用户 User = "user" }
AST#export_declaration#Left export AST#enum_declaration#Left enum ChatRoleType AST#enum_body#Left { // 助理 AST#enum_member#Left Assistant = AST#expression#Left "assistant" AST#expression#Right AST#enum_member#Right , // 用户 AST#enum_member#Left User = AST#expression#Left "user" AST#expression#Right AST#enum_member#Right ...
export enum ChatRoleType { Assistant = "assistant", User = "user" }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L2-L8
5e2cbd1cb943935b2b03118b08bcf28a92c20727
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
用户注册 @param params 注册参数 @returns 注册结果Promise
export async function register(params: RegisterParams): Promise<ApiResponse<AuthResponse>> { console.info('注册请求参数:', JSON.stringify(params)); try { // 将RegisterParams转换为RequestData类型 const requestData: RequestData = { username: params.username, password: params.password, nickname: params.n...
AST#export_declaration#Left export AST#function_declaration#Left async function register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RegisterParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
export async function register(params: RegisterParams): Promise<ApiResponse<AuthResponse>> { console.info('注册请求参数:', JSON.stringify(params)); try { const requestData: RequestData = { username: params.username, password: params.password, nickname: params.nickname, email: params.email...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1226-L1250
fa997eeed619f6fe417089a42a14781b05e4df5e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
继承NodeController,创建可以复用的子组件
export class NodeItem extends NodeController { public builder: WrappedBuilder<ESObject> | null = null; public node: BuilderNode<ESObject> | null = null; public data: ESObject={}; // 子组件类型,复用时会根据type查找对应的子组件使用 public type: string = ''; public id: number = 0; public itemColor: Color = 0; aboutToDisappea...
AST#export_declaration#Left export AST#class_declaration#Left class NodeItem extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public builder : AST#type_annotation#Left AST#union_type#Left AST#primar...
export class NodeItem extends NodeController { public builder: WrappedBuilder<ESObject> | null = null; public node: BuilderNode<ESObject> | null = null; public data: ESObject={}; public type: string = ''; public id: number = 0; public itemColor: Color = 0; aboutToDisappear(): void { NodePool...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L20-L50
c095aa59881df9ef645cbf3a4d0a20f7530efd4b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets
arkts
cropImage
图片裁剪
async cropImage(proportion: number): Promise<void> { if (!this.pixelMapSrc) { logger.error(TAG, `pixelMapSrc is null`); return; } // TODO 知识点:通过readPixelsToBuffer拷贝到PixelMap对象 const pixelMapTemp = await copyPixelMap(this.pixelMapSrc); const imageInfo: image.ImageInfo = await pixelMapTemp...
AST#method_declaration#Left async cropImage AST#parameter_list#Left ( AST#parameter#Left proportion : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
async cropImage(proportion: number): Promise<void> { if (!this.pixelMapSrc) { logger.error(TAG, `pixelMapSrc is null`); return; } const pixelMapTemp = await copyPixelMap(this.pixelMapSrc); const imageInfo: image.ImageInfo = await pixelMapTemp.getImageInfo(); if (!imageInfo) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets#L118-L153
32683368746f4955e13a8f39d7af8d932b8b6519
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
height
Sets the height of the toolBar. @param { LengthMetrics } height - toolBar's height. @returns { ToolBarModifier } returns the instance of the ToolBarModifier. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13
height(height: LengthMetrics): ToolBarModifier;
AST#method_declaration#Left height AST#parameter_list#Left ( AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#prima...
height(height: LengthMetrics): ToolBarModifier;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L241-L241
76f9d63327a0f728230a179b21e8fa38e9926a68
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
unlinkSync
删除单个文件,以同步方法。 @param path 文件的应用沙箱路径。 @returns
static unlinkSync(path: string) { fs.unlinkSync(path); }
AST#method_declaration#Left static unlinkSync 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#builder_function_body#Left { AST#expression_statement#Left AST#expre...
static unlinkSync(path: string) { fs.unlinkSync(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L371-L373
61e005444a0e6b48e00a13658c66b64b59889536
gitee
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
dev/team_x/smart_cookie_pan/openharmony_hi3516/electricitycakeclangdemo/entry/src/main/ets/MainAbility/pages/home.ets
arkts
napicallback
智能电饼铛开关状态 tcp socker 接收napi回调函数
napicallback(data){ switch(data.prop1)//分析手机端发送的命令,进行处理数据 { case 1:home.setflagswitch();break; case 2:naips.ServerWrite(20,home.flagswitch ? 1:0,0);
AST#method_declaration#Left napicallback AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#...
napicallback(data){ switch(data.prop1) { case 1:home.setflagswitch();break; case 2:naips.ServerWrite(20,home.flagswitch ? 1:0,0);
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/dev/team_x/smart_cookie_pan/openharmony_hi3516/electricitycakeclangdemo/entry/src/main/ets/MainAbility/pages/home.ets#L20-L24
d84d9cbf5b6f6a2444fb264258eb29e28b3725d9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets
arkts
registerDataChangeListener
为LazyForEach组件向其数据源处添加listener监听。 @param {DataChangeListener} listener - 监听对象。
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets#L96-L100
f1b2da4982d14950e3c3b1d6c44083e0712dc319
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/components/HcSkeleton.ets
arkts
HcSkeletonItem
祛魅 骨架屏(一个有宽高的灰色盒子组成了一块结构 呼吸效果)
@Component export struct HcSkeletonItem { @Prop widthValue: number = 100 @State op: number = 1 build() { Text() .width(this.widthValue) .height(30) .backgroundColor('#ccc') .opacity(this.op) .onAppear(() => { animateTo({ duration: 1000, iterations: -1...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HcSkeletonItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right widthValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a...
@Component export struct HcSkeletonItem { @Prop widthValue: number = 100 @State op: number = 1 build() { Text() .width(this.widthValue) .height(30) .backgroundColor('#ccc') .opacity(this.op) .onAppear(() => { animateTo({ duration: 1000, iterations: -1...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/components/HcSkeleton.ets#L3-L25
6582574bc3383affc2e2f4afe41eab1db7dadca3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildJsonInstructions
构建JSON说明
@Builder buildJsonInstructions() { Column({ space: 12 }) { Text('JSON格式导入说明') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text('JSON格式应为联系人对象数组,每个对象包含联系人信息。') .fontSize(14) .fontColor('#666666') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildJsonInstructions 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#compone...
@Builder buildJsonInstructions() { Column({ space: 12 }) { Text('JSON格式导入说明') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text('JSON格式应为联系人对象数组,每个对象包含联系人信息。') .fontSize(14) .fontColor('#666666') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L389-L433
9e2565164e8f612928757a607198dafb78a98145
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/plan/CreatePlanView.ets
arkts
/ 参数类型
export interface Param { initWordIds ?: number[] | null initName ?: string | null bookId ?: number | null plan ?: Plan | null }
AST#export_declaration#Left export AST#interface_declaration#Left interface Param AST#object_type#Left { AST#type_member#Left initWordIds ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#pri...
export interface Param { initWordIds ?: number[] | null initName ?: string | null bookId ?: number | null plan ?: Plan | null }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/plan/CreatePlanView.ets#L44-L50
256086f977ec6f6d52c702df90bb34b062c71551
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DownloadUtils.ets
arkts
下载
export class DownloadUtils { private static downloadPath: string = ""; //下载文件Path。 /** * 设置下载文件夹路径,仅SDK内部使用 */ static setDownloadPath(path: string) { DownloadUtils.downloadPath = path; } /** * 获取ArkWeb文件夹下载路径,仅SDK内部使用 */ static getArkDownloadPath(): string { return DownloadUtils.down...
AST#export_declaration#Left export AST#class_declaration#Left class DownloadUtils AST#class_body#Left { AST#property_declaration#Left private static downloadPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#p...
export class DownloadUtils { private static downloadPath: string = ""; static setDownloadPath(path: string) { DownloadUtils.downloadPath = path; } static getArkDownloadPath(): string { return DownloadUtils.downloadPath; } static onAbilityLifecycle(context: common.UIAbilityContext) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L16-L180
d15ea5bed8db1b3b8466551f74f397f7db593ecb
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/common/constants/PlayConstants.ets
arkts
Play constants for all features.
export class PlayConstants { /** * Playback page constant. */ static readonly PLAY_SPEED: number = 1; static readonly VOLUME: number = 0.5; static readonly VOLUME_SHOW: boolean = false; static readonly BRIGHT: number = 0.5; static readonly BRIGHT_SHOW: boolean = false; static readonly POSITION_X: nu...
AST#export_declaration#Left export AST#class_declaration#Left class PlayConstants AST#class_body#Left { /** * Playback page constant. */ AST#property_declaration#Left static readonly PLAY_SPEED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export class PlayConstants { static readonly PLAY_SPEED: number = 1; static readonly VOLUME: number = 0.5; static readonly VOLUME_SHOW: boolean = false; static readonly BRIGHT: number = 0.5; static readonly BRIGHT_SHOW: boolean = false; static readonly POSITION_X: number = 0; static readonly POSITION_Y...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/PlayConstants.ets#L19-L105
22754011dd19f1f5eeb674c716cfcff79e2d352a
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
network/WebSocket/entry/src/main/ets/common/TopBar.ets
arkts
TopBar
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export default struct TopBar { @Link isConnect: boolean private connect: () => void = () => { } build() { Row() { Text($r('app.string.server')) .width('20%') .fontSize(20) .margin({ left: '40%' }) .textAlign(TextAlign.Center) Button() { Text($...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TopBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isConnect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a...
@Component export default struct TopBar { @Link isConnect: boolean private connect: () => void = () => { } build() { Row() { Text($r('app.string.server')) .width('20%') .fontSize(20) .margin({ left: '40%' }) .textAlign(TextAlign.Center) Button() { Text($...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/network/WebSocket/entry/src/main/ets/common/TopBar.ets#L16-L49
98beffbb091b2f02fac984a6fbcf9a4b9ab8d49e
gitee
HarmonyCandies/image_editor.git
16924481f667efa4bdd1a0b39e6f5a80c43e5ff4
image_editor/src/main/ets/components/option/ImageMergeOption.ets
arkts
handle
static fromMap(data: Map<string, ESObject>): ImageMergeOption { const image = MapUtils.get(MapUtils.getMap(data, 'src'), 'memory', new Uint8Array()); const position: Map<string, ESObject> = MapUtils.getMap(data, 'position'); const offset = MapUtils.getOffset(position); const width = MapUtils.get(position, 'w', 0); cons...
async handle(context: OffscreenCanvasRenderingContext2D): Promise<void> { context.drawImage(this.image, this.offset.x, this.offset.y, this.width, this.height); // const imageSource: image.ImageSource = image.createImageSource(this.image.buffer); // let decodingOptions: image.DecodingOptions = { // sam...
AST#method_declaration#Left async handle AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left OffscreenCanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
async handle(context: OffscreenCanvasRenderingContext2D): Promise<void> { context.drawImage(this.image, this.offset.x, this.offset.y, this.width, this.height); }
https://github.com/HarmonyCandies/image_editor.git/blob/16924481f667efa4bdd1a0b39e6f5a80c43e5ff4/image_editor/src/main/ets/components/option/ImageMergeOption.ets#L27-L35
ef35fc6a29cf7783b6054fea05d446d304782fd3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
本地化配置接口
export interface LocaleConfig { language: SupportedLanguage; fallbackLanguage: SupportedLanguage; autoDetect: boolean; useSystemLocale: boolean; dateFormat?: string; timeFormat?: string; numberFormat?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LocaleConfig AST#object_type#Left { AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left fallbackLanguage ...
export interface LocaleConfig { language: SupportedLanguage; fallbackLanguage: SupportedLanguage; autoDetect: boolean; useSystemLocale: boolean; dateFormat?: string; timeFormat?: string; numberFormat?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L50-L58
1a3e4e2b781f3bdd91642acbd0478a408100f8f7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PickerUtil.ets
arkts
selectPhoto
通过选择模式拉起PhotoViewPicker界面,用户可以选择一个或多个图片/视频。(该方法系统已废弃,推荐使用PhotoHelper工具类) @param options MIMEType PhotoViewMIMETypes 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。 maxSelectNumber number 选择媒体文件数量的最大值(默认值为50,最大值为500)。 @returns
static async selectPhoto(options?: picker.PhotoSelectOptions): Promise<Array<string>> { if (options === undefined) { options = new picker.PhotoSelectOptions(); options.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; //可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。 options.maxSelectNumber = PICKER_DEFAULT_SELECT_N...
AST#method_declaration#Left static async selectPhoto AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . PhotoSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
static async selectPhoto(options?: picker.PhotoSelectOptions): Promise<Array<string>> { if (options === undefined) { options = new picker.PhotoSelectOptions(); options.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; } const photoPi...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L65-L74
e2d932a982f76f07e65d54e9ac340f0f6323c463
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/scatter/CircleShapeRenderer.ets
arkts
Created by wajdic on 15/06/2016. Created at Time 09:08
export default class CircleShapeRenderer implements IShapeRenderer { public renderShape(c: CanvasRenderingContext2D, dataSet: IScatterDataSet, viewPortHandler: ViewPortHandler, posX: number, posY: number, renderPaint: Paint): void { const shapeSize: number = dataSet.getScatterShapeSize(); ...
AST#export_declaration#Left export default AST#class_declaration#Left class CircleShapeRenderer AST#implements_clause#Left implements IShapeRenderer AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left public renderShape AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left ...
export default class CircleShapeRenderer implements IShapeRenderer { public renderShape(c: CanvasRenderingContext2D, dataSet: IScatterDataSet, viewPortHandler: ViewPortHandler, posX: number, posY: number, renderPaint: Paint): void { const shapeSize: number = dataSet.getScatterShapeSize(); ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/scatter/CircleShapeRenderer.ets#L28-L75
0c7da80cfbcc0d43ddf072ab579b7989811a6057
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LRUCacheUtil.ets
arkts
isEmpty
判断lruCache缓存是否为空 @returns
public isEmpty(): boolean { return this.lruCache.isEmpty(); }
AST#method_declaration#Left public isEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression...
public isEmpty(): boolean { return this.lruCache.isEmpty(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L81-L83
c120023101e29160b34ebe385bfb88f5b2c1983d
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/live/Index.ets
arkts
Header
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 { Header } from './src/main/ets/view/Header';
AST#export_declaration#Left export { Header } from './src/main/ets/view/Header' ; AST#export_declaration#Right
export { Header } from './src/main/ets/view/Header';
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/live/Index.ets#L16-L16
c095996008b1564c2c1af346a6890809e3ec86c7
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets
arkts
postMessage
发送消息到UI函数
public postMessage(msg: ChatMessage, clearInput: boolean = true) { let lastMsg: ChatMessage = this.messageArr.getData(this.messageArr.totalCount() - 1); if (!lastMsg.content) { this.messageArr.updateData(this.messageArr.totalCount() - 1, msg); } else { this.messageArr.pushData(msg); } if...
AST#method_declaration#Left public postMessage AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left clearInput : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
public postMessage(msg: ChatMessage, clearInput: boolean = true) { let lastMsg: ChatMessage = this.messageArr.getData(this.messageArr.totalCount() - 1); if (!lastMsg.content) { this.messageArr.updateData(this.messageArr.totalCount() - 1, msg); } else { this.messageArr.pushData(msg); } if...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets#L289-L301
f169186e4800fc0f8f05f300895bc44c1a86f1de
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/loading/Loading.ets
arkts
构建 Loading 视图 @returns void
build(): void { LoadingProgress() .width(this.loadSize); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . ...
build(): void { LoadingProgress() .width(this.loadSize); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/loading/Loading.ets#L14-L17
5dcfab0c4a868770cc9149b84346dd8817112e47
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets
arkts
通知相关常量类
export class AppCfgNotification { static readonly AppCfgUpdated: string = "app_cfg_updated_from_server"; // 配置更新通知名称 }
AST#export_declaration#Left export AST#class_declaration#Left class AppCfgNotification AST#class_body#Left { AST#property_declaration#Left static readonly AppCfgUpdated : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "app_cfg_updated_from_se...
export class AppCfgNotification { static readonly AppCfgUpdated: string = "app_cfg_updated_from_server"; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets#L15-L17
7023b448168460d9d6e9004e25c1de0f758a16e5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
updateCart
更新购物车中的商品 @param {Cart} cart 购物车商品 @returns {Promise<void>} Promise<void>
updateCart(cart: Cart): Promise<void> { return this.dataSource.updateCart(cart); }
AST#method_declaration#Left updateCart 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 AST#generic_type#Left Promise AS...
updateCart(cart: Cart): Promise<void> { return this.dataSource.updateCart(cart); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L36-L38
e05f8b0eba409ac13c8e2567e4148fdd35af43f4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/SafeAreaDemoPage.ets
arkts
formatInset
格式化安全区数值 @param {number} value - 安全区数值 @returns {string} 格式化后的文本
private formatInset(value: number): string { return value.toFixed(2); }
AST#method_declaration#Left private formatInset 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
private formatInset(value: number): string { return value.toFixed(2); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/SafeAreaDemoPage.ets#L85-L87
8002bfb5e87816c80d9fb61e8151dcab9b579e61
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets
arkts
getPreviousMusic
Previous song. @param musicList @param playState
getPreviousMusic(musicList: Array<MusicItem>, playState: number) { if (this.playBarModel.playMode === PlayMode.RANDOM_PLAY) { // Obtain the previous song in the random list. let preIndex = 0; let randomList = GlobalContext.getContext().getObject('randomList') as number[]; randomList.forEach(...
AST#method_declaration#Left getPreviousMusic AST#parameter_list#Left ( AST#parameter#Left musicList : 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 MusicItem AST#primary_type#Right AST#type_annotation#Right > AST#type_...
getPreviousMusic(musicList: Array<MusicItem>, playState: number) { if (this.playBarModel.playMode === PlayMode.RANDOM_PLAY) { let preIndex = 0; let randomList = GlobalContext.getContext().getObject('randomList') as number[]; randomList.forEach((item: number, index: number) => { if (...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets#L80-L110
d0e59a7b13eab41079734b3c5650d0af6fa021b4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FullImagePage.ets
arkts
downLoadFile
启动worker发送下载请求
downLoadFile(): void { let workerInstance = new worker.ThreadWorker('entry/ets/pages/workers/worker.ts', { name: 'FriendsMoments Worker' }); // 请求网络数据 let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; workerInstance.postMessage({ context, mediaData: this.media...
AST#method_declaration#Left downLoadFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left workerInstance...
downLoadFile(): void { let workerInstance = new worker.ThreadWorker('entry/ets/pages/workers/worker.ts', { name: 'FriendsMoments Worker' }); let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; workerInstance.postMessage({ context, mediaData: this.mediaData, isI...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FullImagePage.ets#L230-L248
4c4a40331fb90996fdf5f43e7723544759841906
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pulltorefreshnews/Index.ets
arkts
PullToRefreshNewsComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { PullToRefreshNewsComponent } from './src/main/ets/pages/PullToRefreshNews';
AST#export_declaration#Left export { PullToRefreshNewsComponent } from './src/main/ets/pages/PullToRefreshNews' ; AST#export_declaration#Right
export { PullToRefreshNewsComponent } from './src/main/ets/pages/PullToRefreshNews';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pulltorefreshnews/Index.ets#L16-L16
0b1736e4cfa7416b7f18f4c0f4ad4fae32613849
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
IsMutable
Called when the data can be changed. @since 7
static IsMutable(propName: string): boolean { return StorageMap.shared.map.get(propName)?.mutable ?? false }
AST#method_declaration#Left static IsMutable AST#parameter_list#Left ( AST#parameter#Left propName : 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_...
static IsMutable(propName: string): boolean { return StorageMap.shared.map.get(propName)?.mutable ?? false }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L238-L240
16bb2da412d018280b00295e7f30b88af9ce67bf
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.InnerFullScreenLaunchComponent.d.ets
arkts
InnerFullScreenLaunchComponent
Declare component InnerFullScreenLaunchComponent @syscap SystemCapability.ArkUI.ArkUI.Full @systemapi @since 12
@Component export declare struct InnerFullScreenLaunchComponent { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 12 */ @BuilderParam content: Callback<void>; /** * Sets the component Controller. * @type { Laun...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct InnerFullScreenLaunchComponent AST#component_body#Left { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @s...
@Component export declare struct InnerFullScreenLaunchComponent { @BuilderParam content: Callback<void>; controller: LaunchController; onReceive?: Callback<Record<string, Object>>; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.InnerFullScreenLaunchComponent.d.ets#L30-L58
5d96669347e751285954c288954450884ee40d96
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/model/constraint.ets
arkts
系统深浅色模式切换监听
export const DialogThemeColorMode: string = "harmony-web_dialog_ThemeColorMode";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DialogThemeColorMode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "harmony-web_dialog_ThemeColorMode" AST#expression#Right AST#variable_de...
export const DialogThemeColorMode: string = "harmony-web_dialog_ThemeColorMode";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/constraint.ets#L5-L5
ae43222af271d7e64c4761171f5c9d7f49ad3889
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets
arkts
enableNotification
enable notification
async enableNotification() { try { await notification.requestEnableNotification(); logger.info(TAG, `enableNotification success`); } catch (err) { logger.info(TAG, `enableNotification err ${JSON.stringify(err)}`); } }
AST#method_declaration#Left async enableNotification AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ...
async enableNotification() { try { await notification.requestEnableNotification(); logger.info(TAG, `enableNotification success`); } catch (err) { logger.info(TAG, `enableNotification err ${JSON.stringify(err)}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets#L39-L46
2be051568d6c293c81f1bcf37ad898490c351a2b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
getGiftIdeasByRelation
根据关系获取礼物建议
private getGiftIdeasByRelation(relation?: string): string[] { const giftMap: Record<string, string[]> = { '家人': ['保健品', '家居用品', '电子产品', '服饰', '美食'], '朋友': ['书籍', '数码配件', '美妆用品', '运动用品', '文创产品'], '同事': ['办公用品', '茶叶咖啡', '小装饰品', '书籍', '植物'], '恋人': ['首饰', '香水', '鲜花', '情侣用品', '浪漫礼品'], '同学':...
AST#method_declaration#Left private getGiftIdeasByRelation AST#parameter_list#Left ( AST#parameter#Left relation ? : 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#...
private getGiftIdeasByRelation(relation?: string): string[] { const giftMap: Record<string, string[]> = { '家人': ['保健品', '家居用品', '电子产品', '服饰', '美食'], '朋友': ['书籍', '数码配件', '美妆用品', '运动用品', '文创产品'], '同事': ['办公用品', '茶叶咖啡', '小装饰品', '书籍', '植物'], '恋人': ['首饰', '香水', '鲜花', '情侣用品', '浪漫礼品'], '同学':...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L464-L475
3c0c75952509ad11ebced27857976215428cbc4c
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets
arkts
stopDeviceDiscovery
Stop querying devices.
stopDeviceDiscovery() { try { if (this.dmInstance !== undefined) { this.dmInstance.stopDeviceDiscovery(this.subscribeId); } } catch (err) { Logger.error(TAG, 'stopDeviceDiscovery err:' + JSON.stringify(err)); } }
AST#method_declaration#Left stopDeviceDiscovery 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#me...
stopDeviceDiscovery() { try { if (this.dmInstance !== undefined) { this.dmInstance.stopDeviceDiscovery(this.subscribeId); } } catch (err) { Logger.error(TAG, 'stopDeviceDiscovery err:' + JSON.stringify(err)); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets#L93-L101
8a2123359361ea52695f92d4ae6cd0a39fbcadac
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets
arkts
CartList
购物车列表
@Builder CartList() { List({ space: AppDimensions.spaceMedium }) { ForEach(this.cartItems, (cart: Cart) => { ListItem() { this.CartItem(cart) } }) } .layoutWeight(1) .padding(AppDimensions.paddingMedium) .scrollBar(BarState.Off) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CartList 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 List ( AST#component_parameters#Left { AST#component_parameter#Le...
@Builder CartList() { List({ space: AppDimensions.spaceMedium }) { ForEach(this.cartItems, (cart: Cart) => { ListItem() { this.CartItem(cart) } }) } .layoutWeight(1) .padding(AppDimensions.paddingMedium) .scrollBar(BarState.Off) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L90-L102
73f228d58a4872798e0943d20f86d20e807b083e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/nativeThreadsCallJS/Index.ets
arkts
NativeThreadsCallJSDemo
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { NativeThreadsCallJSDemo } from './src/main/ets/pages/Index'
AST#export_declaration#Left export { NativeThreadsCallJSDemo } from './src/main/ets/pages/Index' AST#export_declaration#Right
export { NativeThreadsCallJSDemo } from './src/main/ets/pages/Index'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/nativeThreadsCallJS/Index.ets#L16-L16
74281f267e0fb4fb9185e01ae14ee910a2dd586b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/pages/Launcher.ets
arkts
Launcher
功能描述: 本示例使用position绝对定位实现应用内悬浮窗,并且通过animateTo结合curves动画曲线实现悬浮窗拖拽跟手和松手吸附边缘的弹性动画效果 推荐场景: 悬浮窗显示场景 核心组件: 1. FloatWindowView 实现步骤: 1. 悬浮窗组件使用Stack嵌套video布局,使用属性position绝对定位使组件悬浮,position使用Edges类型控制悬浮窗到父组件四条边的距离 2. 初始化时悬浮窗的position属性设置top和right,让悬浮窗靠右 3. 父组件添加onAreaChange回调,获取父组件的宽高 4. 悬浮窗组件添加onTouchEvent回调,在手指按下时保存触摸点在窗口...
@Component export struct Launcher { build() { Column() { GridSceneView() // 实现Grid拖拽场景 ListSceneView() // 实现List拖拽场景 } .width($r('app.string.drag_and_exchange_layout_100_percent')) .height($r('app.string.drag_and_exchange_layout_100_percent')) .justifyContent(FlexAlign.Center) .bac...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Launcher AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { ...
@Component export struct Launcher { build() { Column() { GridSceneView() ListSceneView() } .width($r('app.string.drag_and_exchange_layout_100_percent')) .height($r('app.string.drag_and_exchange_layout_100_percent')) .justifyContent(FlexAlign.Center) .backgroundImage($r('app.media...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/pages/Launcher.ets#L37-L50
0eba085c228e68ffefb0920a213a053be441cd11
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SimpleChatList/entry/src/main/ets/pages/UnilateralRebound.ets
arkts
UnilateralRebound
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct UnilateralRebound { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; private scroller: Scroller = new Scroller(); private isTop: boolean = true; @StorageProp('topRectHeight') topRectHeight: number = 0; build() { NavDestination() { // [Start UnilateralRebound] L...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UnilateralRebound AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#typ...
@Component export struct UnilateralRebound { private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; private scroller: Scroller = new Scroller(); private isTop: boolean = true; @StorageProp('topRectHeight') topRectHeight: number = 0; build() { NavDestination() { List({ space: 20, initialInde...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/UnilateralRebound.ets#L16-L63
abae3d8f6fd086609774d429f8752e36327c0d96
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/Helper.ets
arkts
isNotNull
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotNull(str: string | number | undefined | null): boolean { return false === Helper.isNull(str); }
AST#method_declaration#Left static isNotNull AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_ty...
static isNotNull(str: string | number | undefined | null): boolean { return false === Helper.isNull(str); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L55-L57
3467b62c8d753797700b5f1e7d3ebeee895cf01e
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ColorFilterSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all feature.
export default class CommonConstants{ /** * Text font weight. */ static readonly TEXT_FONT_WEIGHT: number = 500; /** * Layout weight of the scroll. */ static readonly SCROLL_LAYOUT_WEIGHT: number = 1; /** * Width of the button. */ static readonly BUTTON_WIDTH: string = '86.7%'; /** ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Text font weight. */ AST#property_declaration#Left static readonly TEXT_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST...
export default class CommonConstants{ static readonly TEXT_FONT_WEIGHT: number = 500; static readonly SCROLL_LAYOUT_WEIGHT: number = 1; static readonly BUTTON_WIDTH: string = '86.7%'; static readonly COLUMN_TEMPLATE: string = '1fr 1fr 1fr 1fr 1fr'; static readonly ROW_TEMPLATE: string = '1f...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ColorFilterSample/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L54
21a6935c51885d430ee5e98217103eaf7998225b
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/common/Constant.ets
arkts
二级菜单
export interface SubListData {
AST#export_declaration#Left export AST#interface_declaration#Left interface SubListData AST#object_type#Left { AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface SubListData {
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/common/Constant.ets#L35-L35
8773d4f6c1b9d7b0a154b6c73d05dec64bc60782
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
getOccasionLabel
获取场合标签
private getOccasionLabel(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.ANNIVERSARY: return '纪念日'; case GreetingOccasion.GRADUATION: retur...
AST#method_declaration#Left private getOccasionLabel AST#parameter_list#Left ( AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left GreetingOccasion AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left st...
private getOccasionLabel(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.ANNIVERSARY: return '纪念日'; case GreetingOccasion.GRADUATION: retur...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L666-L681
992f807bb836478ae5c40ff090f5a65f12814e92
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
DealStrideSolution/entry/src/main/ets/pages/PageTwo.ets
arkts
PublishView
Share components at the bottom of the page
@Component export struct PublishView { build() { Flex({ justifyContent: FlexAlign.SpaceBetween }) { Image($r('app.media.share')) .width(24) .height(24) Image($r('app.media.heart')) .width(24) .height(24) Image($r('app.media.square_and_pencil')) .width(24) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PublishView AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST...
@Component export struct PublishView { build() { Flex({ justifyContent: FlexAlign.SpaceBetween }) { Image($r('app.media.share')) .width(24) .height(24) Image($r('app.media.heart')) .width(24) .height(24) Image($r('app.media.square_and_pencil')) .width(24) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/pages/PageTwo.ets#L132-L168
c4c8f14da6991fa1675947b95d417b78f756237c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
transform
V2新老版本字段转换逻辑 @param resultSet 查询结果集 @param targetVersion 目标版本 @returns 目标版本格式数据
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { // 将teacherName字段改为teacherFirstName字段 return this.transformV2ToV3(resultSet); } else { throw new Error('The database version to which you need to upgrade is incorrect');...
AST#method_declaration#Left transform AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetVersi...
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { return this.transformV2ToV3(resultSet); } else { throw new Error('The database version to which you need to upgrade is incorrect'); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L137-L144
6ab3fe91bec1a23bba8e570ac06e683328c77d62
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Returns windowStage of named by the id. @param id The id. @returns The window.WindowStage.
export function windowStage_of_id(id: string) { let windowStages = AppStorage.get('windowStages') as window.WindowStage[]; let idx = window_index_of_id(id); return windowStages[idx]; }
AST#export_declaration#Left export AST#function_declaration#Left function windowStage_of_id 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#block_statement#Left { A...
export function windowStage_of_id(id: string) { let windowStages = AppStorage.get('windowStages') as window.WindowStage[]; let idx = window_index_of_id(id); return windowStages[idx]; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L471-L475
9709700f7d6103f1e454711534cc463d15ebc3b6
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
getSideBarType
获得侧边栏与内容区的显示关系
private getSideBarType(): SideBarContainerType { if (this.windowUtil.mainWindowInfo.widthBp < WidthBreakpoint.WIDTH_LG) { return SideBarContainerType.Overlay; } return SideBarContainerType.Embed; }
AST#method_declaration#Left private getSideBarType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SideBarContainerType AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#...
private getSideBarType(): SideBarContainerType { if (this.windowUtil.mainWindowInfo.widthBp < WidthBreakpoint.WIDTH_LG) { return SideBarContainerType.Overlay; } return SideBarContainerType.Embed; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L515-L520
c103cab69c82bb65a270fab6bbab96d26e946bee
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
isCookieAllowed
获取WebCookieManager实例是否拥有发送和接收cookie的权限。 @returns
static isCookieAllowed(): boolean { return webview.WebCookieManager.isCookieAllowed(); }
AST#method_declaration#Left static isCookieAllowed AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_ex...
static isCookieAllowed(): boolean { return webview.WebCookieManager.isCookieAllowed(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L162-L164
a5c3596f62ce30d45e52aa063d532829d06b3768
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/ConnectionUtils.ets
arkts
registerNetworkAvailableStatus
The method of listening to the network status.
registerNetworkAvailableStatus() { this.netConnection.on('netAvailable', () => { promptAction.showToast({ message: $r('app.string.Network_Available'), duration: 2000 }); }); this.netConnection.on('netUnavailable', () => { promptAction.showToast({ message: $r('app.s...
AST#method_declaration#Left registerNetworkAvailableStatus 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#ex...
registerNetworkAvailableStatus() { this.netConnection.on('netAvailable', () => { promptAction.showToast({ message: $r('app.string.Network_Available'), duration: 2000 }); }); this.netConnection.on('netUnavailable', () => { promptAction.showToast({ message: $r('app.s...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/ConnectionUtils.ets#L61-L82
60a54a986df6a83dbf39e8c8785051867a582aa1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/data/ToolData.ets
arkts
更多功能 中组件信息对象
export default class ToolData { private imgResource: Resource; private bundleName: string; private abilityName: string; private parameters?: Record<string, Object>; constructor(imgResource: Resource, bundleName: string, abilityName: string, parameters?: Record<string, Object>) { this.imgResource = imgRes...
AST#export_declaration#Left export default AST#class_declaration#Left class ToolData AST#class_body#Left { AST#property_declaration#Left private imgResource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaratio...
export default class ToolData { private imgResource: Resource; private bundleName: string; private abilityName: string; private parameters?: Record<string, Object>; constructor(imgResource: Resource, bundleName: string, abilityName: string, parameters?: Record<string, Object>) { this.imgResource = imgRes...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/data/ToolData.ets#L19-L65
2b540261544e544da9ed98ad424cafca6295ea98
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets
arkts
Declare TreeController @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare TreeController @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class TreeController { /** * Delete a node. * Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Delete a node. * Register an ON_ITEM...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TreeController AST#class_body#Left { /** * Delete a node. * Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. * @syscap SystemCapabil...
export declare class TreeController { removeNode(): void; modifyNode(): void; addNode(nodeParam?: NodeParam): TreeController; refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void; buildDone(): void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets#L445-L542
429b769325711df63452bb6871fb7abc9db7a38f
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
unregisterDataChangeListener
注销数据改变的监听器 @param listener
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { this.listeners.splice(pos, 1); } }
AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { this.listeners.splice(pos, 1); } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets#L238-L243
41681500d1fd638fdbe0104fe33ab27b98884ad2
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/CountDownTimer.ets
arkts
pause
暂停倒计时
pause(): void { this.isPaused = true; }
AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre...
pause(): void { this.isPaused = true; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L93-L95
8cfd38f677498db6b6f7218895b22fab05914c84
gitee
BlingCc233/ArkTs_FlipClock.git
c67675869e289f7d472dd68fc2aea8c20f66790e
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content...
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/BlingCc233/ArkTs_FlipClock.git/blob/c67675869e289f7d472dd68fc2aea8c20f66790e/entry/src/main/ets/entryability/EntryAbility.ets#L87-L90
da5fe93a0fbce121885907e8a918d74839663061
github
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/utils/Logger.ets
arkts
formatArgs
格式化 args 为字符串
private formatArgs(args: string[]): string { return args.map(arg => { if (typeof arg === 'object') { try { return JSON.stringify(arg); } catch { return '[Object]'; } } return String(arg); }).join(' '); }
AST#method_declaration#Left private formatArgs AST#parameter_list#Left ( AST#parameter#Left args : 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_list#Right : AST#type_annotation#Left...
private formatArgs(args: string[]): string { return args.map(arg => { if (typeof arg === 'object') { try { return JSON.stringify(arg); } catch { return '[Object]'; } } return String(arg); }).join(' '); }
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/utils/Logger.ets#L13-L24
8a57a2af394825a7dded1ff8be29879f0593799b
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets
arkts
searchDreams
执行搜索
async searchDreams(keyword: string) { try { this.isDreamsLoading = true; // 确保使用当前登录用户ID const userId = this.userSession.getUserId(); const result = await searchDreams(userId, keyword); this.dreams = result.content; console.info(`搜索梦想成功,userId: ${userId}, 关键词: ${keyword}, 结果数量: $...
AST#method_declaration#Left async searchDreams AST#parameter_list#Left ( AST#parameter#Left keyword : 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#try_statement#Left...
async searchDreams(keyword: string) { try { this.isDreamsLoading = true; const userId = this.userSession.getUserId(); const result = await searchDreams(userId, keyword); this.dreams = result.content; console.info(`搜索梦想成功,userId: ${userId}, 关键词: ${keyword}, 结果数量: ${this.dreams.le...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets#L56-L69
68cd5e3e97cad57b94a6e8d2161e70809c2bd3fa
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets
arkts
showDebug
Outputs debug-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showDebug(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) { hilog.debug(DOMAIN, tag, format, args); } }
AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static showDebug(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) { hilog.debug(DOMAIN, tag, format, args); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets#L31-L35
9047891b6e125b925ca2304ed15674a5c18868ca
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildSendSettings
构建发送设置
@Builder buildSendSettings() { Column({ space: 12 }) { Text('发送设置') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) // 发送方式选择 Column({ space: 8 }) { Text('发送方式') .fontSize(14) .fontC...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendSettings 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#component_p...
@Builder buildSendSettings() { Column({ space: 12 }) { Text('发送设置') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 8 }) { Text('发送方式') .fontSize(14) .fontColor('#66...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L493-L540
480d37497820ed6587d2d639d83ddb08b64e3139
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets
arkts
requestHomePage
请求首页
requestHomePage() { //http请求对象 let httpRequest = http.createHttp(); httpRequest.request(this.homePageUrl) .then((resp) => { this.msgHistory += "响应码:" + resp.responseCode + "\r\n" this.msgHistory += resp.result + "\r\n" }) .catch((e) => { this.msgHistory += "请求失败:" ...
AST#method_declaration#Left requestHomePage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //http请求对象 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#Le...
requestHomePage() { let httpRequest = http.createHttp(); httpRequest.request(this.homePageUrl) .then((resp) => { this.msgHistory += "响应码:" + resp.responseCode + "\r\n" this.msgHistory += resp.result + "\r\n" }) .catch((e) => { this.msgHistory += "请求失败:" + e.messag...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets#L131-L143
9d0b8f53b8875d6959b73f0b4332e528aff63981
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppDelay/entry/src/main/ets/pages/CameraPage.ets
arkts
[End camera_release_before]
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres...
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CameraPage.ets#L61-L74
71d02e175043787c2329fbec89b6a68f60d6257d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
arkts
setQRCodeScanAnimation
扫描扫描动画
setQRCodeScanAnimation() { setInterval(() => { animateTo({ duration: 1000, // 动画时间 tempo: 0.5, // 动画速率 curve: Curve.EaseInOut, delay: 200, // 动画延迟时间 iterations: -1, // 动画是否重复播放 playMode: PlayMode.Normal, }, () => { this.animationOrdinate = 390 // 扫...
AST#method_declaration#Left setQRCodeScanAnimation 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 setInterval ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_...
setQRCodeScanAnimation() { setInterval(() => { animateTo({ duration: 1000, tempo: 0.5, curve: Curve.EaseInOut, delay: 200, iterations: -1, playMode: PlayMode.Normal, }, () => { this.animationOrdinate = 390 }) }, 2000) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets#L269-L282
bc6af29f1d7b97f022cba5e47018e4653c8d3d9e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildBirthdayTab
构建生日分析标签页
@Builder buildBirthdayTab(birthday: BirthdayStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { // 月份分布图 Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('月份分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWei...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayTab AST#parameter_list#Left ( AST#parameter#Left birthday : AST#type_annotation#Left AST#primary_type#Left BirthdayStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_f...
@Builder buildBirthdayTab(birthday: BirthdayStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('月份分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(Font...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L277-L419
ca7955b7c223d5ffde8588b06094933db7f5cfdc
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/RequstUpload/entry/src/main/ets/pages/Index.ets
arkts
uploadFile
上传文件
async uploadFile() { let context = getContext(this) let segments = this.uploadFilePath.split('/') //文件名称 let fileName = segments[segments.length-1] //计划复制到的目标路径 let realUri = context.cacheDir + "/" + fileName //复制选择的文件到沙箱cache文件夹 try { let file = await fs.open(this.uploadFilePath...
AST#method_declaration#Left async uploadFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#ar...
async uploadFile() { let context = getContext(this) let segments = this.uploadFilePath.split('/') let fileName = segments[segments.length-1] let realUri = context.cacheDir + "/" + fileName try { let file = await fs.open(this.uploadFilePath); fs.copyFileSync(file.fd, real...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/RequstUpload/entry/src/main/ets/pages/Index.ets#L99-L140
f32a3f39c5ba6c6fe58999af8245899f7c0fb1f6
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawLabels
Set this to true to enable drawing the labels of this axis (this will not affect drawing the grid lines or axis lines). @param enabled
public setDrawLabels(enabled: boolean): void { this.mDrawLabels = enabled; }
AST#method_declaration#Left public setDrawLabels AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
public setDrawLabels(enabled: boolean): void { this.mDrawLabels = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L342-L344
69e7e07d3f39d5bfbfc39aa2e08b578c8803d500
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/view/TargetInformation.ets
arkts
opacityTextStyle
Custom Transparent Text Styles
@Extend(Text) function opacityTextStyle() { .fontSize($r('app.float.text_font')) .fontColor($r('app.color.title_black_color')) .opacity(CommonConstants.OPACITY) .fontWeight(CommonConstants.FONT_WEIGHT) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function opacityTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST...
@Extend(Text) function opacityTextStyle() { .fontSize($r('app.float.text_font')) .fontColor($r('app.color.title_black_color')) .opacity(CommonConstants.OPACITY) .fontWeight(CommonConstants.FONT_WEIGHT) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetInformation.ets#L112-L117
842513cbbd90644a8979e434777133305ff253e1
gitee
zeroone001/harmonyAPP.git
49c8fa1b56de89cb7513b25f3b1b753ba857968a
features/learning/Index.ets
arkts
CourseLearning
export { MainPage } from './src/main/ets/components/MainPage'
export { CourseLearning } from './src/main/ets/pages/CourseLearning';
AST#export_declaration#Left export { CourseLearning } from './src/main/ets/pages/CourseLearning' ; AST#export_declaration#Right
export { CourseLearning } from './src/main/ets/pages/CourseLearning';
https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/features/learning/Index.ets#L2-L2
2a3d4efec6c433e6e25e21e4d9bd845a93cdb65f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
类型声明:处理参数为BusinessError类型的回调
export interface CatchCbWrapper { call: (err: BusinessError) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CatchCbWrapper AST#object_type#Left { AST#type_member#Left call : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#R...
export interface CatchCbWrapper { call: (err: BusinessError) => void; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L34-L36
0a1e58be0e79bcc8330a43bb23abaceab95775e3
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/SettingsPage.ets
arkts
handleAvatarSelect
处理头像选择
private async handleAvatarSelect(avatar: string): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Avatar selected: %{public}s', avatar); await this.userManager.updateAvatar(avatar); this.showAvatarPicker = false; promptAction.showToast({ message: '头像已更新', duration: 1500 ...
AST#method_declaration#Left private async handleAvatarSelect AST#parameter_list#Left ( AST#parameter#Left avatar : 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#ge...
private async handleAvatarSelect(avatar: string): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Avatar selected: %{public}s', avatar); await this.userManager.updateAvatar(avatar); this.showAvatarPicker = false; promptAction.showToast({ message: '头像已更新', duration: 1500 ...
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/SettingsPage.ets#L67-L83
8bebf442ad033a7fa89b8823da78180f3a2bb035
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getFormattedOtaStatus
通过eventInfo获取OtaStatus 同时对status、percent数据进行调整 @param eventInfo 事件 @return OtaStatus 实例
private getFormattedOtaStatus(eventInfo: update.EventInfo): OtaStatus { let endReason: string = eventInfo.taskBody?.errorMessages?.[0]?.errorCode?.toString(); let otaStatus: OtaStatus = { status: eventInfo.taskBody?.status, percent: eventInfo.taskBody?.progress, endReason: !endReason || endRea...
AST#method_declaration#Left private getFormattedOtaStatus AST#parameter_list#Left ( AST#parameter#Left eventInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . EventInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#...
private getFormattedOtaStatus(eventInfo: update.EventInfo): OtaStatus { let endReason: string = eventInfo.taskBody?.errorMessages?.[0]?.errorCode?.toString(); let otaStatus: OtaStatus = { status: eventInfo.taskBody?.status, percent: eventInfo.taskBody?.progress, endReason: !endReason || endRea...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L416-L427
f183a900584bd2afb00faaabf2c98ade40f92916
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets
arkts
notifyDataAdd
通知控制器添加数据
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets#L59-L63
06886a755fc25a57209b6ca847ef9d449a5403e4
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets
arkts
poetNameToName
给我一个字符串 处理后返回诗人的名字
poetNameToName(poetName: string) { return poetName.split(Constants.separator)[1] }
AST#method_declaration#Left poetNameToName AST#parameter_list#Left ( AST#parameter#Left poetName : 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#return_statement#Left...
poetNameToName(poetName: string) { return poetName.split(Constants.separator)[1] }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L26-L28
6bd36e1054f9b128bd31f1c8ce84aede999cf55f
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/view/TopicContentComponent.ets
arkts
TopicContentComponent
Topic content subcomponent.
@Component export struct TopicContentComponent { @Consume topicInfo: ResourceStr; @Prop topicInfoList: TopicInfoList; private closeSheet: () => void = () => { }; getResourceString(resource: Resource): string { let resourceString: string = ''; try { resourceString = getContext(this).resourceMana...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopicContentComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right topicInfo : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Ri...
@Component export struct TopicContentComponent { @Consume topicInfo: ResourceStr; @Prop topicInfoList: TopicInfoList; private closeSheet: () => void = () => { }; getResourceString(resource: Resource): string { let resourceString: string = ''; try { resourceString = getContext(this).resourceMana...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/TopicContentComponent.ets#L23-L76
0c78a008c399eea505546a2e25bdd849f46f5eeb
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/advertisingpage/Index.ets
arkts
AdvertisingPageComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { AdvertisingPageComponent } from './src/main/ets/components/AdvertisingPage';
AST#export_declaration#Left export { AdvertisingPageComponent } from './src/main/ets/components/AdvertisingPage' ; AST#export_declaration#Right
export { AdvertisingPageComponent } from './src/main/ets/components/AdvertisingPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/advertisingpage/Index.ets#L16-L16
85e3dd07e7493043abfb0907a0a70732da841d47
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
digest
对称密钥SymKey SHA摘要,同步 @param data 待摘要的数据 @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @returns
static async digest(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, algName, resultCoding); }
AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#...
static async digest(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, algName, resultCoding); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L37-L40
d4b91ec4183ec44037aceae72b137a16a53cdc7c
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
features/hspC/src/main/ets/pages/Index.ets
arkts
aboutToAppear
@State pathStack: NavPathStack = ZRouter.getNavStack()
aboutToAppear(): void { // this.message = ZRouter.getParamByName('hspCIndex').toString() // let param = JSON.stringify(ZRouter.getParam() || '') // this.message = param // 获取当前页的装饰器上参数 console.debug('aboutToAppear: ', JSON.stringify(ZRouter.getAnnotationParam())) console.debug('aboutToAppear p...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // this.message = ZRouter.getParamByName('hspCIndex').toString() // let param = JSON.str...
aboutToAppear(): void { console.debug('aboutToAppear: ', JSON.stringify(ZRouter.getAnnotationParam())) console.debug('aboutToAppear param key: ' + ZRouter.getInstance().getParamByKey<string>('key1')) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/hspC/src/main/ets/pages/Index.ets#L11-L20
be4b9dd8dcfe3d672085b19072da8b6b46b4b95e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
arkts
createPublicDirFileAsset
在媒体公共资源目录下的创建指定类型的资源对象
async createPublicDirFileAsset(fileDisplayName: string, fileByteBuffer: ArrayBuffer): Promise<string> { Logger.info("createPublicDirFileAsset start") // 获取mediaLibrary对象 let mediaLibraryObj = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context')) let fileAsset...
AST#method_declaration#Left async createPublicDirFileAsset AST#parameter_list#Left ( AST#parameter#Left fileDisplayName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileByteBuffer : AST#type_annotation#Left AST#primary_...
async createPublicDirFileAsset(fileDisplayName: string, fileByteBuffer: ArrayBuffer): Promise<string> { Logger.info("createPublicDirFileAsset start") let mediaLibraryObj = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context')) let fileAsset = await mediaLibra...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets#L225-L241
43c282d391bdc73038ba1e952ba869347a61bd36
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
$_instantiate
Set the value. @param { function } factory @param { PanGestureHandlerOptions } value @returns { PanGesture } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
static $_instantiate(factory: () => PanGesture, value?: PanGestureHandlerOptions): PanGesture;
AST#method_declaration#Left static $_instantiate AST#parameter_list#Left ( AST#parameter#Left factory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left PanGesture AST#primary_type#Right AST#type_annotation#Right AST#f...
static $_instantiate(factory: () => PanGesture, value?: PanGestureHandlerOptions): PanGesture;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L480-L480
fb8b804f5ed6bf8c12743a48ecf0a514b867e334
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/param/shared/utils/CardUtil.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class CardUtil { // 一个卡片镜像被其他图片关联,弹出页上的图片需要标记id,在此统一设置id public static getPostPageImageId(prePageClickedCardId: string | undefined): string | undefined { if (!prePageClickedCardId) { return undefined; } return 'Post_Page_Image' + prePageClickedCardId; } public static isLargeSize(): boo...
AST#export_declaration#Left export AST#class_declaration#Left class CardUtil AST#class_body#Left { // 一个卡片镜像被其他图片关联,弹出页上的图片需要标记id,在此统一设置id AST#method_declaration#Left public static getPostPageImageId AST#parameter_list#Left ( AST#parameter#Left prePageClickedCardId : AST#type_annotation#Left AST#union_type#Left AST#pri...
export class CardUtil { public static getPostPageImageId(prePageClickedCardId: string | undefined): string | undefined { if (!prePageClickedCardId) { return undefined; } return 'Post_Page_Image' + prePageClickedCardId; } public static isLargeSize(): boolean { let currentBreakPoint: strin...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/shared/utils/CardUtil.ets#L16-L31
a4186d2986c0a70ada6def428845e62acfcf4658
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/model/FormDate.ets
arkts
formTimeSlot
当前时间节点称谓
formTimeSlot(hour?: number): string { let now = hour ? hour : new Date().getHours(); let defaultResources: string | undefined = undefined; try { defaultResources = resourceManager!.getStringSync($r('app.string.morning').id); if (now >= 0 && now <= 8) { return resourceManager!.getStringSy...
AST#method_declaration#Left formTimeSlot AST#parameter_list#Left ( AST#parameter#Left hour ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
formTimeSlot(hour?: number): string { let now = hour ? hour : new Date().getHours(); let defaultResources: string | undefined = undefined; try { defaultResources = resourceManager!.getStringSync($r('app.string.morning').id); if (now >= 0 && now <= 8) { return resourceManager!.getStringSy...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/FormDate.ets#L56-L79
64833700cccf6decdeb2fc6846f6f4cf3980e5d6
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/api/FinVideoApiFactory.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2025/11/14 22:33 @Version V1.0 @Description
export class FinVideoApiFactory extends ApiFactory { constructor(context: Context) { super(context, "FinVideo") } protected onCreateApi<T extends CoreApi>(serverType: ServerType): T { if (serverType === ServerType.JELLYFIN) { return new JellyfinFinApi(this.context, this.clientInfo, this.deviceInfo...
AST#export_declaration#Left export AST#class_declaration#Left class FinVideoApiFactory extends AST#type_annotation#Left AST#primary_type#Left ApiFactory AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left contex...
export class FinVideoApiFactory extends ApiFactory { constructor(context: Context) { super(context, "FinVideo") } protected onCreateApi<T extends CoreApi>(serverType: ServerType): T { if (serverType === ServerType.JELLYFIN) { return new JellyfinFinApi(this.context, this.clientInfo, this.deviceInfo...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/api/FinVideoApiFactory.ets#L12-L27
1a4b9382dc21b3ad1c13a147366fcde8ce994077
github