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
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/auth/AuthService.ets
arkts
changePassword
修改密码
async changePassword(oldPassword: string, newPassword: string): Promise<boolean> { try { Logger.info('AuthService', 'Change password attempt'); // Mock 修改密码 // const response = await Http.post('/api/auth/change-password', { // oldPassword, // newPassword // }); ...
AST#method_declaration#Left async changePassword AST#parameter_list#Left ( AST#parameter#Left oldPassword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newPassword : AST#type_annotation#Left AST#primary_type#Left string ...
async changePassword(oldPassword: string, newPassword: string): Promise<boolean> { try { Logger.info('AuthService', 'Change password attempt'); Logger.info('AuthService', 'Password changed successfully'); return true; } catch (error) { Log...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L355-L371
7f4aa10b1e884335aa67acd7fa6808cc86de7380
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
query
eglQueryContext 查询成功返回number否则undefined @param attribute EGL_CONFIG_ID / EGL_CONTEXT_CLIENT_TYPE / EGL_CONTEXT_CLIENT_VERSION / EGL_RENDER_BUFFER
query(dpy: EGLDisplay, attribute: number): number | undefined;
AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left dpy : AST#type_annotation#Left AST#primary_type#Left EGLDisplay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attribute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ...
query(dpy: EGLDisplay, attribute: number): number | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L43-L43
c2a3841aed2f3e0f989b00caf4c30672b10d3ae7
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
scale
============================================================ 需解码类(硬解硬编) ============================================================ 视频缩放
public static scale(input: string, output: string, width: number, height: number): string[] { return [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-c:v', FFmpegFactory.HW_CODEC, '-c:a', 'copy', '-y', output ]; }
AST#method_declaration#Left public static scale AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
public static scale(input: string, output: string, width: number, height: number): string[] { return [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-c:v', FFmpegFactory.HW_CODEC, '-c:a', 'copy', '-y', output ]; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L63-L72
49088465e0e3d8852783b1a56cae7389ae5bc10e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
handleRebuy
处理再次购买逻辑 @param {Order} order - 订单信息 @returns {void} 无返回值
handleRebuy(order: Order): void { this.rebuyCurrentOrder = null; this.rebuyCartList = []; const cartList: Cart[] = this.convertOrderGoodsToCart(order); if (cartList.length > 1) { this.rebuyCurrentOrder = order; this.rebuyCartList = cartList; this.showRebuyModal(); return; } ...
AST#method_declaration#Left handleRebuy AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order 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#Right A...
handleRebuy(order: Order): void { this.rebuyCurrentOrder = null; this.rebuyCartList = []; const cartList: Cart[] = this.convertOrderGoodsToCart(order); if (cartList.length > 1) { this.rebuyCurrentOrder = order; this.rebuyCartList = cartList; this.showRebuyModal(); return; } ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L105-L121
07b418e054d69bf56ba45ffe17af3a265e17d048
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
getAllData
获取全部数据函数 @returns
public getAllData(): IChatMessage[] { return this.originDataArray; }
AST#method_declaration#Left public getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IChatMessage [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statemen...
public getAllData(): IChatMessage[] { return this.originDataArray; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L93-L95
a2555cb8c5396c5f5a07122202316ab908816434
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets
arkts
poetNameToName
给我一个字符串 处理后返回诗人的名字
poetNameToName(poetName: string) { return poetName.split(' · ')[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(' · ')[1] }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets#L18-L20
5d1e0df60b6a96a198aca7ef312f0814ccbe005f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/SpeechRecognizerHelper.ets
arkts
finish
结束识别。为了确保事件回调,请优先调用setListener。 @param sessionId 会话ID。
static finish(sessionId: string): void { SpeechRecognizerHelper.recognitionEngine?.finish(sessionId); }
AST#method_declaration#Left static finish AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#...
static finish(sessionId: string): void { SpeechRecognizerHelper.recognitionEngine?.finish(sessionId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L95-L97
495ef719d09f4839edbf49a814665d2c14d5d428
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/StrUtil.ets
arkts
camelCase
将字符串转换为驼峰 @param input 传入待转换字符串 @returns 转换后字符串
static camelCase(input: string = ''): string { if (!input) { return ''; } // 将字符串转换为小写,并按照空格、下划线、中划线来分割单词 const words = input.toLowerCase().split(/[\s_-]+/); // 将首字母小写的单词转换为驼峰命名 const output = ArrayUtil.removeEmptyValues(words).map((word: string, index) => { if (index === 0) { ...
AST#method_declaration#Left static camelCase AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
static camelCase(input: string = ''): string { if (!input) { return ''; } const words = input.toLowerCase().split(/[\s_-]+/); const output = ArrayUtil.removeEmptyValues(words).map((word: string, index) => { if (index === 0) { return word; } return word.charAt(0)...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L136-L150
6d24607da4d08c3629acc9393a37eaed2aa1d285
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
getSM2PubKey
获取转换SM2公钥, 将16进制的C1C2C3格式的SM2公钥转换为鸿蒙所需的ASN.1格式公钥字符串 @param pubKey 16进制的公钥字符串 @returns 转换后的公钥字符串
static getSM2PubKey(strPubKey: string): cryptoFramework.PubKey { strPubKey = strPubKey.startsWith("04") ? strPubKey.slice(2) : strPubKey; let px = strPubKey.substring(0, strPubKey.length / 2); //截取x参数 let py = strPubKey.substring(strPubKey.length / 2); //截取y参数 //转16进制放入对应的位置 04+x+y let pk: cryptoFra...
AST#method_declaration#Left static getSM2PubKey AST#parameter_list#Left ( AST#parameter#Left strPubKey : 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#qualified_ty...
static getSM2PubKey(strPubKey: string): cryptoFramework.PubKey { strPubKey = strPubKey.startsWith("04") ? strPubKey.slice(2) : strPubKey; let px = strPubKey.substring(0, strPubKey.length / 2); let py = strPubKey.substring(strPubKey.length / 2); let pk: cryptoFramework.Point = { x: BigInt("0...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L134-L153
97130100f7fdc217c71ebf06804ea146ca275112
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkData/PreferencesDemo/entry/src/main/ets/viewmodel/Sport.ets
arkts
Sport Data运动项目数据类
export default class Sport { /** * Sport event 运动项目. */ sportEvent: string = ''; /** * Exercise duration 运动时长. */ exerciseDuration: string = ''; }
AST#export_declaration#Left export default AST#class_declaration#Left class Sport AST#class_body#Left { /** * Sport event 运动项目. */ AST#property_declaration#Left sportEvent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expressi...
export default class Sport { sportEvent: string = ''; exerciseDuration: string = ''; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkData/PreferencesDemo/entry/src/main/ets/viewmodel/Sport.ets#L4-L13
fb675d75d87573ae4eefca6d78f5dd4c71cfafe4
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/recents/component.ets
arkts
RecentMissionsSingleLayout
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { RecentMissionsSingleLayout } from './src/main/ets/default/view/RecentMissionsSingleLayout';
AST#export_declaration#Left export { RecentMissionsSingleLayout } from './src/main/ets/default/view/RecentMissionsSingleLayout' ; AST#export_declaration#Right
export { RecentMissionsSingleLayout } from './src/main/ets/default/view/RecentMissionsSingleLayout';
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/recents/component.ets#L16-L16
55c8769d484272d70efcaf18be4aae7565b0a396
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/sns/wx/WxLoginManager.ets
arkts
import { AppSettings } from '../../../../app/constants/AppSettings'; import { getAppContext } from '../../../../app/constants/AppContext'; import { Toast } from '../../../../common/utils/Toast'; import { StringCrypto } from '../../../../common/utils/strings/StringCrypto'; import { DebugLog } from '../../../../app/debug...
export type SnsOneLoginCallback = (success: boolean, isCancelled: boolean, error?: string, user?: SnsOneUser) => void;
AST#export_declaration#Left export AST#type_declaration#Left type SnsOneLoginCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST...
export type SnsOneLoginCallback = (success: boolean, isCancelled: boolean, error?: string, user?: SnsOneUser) => void;
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/wx/WxLoginManager.ets#L21-L21
fde53f384fe283b89e32d66e6cc32a91483a0ab3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
decryptCBC
解密(CBC模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。 @returns
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string = '3DES192|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, params,transformation); }
AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string = '3DES192|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, params,transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L115-L118
e9ec0f4e56aef68d1a4e6a9be9ad7f62be45d5f9
gitee
dou101101/ZenFocus-HarmonyOS.git
9364599b8b20bc6377fc55ac68b991b61ceb8496
MyApplication/entry/build/default/generated/profile/default/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const BUNDLE_NAME = 'com.example.myapplication';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.example.myapplication' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BUNDLE_NAME = 'com.example.myapplication';
https://github.com/dou101101/ZenFocus-HarmonyOS.git/blob/9364599b8b20bc6377fc55ac68b991b61ceb8496/MyApplication/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
dd2e9456bbdb1a04501005a67fa928258163d6fd
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/LoadingDialog.ets
arkts
LoadingDialog
Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l...
@CustomDialog export default struct LoadingDialog { controller: CustomDialogController; build() { Column() { LoadingProgress() .height(150) .width(150) .color(Color.Blue) } .margin({ top: $r('app.float.size_30'), bottom: $r('app.float.size_30') }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct LoadingDialog AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AS...
@CustomDialog export default struct LoadingDialog { controller: CustomDialogController; build() { Column() { LoadingProgress() .height(150) .width(150) .color(Color.Blue) } .margin({ top: $r('app.float.size_30'), bottom: $r('app.float.size_30') }) } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/LoadingDialog.ets#L15-L28
08c3eda2ab7fc240daf86abe299006edbb3c9ad5
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
@Author csx @DateTime 2024/4/10 23:28 @TODO NotificationUtil 通知工具列 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
export class NotificationUtil { //添加跳转设置权限开启通知 //https://developer.huawei.com/consumer/cn/forum/topic/0208150584794898034 /** * 校验是否已授权通知服务 * @param callBack 回调函数 * @returns */ static async authorizeNotification(callBack: (index: number) => void): Promise<void> { //判断用户是否授权通知服务 let isAuth ...
AST#export_declaration#Left export AST#class_declaration#Left class NotificationUtil AST#class_body#Left { //添加跳转设置权限开启通知 //https://developer.huawei.com/consumer/cn/forum/topic/0208150584794898034 /** * 校验是否已授权通知服务 * @param callBack 回调函数 * @returns */ AST#method_declaration#Left static async authorizeNotif...
export class NotificationUtil { static async authorizeNotification(callBack: (index: number) => void): Promise<void> { let isAuth = await notificationManager.isNotificationEnabled(); if (!isAuth) { notificationManager.requestEnableNotification(getContext() as common.UIAbilityC...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L30-L420
820e5b3b6bc9165bf893050ffc45dc50708a5dcc
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/AboutPage.ets
arkts
handleCheckUpdate
处理检查更新点击
private handleCheckUpdate(): void { hilog.info(DOMAIN, TAG, 'Check update clicked'); promptAction.showToast({ message: '当前已是最新版本', duration: 2000 }); }
AST#method_declaration#Left private handleCheckUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AS...
private handleCheckUpdate(): void { hilog.info(DOMAIN, TAG, 'Check update clicked'); promptAction.showToast({ message: '当前已是最新版本', duration: 2000 }); }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/AboutPage.ets#L27-L33
e944116bffec6da1638715d1af2f0aac55d71886
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/tabs_actions.ets
arkts
Data and Statuses Syncs ALL tabs data into AppStorage. @param storage The LocalStorage of this window.
export function sync_all_tabs_list_info(storage: LocalStorage) { // let t0 = Date.now(); // let t = 0; // TODO: Efficiency can be further improved. e.g. update only one tab information instead of re-fetching the entire list. // This should work let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs; let ...
AST#export_declaration#Left export AST#function_declaration#Left function sync_all_tabs_list_info AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s...
export function sync_all_tabs_list_info(storage: LocalStorage) { let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs; let tab_titles = tabs.get_all_titles(); let tab_urls = tabs.get_all_urls(); let tab_is_loading = tabs.get_all_is_loading(); let tab_loading_progresses = tabs.get_all_loading_...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L13-L42
2e33d31bde2c13186daf49ec3c0226435d99838d
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildAddTaskSection
构建添加任务区域
@Builder buildAddTaskSection() { Row() { TextInput({ placeholder: '输入任务名称...', text: this.newTaskName }) .onChange((value: string) => { this.newTaskName = value; }) .layoutWeight(1) .height(40) Button('添加任务') .type(ButtonType.Normal) .backgrou...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAddTaskSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui...
@Builder buildAddTaskSection() { Row() { TextInput({ placeholder: '输入任务名称...', text: this.newTaskName }) .onChange((value: string) => { this.newTaskName = value; }) .layoutWeight(1) .height(40) Button('添加任务') .type(ButtonType.Normal) .backgrou...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L61-L81
5b85d57f02dc4b6cae90dd81322622972352989d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
totalCount
获取数据总数
public totalCount(): number { return this.dataArray.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.dataArray.length; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L68-L70
86dab09ecb7fac36f81c5549da63658396260e07
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets
arkts
NewsList
The news list component.
@Component export default struct NewsList { @State newsModel: NewsModel = new NewsModel(); @Watch('changeCategory') @Link currentIndex: number; changeCategory() { this.newsModel.currentPage = 1; NewsViewModel.getNewsList(this.newsModel.currentPage, this.newsModel.pageSize, Const.GET_NEWS_LIST) .the...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct NewsList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newsModel : AST#type_annotation#Left AST#primary_type#Left NewsModel AST#primary_type#Right AST#t...
@Component export default struct NewsList { @State newsModel: NewsModel = new NewsModel(); @Watch('changeCategory') @Link currentIndex: number; changeCategory() { this.newsModel.currentPage = 1; NewsViewModel.getNewsList(this.newsModel.currentPage, this.newsModel.pageSize, Const.GET_NEWS_LIST) .the...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsList.ets#L30-L148
bf69bfbfba69d6723d106809006e415a4e056bd2
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SimpleChatList/entry/src/main/ets/pages/ScrollToTheBottom.ets
arkts
[StartExclude Scroller]
build() { NavDestination() { // [EndExclude Scroller] // [Start initialIndex] List({ space: 20, initialIndex: this.arr.length - 1, scroller: this.scroller }) { // [StartExclude Scroller] ForEach(this.arr, (item: number) => { ListItem() { // [StartExclude init...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { // [EndExclude Scroller] // [Start initialIndex] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Lef...
build() { NavDestination() { List({ space: 20, initialIndex: this.arr.length - 1, scroller: this.scroller }) { ForEach(this.arr, (item: number) => { ListItem() { Text('' + item) .width('100%') .height(100) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/ScrollToTheBottom.ets#L25-L67
9a71181255ad63c33236ce75fc251d23364f97c6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/MultiDeviceAppDev/MultiMusic/entry/src/main/ets/model/DataType.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class IconItem { imageSrc: Resource; description: Resource | string; constructor(imageSrc: Resource, description: Resource | string) { this.imageSrc = imageSrc; this.description = description; } }
AST#export_declaration#Left export AST#class_declaration#Left class IconItem AST#class_body#Left { AST#property_declaration#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left description ...
export class IconItem { imageSrc: Resource; description: Resource | string; constructor(imageSrc: Resource, description: Resource | string) { this.imageSrc = imageSrc; this.description = description; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/MultiMusic/entry/src/main/ets/model/DataType.ets#L16-L24
d45726cc404f3abfba34c2936125b7c314904d7a
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/others/NetState/entry/src/main/ets/pages/Index.ets
arkts
listenButClick
监听按钮点击
listenButClick() { this.listening = !this.listening if (this.listening) { this.currentNet = connection.createNetConnection() this.currentNet.register((error) => { if (error) { this.msgHistory += "订阅失败" + JSON.stringify(error) + "\r\n" } else { this.msgHistory += ...
AST#method_declaration#Left listenButClick 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 . listening AST#member_expression#Rig...
listenButClick() { this.listening = !this.listening if (this.listening) { this.currentNet = connection.createNetConnection() this.currentNet.register((error) => { if (error) { this.msgHistory += "订阅失败" + JSON.stringify(error) + "\r\n" } else { this.msgHistory += ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/others/NetState/entry/src/main/ets/pages/Index.ets#L58-L115
6c0f8754b64ab0bc442907dd13fd2589c1dfed66
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
frameworks/text/interface/export/ani/@ohos.graphics.text.ets
arkts
Decoration for text. @typedef Decoration @syscap SystemCapability.Graphics.Drawing @since 12
export interface Decoration { /** * Decorates text by line. * @type { ?TextDecorationType } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ textDecoration?: TextDecorationType; /** * Text color. * @type { ?common2D.Color } * @syscap SystemCapability.Graphi...
AST#export_declaration#Left export AST#interface_declaration#Left interface Decoration AST#object_type#Left { /** * Decorates text by line. * @type { ?TextDecorationType } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#type_member#Left textDecoration ? : AST#type_annotation#Left...
export interface Decoration { textDecoration?: TextDecorationType; color?: common2D.Color; decorationStyle?: TextDecorationStyle; decorationThicknessScale?: number; }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L1205-L1237
064e7a21a013b3d244ee83eb01051c78b3bbc098
gitee
YueHua46/ArkTS_Learn.git
5c08d3016421c69c299f7cb757df686f277889ac
entry/src/main/ets/pages/RankPage.ets
arkts
onBackPress
3.onBackPress(其他页面返回到该页面)
onBackPress() { return false; }
AST#method_declaration#Left onBackPress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right }...
onBackPress() { return false; }
https://github.com/YueHua46/ArkTS_Learn.git/blob/5c08d3016421c69c299f7cb757df686f277889ac/entry/src/main/ets/pages/RankPage.ets#L27-L29
abe6ae0d472da9572482d751db3d6218104b4cda
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
getDataSyncStr
读取系统剪贴板里的字符串。该方法已废弃,建议使用getDataStrSync()。 @returns
static getDataSyncStr(): string { return PasteboardUtil.getDataStrSync(); }
AST#method_declaration#Left static getDataSyncStr AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expr...
static getDataSyncStr(): string { return PasteboardUtil.getDataStrSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L374-L376
3d5cb2899ed95997af55f091b580d80032679a04
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/feedback/Index.ets
arkts
FeedbackGraph
@file feedback 模块统一导出 @author Joker.X
export { FeedbackGraph } from "./src/main/ets/navigation/FeedbackGraph";
AST#export_declaration#Left export { FeedbackGraph } from "./src/main/ets/navigation/FeedbackGraph" ; AST#export_declaration#Right
export { FeedbackGraph } from "./src/main/ets/navigation/FeedbackGraph";
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/Index.ets#L6-L6
7b8a4a9b2424993882ff1eebaca45ac20ca77f08
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/LoginPage.ets
arkts
LoginPage
@file 登录页面视图 @author Joker.X
@ComponentV2 export struct LoginPage { /** * 登录页面 ViewModel */ @Local private vm: LoginViewModel = new LoginViewModel(); /** * 构建登录页面 * @returns {void} 无返回值 */ build(): void { AppNavDestination({ viewModel: this.vm, pageBackgroundColor: $r("app.color.bg_white"), titleOpti...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LoginPage AST#component_body#Left { /** * 登录页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left LoginViewMod...
@ComponentV2 export struct LoginPage { @Local private vm: LoginViewModel = new LoginViewModel(); build(): void { AppNavDestination({ viewModel: this.vm, pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") } }) { this.Login...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L24-L193
8ca48e11536eee0cf90201bcf9fd770353d0dd4c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoTrimmerOption.ets
arkts
VideoTrimmerOption
视频剪辑参数选项
@Observed export class VideoTrimmerOption { constructor() { this.scaleNum = 100; this.video_max_time = 8; this.video_min_time = 3; this.max_count_range = 8; this.thumb_width = 30; this.padding_line_height = 10; } // 源文件路径 @Track srcFilePath: string = ''; // 视频剪辑回调接口 @Track listener:...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class VideoTrimmerOption AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#...
@Observed export class VideoTrimmerOption { constructor() { this.scaleNum = 100; this.video_max_time = 8; this.video_min_time = 3; this.max_count_range = 8; this.thumb_width = 30; this.padding_line_height = 10; } @Track srcFilePath: string = ''; @Track listener: VideoTrimListener ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoTrimmerOption.ets#L23-L69
4e33f3a84d80741bc1bcf40f8f8998b6a747a64c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
LunarCalendar_Fixed.ets
arkts
getLeapMonth
获取农历年闰月月份
private static getLeapMonth(lunarYear: number): number { if (lunarYear < 1900 || lunarYear > 2100) { return 0; } return LeapMonths.getLeapMonth(lunarYear); }
AST#method_declaration#Left private static getLeapMonth AST#parameter_list#Left ( AST#parameter#Left lunarYear : 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 number A...
private static getLeapMonth(lunarYear: number): number { if (lunarYear < 1900 || lunarYear > 2100) { return 0; } return LeapMonths.getLeapMonth(lunarYear); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L252-L257
94877a18d81b89159a57443f5524fbe585cb504b
github
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/Manage.ets
arkts
getWeatherBgColor
通过Prop接收城市数据 根据天气返回对应的背景色
private getWeatherBgColor(weather: string): string { const weatherColors: Record<string, string> = { '晴': '#fff1cd02', '多云': '#A0B4C8', '小雨': '#B3C6E0', '大雨': '#4A6FA5', '阴': '#C0C0C0' }; return weatherColors[weather] || '#5F7D8C'; }
AST#method_declaration#Left private getWeatherBgColor AST#parameter_list#Left ( AST#parameter#Left weather : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#p...
private getWeatherBgColor(weather: string): string { const weatherColors: Record<string, string> = { '晴': '#fff1cd02', '多云': '#A0B4C8', '小雨': '#B3C6E0', '大雨': '#4A6FA5', '阴': '#C0C0C0' }; return weatherColors[weather] || '#5F7D8C'; }
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/Manage.ets#L119-L128
d4b72ec6681186d974ec851b69ad8f4fc4bbd95f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
getFormatDateStr
获取格式化日期,将传入的日期格式化为指定格式的字符串 @param date @param format 格式化字符串,(yyyy-MM-dd HH:mm:ss) @returns
static getFormatDateStr(date: number | string | Date, format?: string): string { date = Helper.getFormatDate(date) if (format === undefined || format.length <= 0) { format = 'yyyy-MM-dd HH:mm:ss'; //yyyy-MM-dd HH:mm:ss } let year = date.getFullYear(); //年份,例如 2024 let month = Helper.padZero(da...
AST#method_declaration#Left static getFormatDateStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_typ...
static getFormatDateStr(date: number | string | Date, format?: string): string { date = Helper.getFormatDate(date) if (format === undefined || format.length <= 0) { format = 'yyyy-MM-dd HH:mm:ss'; } let year = date.getFullYear(); let month = Helper.padZero(date.getMonth() + 1); let day ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L111-L131
96f32f55a421747ca21ade0f497e1deba0c13f31
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets
arkts
decryptMessage
解密消息
function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM2_256|SM3'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le...
function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM2_256|SM3'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets#L28-L33
016d23ad733f53090711d7d29255b0e220f84360
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
isDefaultNetMeteredSync
检查当前网络上的数据流量使用是否被计量 @returns
static isDefaultNetMeteredSync(): boolean { return connection.isDefaultNetMeteredSync(); }
AST#method_declaration#Left static isDefaultNetMeteredSync 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...
static isDefaultNetMeteredSync(): boolean { return connection.isDefaultNetMeteredSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L45-L47
a66c50b1fc93901fdf91e492a1359aa6ed5addf2
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
arkts
notEqual
判断两个传入的数值或者是字符串是否不相等 @param source @param target @returns
static notEqual(source: string | number, target: string | number): boolean { return false === StringUtil.equal(source, target); }
AST#method_declaration#Left static notEqual AST#parameter_list#Left ( AST#parameter#Left source : 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#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS...
static notEqual(source: string | number, target: string | number): boolean { return false === StringUtil.equal(source, target); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L163-L165
dffffbcfb9b647c2417acd5a5465f13f1f05444a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringUtils.ets
arkts
trimedString
去除前后空格 @param str 输入字符串 @returns 处理后的字符串
static trimedString(str: string): string { return str.trim(); }
AST#method_declaration#Left static trimedString AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static trimedString(str: string): string { return str.trim(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L34-L36
98f5ab29dc2eb0016454ff78b8b6e3508484d158
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
getService
查询服务 @param serviceId 服务id @return AbstractService 服务实例
public getService(serviceId: string): AbstractService | undefined { return this.services.get(serviceId); }
AST#method_declaration#Left public getService AST#parameter_list#Left ( AST#parameter#Left serviceId : 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#union_type#Left AST#primary_type#Lef...
public getService(serviceId: string): AbstractService | undefined { return this.services.get(serviceId); }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L106-L108
f878536f6c9c7af6e638124d34d67c916f0181ab
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/AgvMovementService.ets
arkts
emergencyStop
紧急停止AGV @returns 控制结果
static async emergencyStop(): Promise<Object> { try { console.warn('[AgvMovementService] 🚨 紧急停止AGV'); const response = await AgvMovementService.agvStop(); console.info('[AgvMovementService] ✅ 紧急停止指令发送成功'); return response; } catch (error) { console.error('[AgvMovementService] ❌ 紧急...
AST#method_declaration#Left static async emergencyStop 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 Object AST#primary_type#Right AST#type_annotation#Right > AS...
static async emergencyStop(): Promise<Object> { try { console.warn('[AgvMovementService] 🚨 紧急停止AGV'); const response = await AgvMovementService.agvStop(); console.info('[AgvMovementService] ✅ 紧急停止指令发送成功'); return response; } catch (error) { console.error('[AgvMovementService] ❌ 紧急...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L140-L150
e2f77696a34a70ab89d717963de350005fb73a61
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/FootprintPage.ets
arkts
FootprintPage
@file 足迹页面视图 @author Joker.X
@ComponentV2 export struct FootprintPage { /** * 足迹页面 ViewModel */ @Local private vm: FootprintViewModel = new FootprintViewModel(); /** * 构建足迹页面 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: "足迹", viewModel: this.vm }) { this.FootprintContent(); ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct FootprintPage AST#component_body#Left { /** * 足迹页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Footprin...
@ComponentV2 export struct FootprintPage { @Local private vm: FootprintViewModel = new FootprintViewModel(); build() { AppNavDestination({ title: "足迹", viewModel: this.vm }) { this.FootprintContent(); } } @Builder private FootprintContent() { Text("足迹页面内容视图") }...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/FootprintPage.ets#L8-L37
3305b22a88b6fcf0b3d463afda4b0010592502c9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/graphic/DisplaySoloist/entry/src/main/ets/pages/Index.ets
arkts
aboutToDisappear
[StartExclude display_soloist_create_xcomponent] [Start display_soloist_disappear]
aboutToDisappear(): void { Logger.info(TAG, 'aboutToDisappear'); if (this.xComponentContext1) { this.xComponentContext1.unregister(); this.xComponentContext1.destroy(); } if (this.xComponentContext2) { this.xComponentContext2.unregister(); this.xComponentContext2.destroy(); }...
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express...
aboutToDisappear(): void { Logger.info(TAG, 'aboutToDisappear'); if (this.xComponentContext1) { this.xComponentContext1.unregister(); this.xComponentContext1.destroy(); } if (this.xComponentContext2) { this.xComponentContext2.unregister(); this.xComponentContext2.destroy(); }...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/graphic/DisplaySoloist/entry/src/main/ets/pages/Index.ets#L29-L39
8ca7aed4dddee4b3dbd2011ca5e0cf0ebc7d8cfe
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
addData
在指定索引位置增加一个元素 @param index
public addData(index: number, data: NewsItem): void { this.dataList.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData 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#Left data : AST#type_annotation#Left AST#primary_type#Left NewsItem AST#primary_type#...
public addData(index: number, data: NewsItem): void { this.dataList.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L41-L44
d88de493fdff17f094a3b7012008a89200a1cf20
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/SQL/sqloperate.ets
arkts
校园动态OP
export function queryCommunityinfo(): Promise<CommunityItemData[]> { const STORE_CONFIG: relationalStore.StoreConfig = { name: 'campus.db', securityLevel: relationalStore.SecurityLevel.S3, }; return new Promise((resolve, reject) => { const communityPosts: CommunityItemData[] = []; const predicate...
AST#export_declaration#Left export AST#function_declaration#Left function queryCommunityinfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Co...
export function queryCommunityinfo(): Promise<CommunityItemData[]> { const STORE_CONFIG: relationalStore.StoreConfig = { name: 'campus.db', securityLevel: relationalStore.SecurityLevel.S3, }; return new Promise((resolve, reject) => { const communityPosts: CommunityItemData[] = []; const predicate...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/SQL/sqloperate.ets#L438-L487
4fcc151218dee246da86164b987708d68cacfc50
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.ets
arkts
del_search_engine
Remove a search engine from the current search engine list. @param index A number, the index of the search engine to be removed in the list.
static del_search_engine(index: number) { bunch_of_search_engines.list_of_search_engines.splice(index, 1); bunch_of_search_engines.update_last_accessed(); }
AST#method_declaration#Left static del_search_engine AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left A...
static del_search_engine(index: number) { bunch_of_search_engines.list_of_search_engines.splice(index, 1); bunch_of_search_engines.update_last_accessed(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L48-L51
d64b47399cc79ecc8ed6a41434d11947b26d7450
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
initialize
初始化互动游戏服务
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.GAME_PREFS); // 加载游戏统计 await this.loadGameStatistics(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'In...
AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.GAME_PREFS); await this.loadGameStatistics(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Interactive...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L200-L214
d1476bde07136ffe9f723e20c34e11f4da35d48f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
commentPost
评论帖子
async commentPost(postId: string, content: string, parentId?: string): Promise<Comment | null> { try { if (!this.currentUser) return null; const comment: Comment = { id: `comment_${Date.now()}`, postId, authorId: this.currentUser.id, author: this.currentUser, con...
AST#method_declaration#Left async commentPost AST#parameter_list#Left ( AST#parameter#Left postId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
async commentPost(postId: string, content: string, parentId?: string): Promise<Comment | null> { try { if (!this.currentUser) return null; const comment: Comment = { id: `comment_${Date.now()}`, postId, authorId: this.currentUser.id, author: this.currentUser, con...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L385-L411
077e6d5d0b6ac3d2f995e7347426b18b5fa0f3c9
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
getDenominator
Gets the denominator of the current object. @returns { number } Returns the denominator of the current object. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
getDenominator(): number;
AST#method_declaration#Left getDenominator AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
getDenominator(): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L981-L981
fa231086eb40d9a8efe79e500e5e4baebb9ef1ff
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/CountDownTimerView.ets
arkts
========== 构建视图 ==========
build() { Stack() { Canvas(this.ctx) .width('100%') .height('100%') .onReady(() => { try { this.draw(this.ctx) } catch(e) {} }) Row() { // IconTintButton({ // icon : this.paused || !this.running ? $r('app.media.roll') : $r('app.media.pause'), // i...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( AST#expression#Left AST#member_expression#Left ...
build() { Stack() { Canvas(this.ctx) .width('100%') .height('100%') .onReady(() => { try { this.draw(this.ctx) } catch(e) {} }) Row() { Text(`${this.remainSeconds.toFixed(0)}`) .fo...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/CountDownTimerView.ets#L63-L97
def54963299bc81c713370db8a6ba4a5173f0fef
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
updateConfig
更新配置
async updateConfig(newConfig: Partial<LocaleConfig>): Promise<void> { try { this.config = { ...this.config, ...newConfig }; await this.saveConfig(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'I18n config updated'); } catch (error) { hilog.error(LogConstants.DOMAIN_...
AST#method_declaration#Left async updateConfig AST#parameter_list#Left ( AST#parameter#Left newConfig : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LocaleConfig AST#primary_type#Right AST#type_annotation#Right > AS...
async updateConfig(newConfig: Partial<LocaleConfig>): Promise<void> { try { this.config = { ...this.config, ...newConfig }; await this.saveConfig(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'I18n config updated'); } catch (error) { hilog.error(LogConstants.DOMAIN_...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L474-L485
c053c15c1123dcccdd6414f66bef7bbc0fe2ef10
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/live/src/main/ets/constants/LiveConstants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class LiveConstants { /** * The width percentage setting. */ static readonly FULL_WIDTH_PERCENT: string = '100%'; /** * The height percentage setting. */ static readonly FULL_HEIGHT_PERCENT: string = '100%'; /** * The font family of title. */ static readonly LIVE_TITLE_FONT_FAMILY...
AST#export_declaration#Left export AST#class_declaration#Left class LiveConstants AST#class_body#Left { /** * The width percentage setting. */ AST#property_declaration#Left static readonly FULL_WIDTH_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right =...
export class LiveConstants { static readonly FULL_WIDTH_PERCENT: string = '100%'; static readonly FULL_HEIGHT_PERCENT: string = '100%'; static readonly LIVE_TITLE_FONT_FAMILY: string = 'HarmonyHeiTi-Bold'; static readonly CURRENT_BREAKPOINT: string = 'sm'; static readonly LIVE_ITEM_TITLE_FO...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/live/src/main/ets/constants/LiveConstants.ets#L16-L111
047bb0e21a988ff7d598c73e451b7747baac842a
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
buildQueryString
构建查询字符串
private buildQueryString(params: RouteParams): string { const parts: string[] = []; if (params.userId !== undefined) { parts.push(`userId=${encodeURIComponent(String(params.userId))}`); } if (params.pageId !== undefined) { parts.push(`pageId=${encodeURIComponent(String(params.pageId))}`); ...
AST#method_declaration#Left private buildQueryString AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS...
private buildQueryString(params: RouteParams): string { const parts: string[] = []; if (params.userId !== undefined) { parts.push(`userId=${encodeURIComponent(String(params.userId))}`); } if (params.pageId !== undefined) { parts.push(`pageId=${encodeURIComponent(String(params.pageId))}`); ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L226-L254
d52e8848f72f0c2fef50f16bd56c92497a60e2d4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets
arkts
============================================================ MARK: - 通知常量
export namespace DetailItemNotification { export enum Name { ItemVisibleOrderChanged = "Detail_Item_Visible_Order_Changed" }
AST#export_declaration#Left export AST#ERROR#Left namespace DetailItemNot if ication { export AST#ERROR#Right AST#enum_declaration#Left enum Name AST#enum_body#Left { AST#enum_member#Left ItemVisibleOrderChanged = AST#expression#Left "Detail_Item_Visible_Order_Changed" AST#expression#Right AST#enum_member#Right } AST#e...
export namespace DetailItemNotification { export enum Name { ItemVisibleOrderChanged = "Detail_Item_Visible_Order_Changed" }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L54-L57
a4b50f311fbbe7b47690e9133f0712396d6b7c96
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
arkts
sport
运动卡片
@Builder sport(planCardMes:courseInfoType) { Column({space:15}) { Text(planCardMes.cname) .fontSize(25) .fontColor('#ffffff') .fontWeight(900) Row({space:10}) { Image('image/plan/time.png') .width(15) .height(15) Text(planCardMes...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right sport AST#parameter_list#Left ( AST#parameter#Left planCardMes : AST#type_annotation#Left AST#primary_type#Left courseInfoType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function...
@Builder sport(planCardMes:courseInfoType) { Column({space:15}) { Text(planCardMes.cname) .fontSize(25) .fontColor('#ffffff') .fontWeight(900) Row({space:10}) { Image('image/plan/time.png') .width(15) .height(15) Text(planCardMes...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L243-L282
b0830c3a4189d842fd6c5690a6c195c8b9ccfe12
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TextureHypercompression/entry/src/main/ets/pages/TextureCompression.ets
arkts
TextureCompression
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...
@Component export struct TextureCompression { @State fontColor: string = '#000000'; @State currentIndex: number = 0; @State imageWidth: string = '10%'; @State imageHeight: number = 70; private controller: TabsController = new TabsController(); @Builder tabBuilder(index: number, name: string): void { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextureCompression AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#ty...
@Component export struct TextureCompression { @State fontColor: string = '#000000'; @State currentIndex: number = 0; @State imageWidth: string = '10%'; @State imageHeight: number = 70; private controller: TabsController = new TabsController(); @Builder tabBuilder(index: number, name: string): void { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TextureHypercompression/entry/src/main/ets/pages/TextureCompression.ets#L16-L335
fa4d09aec0f5c25b595159124be9ab86805ee848
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaEntity.ets
arkts
Copyright (C) 2024 桃花镇童长老 @nutpi/china_area 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, sof...
export interface AreaEntity { text: string; level: string; code: string; pcode: string; children: Array<AreaEntity>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AreaEntity AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left level : AST#type_annotation#Left A...
export interface AreaEntity { text: string; level: string; code: string; pcode: string; children: Array<AreaEntity>; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaEntity.ets#L15-L21
23b6a707ca58d6eefc813314289cf502b4aa0166
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
publishNotification
发布通知
private async publishNotification(config: NotificationConfig): Promise<void> { try { // 创建WantAgent用于点击处理 const wantAgentInfo = { wants: [ { bundleName: 'com.harmonyos.birthdayreminder', abilityName: 'EntryAbility', uri: config.actionUrl || '' ...
AST#method_declaration#Left private async publishNotification AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
private async publishNotification(config: NotificationConfig): Promise<void> { try { const wantAgentInfo = { wants: [ { bundleName: 'com.harmonyos.birthdayreminder', abilityName: 'EntryAbility', uri: config.actionUrl || '' } ], ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L212-L271
837234d49eaf1350762cb8bcb5dbff2ddf36bcf7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkChallengeDictUsable
/ 检查 挑战模式 是否可用
public checkChallengeDictUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 if (this.maxChallengeUseCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.challenge)) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manage...
AST#method_declaration#Left public checkChallengeDictUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Righ...
public checkChallengeDictUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } if (this.maxChallengeUseCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.challenge)) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manager_msg_limi...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L376-L387
a035d4206520a8afcc2b1a2270d99be3c6cbfcf8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
buildVerifyCodeComponent
TODO 知识点:部分验证码场景要完全禁止对输入验证码的选中、复制等功能,因此可以使用Text组件完成
@Builder buildVerifyCodeComponent() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { ForEach(this.codeIndexArray, (item: number, index: number) => { Text(this.codeText[item]) .verifyCodeUnitStyle() }, (item: number, inde...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildVerifyCodeComponent 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 Flex ( AST#component_parameters#Left { AST#compon...
@Builder buildVerifyCodeComponent() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { ForEach(this.codeIndexArray, (item: number, index: number) => { Text(this.codeText[item]) .verifyCodeUnitStyle() }, (item: number, inde...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets#L144-L167
78cc54eb8c5425190d291bfc2551fdc57da03836
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets
arkts
allBoxTypes
获取所有 BoxType 枚举值(模拟 Swift CaseIterable)
static allBoxTypes(): BoxType[] { return [ BoxType.New, BoxType.Rev1, BoxType.Rev2, BoxType.Rev3, BoxType.Rev4, BoxType.Rev5, BoxType.Rev6 ]; }
AST#method_declaration#Left static allBoxTypes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BoxType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Le...
static allBoxTypes(): BoxType[] { return [ BoxType.New, BoxType.Rev1, BoxType.Rev2, BoxType.Rev3, BoxType.Rev4, BoxType.Rev5, BoxType.Rev6 ]; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets#L63-L73
01c6efa63a1334e57f02d694b60a0cdc3bd58f96
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/ArrayStringUtils.ets
arkts
splitToWordsArray
中间有空格,分割为词语数组。无空格则分割为汉字数组 有空格: "中国 今天 大 家里 好的" -> [中国, 今天,大,家里,好的] 有一个空格: "中国 " -> [中国] 全部是单字: "中国人" -> [中,国,人] 无空格: "中国" -> [中, 国]
static splitToWordsArray(str: string, separator: string = " "): string[] { if (str.includes(separator)) { return str.split(separator).filter(item => item.length > 0); } else { return Array.from(str); } }
AST#method_declaration#Left static splitToWordsArray AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left separator : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static splitToWordsArray(str: string, separator: string = " "): string[] { if (str.includes(separator)) { return str.split(separator).filter(item => item.length > 0); } else { return Array.from(str); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L92-L98
38b17b14ec26934455e54df7494d7d248f9ea74f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkUnitUsable
/ 检查 单元 是否可用
public checkUnitUsable(curUnitNo: number, showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 if (this.maxFreeUnitsCount < curUnitNo) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_units')) } return false } ...
AST#method_declaration#Left public checkUnitUsable AST#parameter_list#Left ( AST#parameter#Left curUnitNo : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean...
public checkUnitUsable(curUnitNo: number, showMessage: boolean = true): boolean { if (this.isActive) { return true } if (this.maxFreeUnitsCount < curUnitNo) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_units')) } return false } retur...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L259-L270
5fba2536b58c41bad902d8a530461f92cdeda012
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/viewmodel/ReminderItem.ets
arkts
提醒项描述。
export default class ReminderItem { id: number = 0; // 提醒项唯一标识符 remindType: reminderAgent.ReminderType = reminderAgent.ReminderType.REMINDER_TYPE_ALARM; // 提醒类型,默认为闹钟 name: string = ''; // 提醒项名称 hour: number = 0; // 提醒小时 minute: number = 0; // 提醒分钟 duration: number = 0; // 提醒持续时间 intervalMinute: number = ...
AST#export_declaration#Left export default AST#class_declaration#Left class ReminderItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration...
export default class ReminderItem { id: number = 0; remindType: reminderAgent.ReminderType = reminderAgent.ReminderType.REMINDER_TYPE_ALARM; name: string = ''; hour: number = 0; minute: number = 0; duration: number = 0; intervalMinute: number = 0; intervalTimes: number = 0; repeatDays: Array<n...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/ReminderItem.ets#L6-L17
e63e9148b86beadbaa615cb908a918ea7bec0cc1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
openMultiCode
多个二维码,点击查看某个二维码信息 @param arr @param index
openMultiCode(arr: number[], index: number): void { this.singleCodeX = this.getOffset('x', arr); this.singleCodeY = this.getOffset('y', arr); this.isMultiSelected = true; this.singleCodeScale = 0.3; this.singleCodeOpacity = 0; this.multiSelectedIndex = index || 0; this.fadeOutScale = 0.3; ...
AST#method_declaration#Left openMultiCode AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#p...
openMultiCode(arr: number[], index: number): void { this.singleCodeX = this.getOffset('x', arr); this.singleCodeY = this.getOffset('y', arr); this.isMultiSelected = true; this.singleCodeScale = 0.3; this.singleCodeOpacity = 0; this.multiSelectedIndex = index || 0; this.fadeOutScale = 0.3; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L247-L257
95cb7700a255d90da4215b59d7c7c012f2b3be8c
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Http error receive event when the web page receives a web resource loading HTTP error. @typedef OnHttpErrorReceiveEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnHttpErrorReceiveEvent { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ request: WebResourceRequest; /** * Web resource response of event. ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnHttpErrorReceiveEvent AST#object_type#Left { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice ...
export declare interface OnHttpErrorReceiveEvent { request: WebResourceRequest; response: WebResourceResponse; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L216-L235
fb537fb7387553e4cd7a7c07b564b98606663ff0
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/Rect.ets
arkts
exactCenterX
@return the exact horizontal center of the rectangle as a float.
public exactCenterX(): number { return (this.left + this.right) * 0.5; }
AST#method_declaration#Left public exactCenterX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expr...
public exactCenterX(): number { return (this.left + this.right) * 0.5; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L127-L129
266d2026e1f9de0c1729c8d1db69f08e4f0b9b90
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/FlowLocale.ets
arkts
get
Returns the country/region code for this locale. @see java.util.Locale.getCountry
get country(): string { return this.base.country; }
AST#method_declaration#Left get AST#ERROR#Left coun try AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#express...
get country(): string { return this.base.country; }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L167-L169
c30a75638696ff8010d8c29856ec60e7efd2c777
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
scale
视频缩放
public scale(width: number, height: number): FFmpegCommandBuilder { return this.filter(`scale=${width}:${height}`); }
AST#method_declaration#Left public scale 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 height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
public scale(width: number, height: number): FFmpegCommandBuilder { return this.filter(`scale=${width}:${height}`); }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L135-L137
389e7e2d1d9c2401bc512a31ff803c4b37e8eee2
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets
arkts
releaseCamera
release resources
public async releaseCamera() { try { // Photo Mode Session Paused await captureSession?.stop(); // Release of photo mode session class await captureSession?.release(); // Turn off object class for photo input await cameraInput?.close(); // Preview output object class releas...
AST#method_declaration#Left public async releaseCamera AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // Photo Mode Session Paused AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expre...
public async releaseCamera() { try { await captureSession?.stop(); await captureSession?.release(); await cameraInput?.close(); await previewOutput?.release(); await cameraOutput?.release(); } catch (e) { hilog.error(0x00, 'release input out...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets#L42-L57
57726291a7b3ca2e9a7f593f2f7c187b5350da4d
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getRemainingDaysText
获取剩余天数显示文本
getRemainingDaysText(): string { const days = this.getRemainingDays(); if (days < 0) return '已过期'; if (days === 0) return '今天到期'; if (days === 1) return '明天到期'; return `${days}天后到期`; }
AST#method_declaration#Left getRemainingDaysText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left da...
getRemainingDaysText(): string { const days = this.getRemainingDays(); if (days < 0) return '已过期'; if (days === 0) return '今天到期'; if (days === 1) return '明天到期'; return `${days}天后到期`; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L226-L232
b1af003530269e092cd3d5024f761dd74d8348fb
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
read
从文件读取数据,使用Promise异步回调。 @param fd number 已打开的文件描述符。 @param buffer ArrayBuffer 用于保存读取到的文件数据的缓冲区。 @param options 支持如下选项: offset,number类型,表示期望读取文件的位置。可选,默认从当前位置开始读。 length,number类型,表示期望读取数据的长度。可选,默认缓冲区长度。 @returns
static read(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise<number> { return fs.read(fd, buffer, options) }
AST#method_declaration#Left static read AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#R...
static read(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise<number> { return fs.read(fd, buffer, options) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L425-L427
e863342863f84c76e7efc9da953f22ca72bccc52
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
通知渠道配置接口
export interface NotificationChannelConfig { enabled: boolean; name: string; description: string; importance: number; showBadge?: boolean; sound: NotificationSoundConfig; vibration: NotificationVibrationConfig; lightColor?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationChannelConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type...
export interface NotificationChannelConfig { enabled: boolean; name: string; description: string; importance: number; showBadge?: boolean; sound: NotificationSoundConfig; vibration: NotificationVibrationConfig; lightColor?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L323-L332
54ffefe7ea490257eccdade43899963bf7e1d0b9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Exploitation_case/entry/src/main/ets/pages/Index.ets
arkts
用于展示 Logger 输出的日志
build() { Column() { // 显示 Logger 输出的日志 Text(this.logMessage) .fontSize(FONT_SIZE.SMALL) .fontColor(Color.Black) .margin({ bottom: MARGIN.SMALL }) .id('logger-output') // 为日志输出设置 ID,便于测试获取内容 // 显示测试消息 Text(this.message) .fontSize(FONT_SIZE.SMALL) .f...
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 { // 显示 Logger 输出的日志 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#membe...
build() { Column() { Text(this.logMessage) .fontSize(FONT_SIZE.SMALL) .fontColor(Color.Black) .margin({ bottom: MARGIN.SMALL }) .id('logger-output') Text(this.message) .fontSize(FONT_SIZE.SMALL) .fontColor(Color.Black) .margin({ bottom: M...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Exploitation_case/entry/src/main/ets/pages/Index.ets#L60-L221
8b7463501e003b1066739072430dcbf411bd77a9
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
requestPromise
发起HTTP请求(仅返回操作结果) @param url 请求URL @param method HTTP方法 @param params 请求参数 @param callback 回调函数
static async requestPromise<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null ): Promise<HttpUtils.HttpResponse<T>> { const responseData = await Http._requestPromise(url, method, params) if (responseData) { const jsonData: HttpUtils.Receiv...
AST#method_declaration#Left static async requestPromise AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#...
static async requestPromise<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null ): Promise<HttpUtils.HttpResponse<T>> { const responseData = await Http._requestPromise(url, method, params) if (responseData) { const jsonData: HttpUtils.Receiv...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L77-L98
fa16dbc1bbfbfab9e235587f3184d993522b5d18
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets
arkts
initVersionInfo
初始化版本信息
private async initVersionInfo(): Promise<void> { try { // 获取当前应用版本信息 const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const currentVersion = bundleInfo.versionName || this.defaultVersion; // 从 Preferences 获取版本记录 ...
AST#method_declaration#Left private async initVersionInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > A...
private async initVersionInfo(): Promise<void> { try { const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const currentVersion = bundleInfo.versionName || this.defaultVersion; const context = getAppConte...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L32-L49
a948f90b1589bd0df5efd7f426b6483b9a6b9e94
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
preBuild
[EndExclude builder_node_pool]
public preBuild(type: string, item: ESObject, builder: WrappedBuilder<ESObject>, uiContext: UIContext) { if (type) { let nodeItem: NodeItem | undefined = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; nodeItem.type = type; // Pre created components nodeIte...
AST#method_declaration#Left public preBuild AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#...
public preBuild(type: string, item: ESObject, builder: WrappedBuilder<ESObject>, uiContext: UIContext) { if (type) { let nodeItem: NodeItem | undefined = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; nodeItem.type = type; nodeItem.prebuild(uiContext); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L107-L118
0cde8b61057901516c3d9695a75d2c590b86cf17
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isUint8ClampedArray
Check whether the entered value is the uint8clapedarray array type. @param { Object } value - A Uint8ClampedArray value @returns { boolean } Returns true if the value is a built-in Uint8ClampedArray instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isUint8ClampedArray(value: Object): boolean;
AST#method_declaration#Left isUint8ClampedArray AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_...
isUint8ClampedArray(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1367-L1367
20b1c8fd16c258b2bc46bb25ec88cb1e367f9a07
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/constants/DefaultConfigs.ets
arkts
手势配置常量
export class GestureConstants { /** 最小拖拽距离 */ static readonly MIN_DRAG_DISTANCE: number = 10; /** 最大旋转角度 */ static readonly MAX_ROTATION_ANGLE: number = 45; /** 透明度变化速率 */ static readonly OPACITY_CHANGE_RATE: number = 0.5; /** 缩放变化速率 */ static readonly SCALE_CHANGE_RATE: number = 0.1; }
AST#export_declaration#Left export AST#class_declaration#Left class GestureConstants AST#class_body#Left { /** 最小拖拽距离 */ AST#property_declaration#Left static readonly MIN_DRAG_DISTANCE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#e...
export class GestureConstants { static readonly MIN_DRAG_DISTANCE: number = 10; static readonly MAX_ROTATION_ANGLE: number = 45; static readonly OPACITY_CHANGE_RATE: number = 0.5; static readonly SCALE_CHANGE_RATE: number = 0.1; }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/constants/DefaultConfigs.ets#L53-L65
50c8f783327d73e1093ba1bf1f02828267642c55
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
申请通知授权(拉起授权弹窗) 应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。 使用该接口拉起通知授权弹窗后,如果用户拒绝授权,将无法使用该接口再次拉起弹窗。可以调用 openNotificationSettings 二次申请授权,拉起通知管理弹窗。 @param context @returns {Promise<void>} void
export async function requestEnable(): Promise<void> { return await notificationManager.requestEnableNotification(ContextUtil.getUIAbilityCtx()); }
AST#export_declaration#Left export AST#function_declaration#Left async function requestEnable 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...
export async function requestEnable(): Promise<void> { return await notificationManager.requestEnableNotification(ContextUtil.getUIAbilityCtx()); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L30-L32
6bcf3b0604e18f4b8eb519b269babc242f18aa8a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
highlightValue
Highlights the value at the given x-value in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting. @param x @param dataSetIndex @param stackIndex the index inside the stack - only relevant for stacked entries
public highlightValue(x: number, dataSetIndex: number, stackIndex: number): void { this.highlightValueForObject(new Highlight(x, 0, dataSetIndex, 0, stackIndex, 0, 0, null), false); }
AST#method_declaration#Left public highlightValue AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
public highlightValue(x: number, dataSetIndex: number, stackIndex: number): void { this.highlightValueForObject(new Highlight(x, 0, dataSetIndex, 0, stackIndex, 0, 0, null), false); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L263-L265
1feb9ee087e771fecabb365ac1f3ce9ac2e7130d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Goods.ets
arkts
@file 商品模型 @author Joker.X
export class Goods { /** * ID */ id: number = 0; /** * 类型ID */ typeId: number = 0; /** * 标题 */ title: string = ""; /** * 副标题 */ subTitle?: string | null = null; /** * 主图 */ mainPic: string = ""; /** * 图片 */ pics?: string[] | null = null; /** * 价格 */ ...
AST#export_declaration#Left export AST#class_declaration#Left class Goods AST#class_body#Left { /** * ID */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declarat...
export class Goods { id: number = 0; typeId: number = 0; title: string = ""; subTitle?: string | null = null; mainPic: string = ""; pics?: string[] | null = null; price: number = 0; sold: number = 0; content?: string | null = null; contentPics?: string[] | null = null; ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Goods.ets#L7-L103
fe32b1e0f5941c6a4c35d201e78269fcae080859
github
AlatusLee/HarmonyOS-Next-Weather-Assistant.git
d3c7060a8ff7f7656175e83fa32536b11e136556
alatus/src/main/ets/pages/Index.ets
arkts
initDate
初始化方法
async initDate(){ let result:Array<weatherModel> = await getWeatherUtil.getWeathers(this.cityCodeList); for (let i = 0; i < result.length; i++) { let weather:weatherModel = result[i]; this.cityWeatherList.push(weather); this.cityNameList.push(weather.forecasts[0].city); } }
AST#method_declaration#Left async initDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#t...
async initDate(){ let result:Array<weatherModel> = await getWeatherUtil.getWeathers(this.cityCodeList); for (let i = 0; i < result.length; i++) { let weather:weatherModel = result[i]; this.cityWeatherList.push(weather); this.cityNameList.push(weather.forecasts[0].city); } }
https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/pages/Index.ets#L36-L43
624366ac3979cf674f200203836a7dce72f674c8
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/environment_tools.ets
arkts
Converts px to vp. @param px The true px. @returns The equivalent vp.
export function meowPx2vp(px: number) { try { return px / display.getDefaultDisplaySync().densityPixels; } catch (e) { // This is not good. console.error('[px2vp] Error: ' + e); return px; } }
AST#export_declaration#Left export AST#function_declaration#Left function meowPx2vp AST#parameter_list#Left ( AST#parameter#Left px : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#state...
export function meowPx2vp(px: number) { try { return px / display.getDefaultDisplaySync().densityPixels; } catch (e) { console.error('[px2vp] Error: ' + e); return px; } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/environment_tools.ets#L16-L24
3bd320c59c00c6f7c2362d8d71a322c8aac7292c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
changeIndex
交换应用位置函数 @param itemIndex 目标网格元素的index @param insertIndex 被切换网格元素的index
changeIndex(itemIndex: number, insertIndex: number): void { this.appInfoList.splice(insertIndex, 0, this.appInfoList.splice(itemIndex, 1)[0]); }
AST#method_declaration#Left changeIndex AST#parameter_list#Left ( AST#parameter#Left itemIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left insertIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
changeIndex(itemIndex: number, insertIndex: number): void { this.appInfoList.splice(insertIndex, 0, this.appInfoList.splice(itemIndex, 1)[0]); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L217-L219
a7991859749df00fc927d119145b05e646b529fc
gitee
openharmony/applications_systemui
413f701448a7923a18a761e3cb54f0b871cfef40
features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/confirmDialog.ets
arkts
ConfirmDialog
confirm dialog
@CustomDialog export default struct ConfirmDialog { private title: string | Resource = '' private bundleName: string = '' public controller: CustomDialogController public action: () => void = () => {} build() { Column() { Column() { Row() { Text(this.title) .fontSize($...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct ConfirmDialog AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left...
@CustomDialog export default struct ConfirmDialog { private title: string | Resource = '' private bundleName: string = '' public controller: CustomDialogController public action: () => void = () => {} build() { Column() { Column() { Row() { Text(this.title) .fontSize($...
https://github.com/openharmony/applications_systemui/blob/413f701448a7923a18a761e3cb54f0b871cfef40/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/confirmDialog.ets#L27-L93
fa2623bc4f769b5ee34b80b2870b327871b5dfcf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets
arkts
exchangeIconBuilder
交换图标
@Builder exchangeIconBuilder() { }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right exchangeIconBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
@Builder exchangeIconBuilder() { }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets#L69-L71
759be72e56e9dfac0cd94924c93807761111bcb9
gitee
HunZiLei/ArtTs_PokeAccountBook.git
3d91db931f5dd6cea3c6cd414fad7c28942a58ac
entry/src/main/ets/bean/AccountItem.ets
arkts
记账本中的各个栏目
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/bean/AccountItem.ets#L2-L2
758189f31907953a5e64f440b3a063adbd9feb8f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
getInstance
[EndExclude audio_player_service] [EndExclude audio_player_service1]
public static getInstance(): AudioPlayerService { if (!AudioPlayerService.instance) { AudioPlayerService.instance = new AudioPlayerService(); } return AudioPlayerService.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AudioPlayerService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expr...
public static getInstance(): AudioPlayerService { if (!AudioPlayerService.instance) { AudioPlayerService.instance = new AudioPlayerService(); } return AudioPlayerService.instance; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets#L29-L34
e8228afec275832bcea12b1a01dc1485121dc1ce
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/PermissionUtils.ets
arkts
openPermissionSettingsPage
打开系统设置的权限管理页(处理授权结果)
static openPermissionSettingsPage() { // 获取上下文 const context = getContext() as common.UIAbilityContext // 获取包信息 const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) // 打开系统设置页 context.startAbility({ bundleName: 'com.huawei.hmo...
AST#method_declaration#Left static openPermissionSettingsPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取上下文 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_exp...
static openPermissionSettingsPage() { const context = getContext() as common.UIAbilityContext const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) context.startAbility({ bundleName: 'com.huawei.hmos.settings', ability...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/PermissionUtils.ets#L39-L54
334d4c307cf7cbe5ff6e87448d86213447bde5ba
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
clearAllNotifications
清空所有通知
public clearAllNotifications(): number { const count = this.notifications.length; this.notifications = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Cleared ${count} notifications`); return count; }
AST#method_declaration#Left public clearAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator...
public clearAllNotifications(): number { const count = this.notifications.length; this.notifications = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Cleared ${count} notifications`); return count; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L317-L323
58f10ddffb02a5127a1a8f74e843671694f68f1f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
V1版本升级数据处理业务层
export class V1DataService extends BaseDataService { /** * V1新老版本字段转换逻辑 * @param resultSet 查询结果集 * @param targetVersion 目标版本 * @returns 目标版本格式数据 */ transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: retu...
AST#export_declaration#Left export AST#class_declaration#Left class V1DataService extends AST#type_annotation#Left AST#primary_type#Left BaseDataService AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * V1新老版本字段转换逻辑 * @param resultSet 查询结果集 * @param targetVersion 目标版本 * @returns 目...
export class V1DataService extends BaseDataService { transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: return this.transformV1ToV2(resultSet); case Constants.V3: return this.transformV1ToV3(resultSet); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L89-L105
18f8ab9299f991333fb1c853619af4dc776cbf33
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/ToastComponent.ets
arkts
getIcon
获取图标
private getIcon(): string { if (this.config.icon) { return this.config.icon; } const type = this.config.type || ToastType.INFO; switch (type) { case ToastType.SUCCESS: return '✓'; case ToastType.WARNING: return '⚠'; case ToastType.ERROR: return '✕'; ...
AST#method_declaration#Left private getIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member...
private getIcon(): string { if (this.config.icon) { return this.config.icon; } const type = this.config.type || ToastType.INFO; switch (type) { case ToastType.SUCCESS: return '✓'; case ToastType.WARNING: return '⚠'; case ToastType.ERROR: return '✕'; ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ToastComponent.ets#L98-L113
0dec01f625e879f5048838412f1d5d136b3b7f97
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets
arkts
downloadPublicKey
客户端下载公钥
async downloadPublicKey() { let publicKeyResult: SignedData = JSON.parse(await this.server.downloadPublicKey()); // 验证公钥签名 if (await verify(publicKeyResult.encryptedMessage, publicKeyResult.signedMessage, publicKeyResult.encryptedMessage)) { this.publicKey = publicKeyResult.encryptedMessage; ...
AST#method_declaration#Left async downloadPublicKey AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left publicKeyResult : AST#type_annotation#Left AST#primary_type#Left SignedData AST#primary_type#Right AST#typ...
async downloadPublicKey() { let publicKeyResult: SignedData = JSON.parse(await this.server.downloadPublicKey()); if (await verify(publicKeyResult.encryptedMessage, publicKeyResult.signedMessage, publicKeyResult.encryptedMessage)) { this.publicKey = publicKeyResult.encryptedMessage; } if...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets#L37-L49
d6d31fafe400f3c2f8603fa1522d9da25db41b9c
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/ConfettiComponent.ets
arkts
startAnimation
启动动画
private startAnimation(): void { this.animationTimer = setInterval(() => { let allDone = true; const newParticles: Particle[] = []; for (let i = 0; i < this.particles.length; i++) { const p = this.particles[i]; if (p.y < 120) { allDone = false; const newParticl...
AST#method_declaration#Left private startAnimation 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...
private startAnimation(): void { this.animationTimer = setInterval(() => { let allDone = true; const newParticles: Particle[] = []; for (let i = 0; i < this.particles.length; i++) { const p = this.particles[i]; if (p.y < 120) { allDone = false; const newParticl...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ConfettiComponent.ets#L68-L105
e678128f5adbb1d1596b567116665dac47d8184a
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AbilityUtils.ets
arkts
应用跳转类
export class AbilityUtils { private static readonly uri_info: string = 'application_info_entry' //应用设置页面 private static readonly uri_network: string = "mobile_network_entry"; //移动网络设置页面 private static readonly uri_notification: string = "systemui_notification_settings"; //通知设置页面 private static readonly uri_blue...
AST#export_declaration#Left export AST#class_declaration#Left class AbilityUtils AST#class_body#Left { AST#property_declaration#Left private static readonly uri_info : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'application_info_entry' AS...
export class AbilityUtils { private static readonly uri_info: string = 'application_info_entry' private static readonly uri_network: string = "mobile_network_entry"; private static readonly uri_notification: string = "systemui_notification_settings"; private static readonly uri_bluetooth: string = "bluetooth...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L10-L120
92007f73b9a34913cf6ee16df61fb75c21b9728e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
arkts
键盘按键数据接口
export interface IKeyAttribute { label: string | Resource; value?: string; type?: EKeyType; fontSize?: number; fontColor?: string | Color; backgroundColor?: string | Color; position?: [number, number, number, number]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IKeyAttribute AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#...
export interface IKeyAttribute { label: string | Resource; value?: string; type?: EKeyType; fontSize?: number; fontColor?: string | Color; backgroundColor?: string | Color; position?: [number, number, number, number]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L40-L48
024dfc2f20dc703a0fbcf65b12d77d76b7bd8dcd
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/personal/FollowingsPage.ets
arkts
handleUnfollow
处理取消关注
async handleUnfollow(followingId: number) { try { await unfollowUser(this.userId, followingId); // 更新列表,移除已取消关注的用户 this.followings = this.followings.filter(item => item.id !== followingId); promptAction.showToast({ message: '取消关注成功' }); } catch (error) { console.error(`取消关注失败: ${er...
AST#method_declaration#Left async handleUnfollow AST#parameter_list#Left ( AST#parameter#Left followingId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statemen...
async handleUnfollow(followingId: number) { try { await unfollowUser(this.userId, followingId); this.followings = this.followings.filter(item => item.id !== followingId); promptAction.showToast({ message: '取消关注成功' }); } catch (error) { console.error(`取消关注失败: ${error instanceof Err...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/FollowingsPage.ets#L229-L239
046c5eda3b91167d71d24584a8472ab5804263a3
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Piece.ets
arkts
removeMem
从内存中删除wordId @param wordId - 要删除的wordId
removeMem(wordId: number): void { const index = this._wordIds.indexOf(wordId); if (index !== -1) { this._wordIds.splice(index, 1); } }
AST#method_declaration#Left removeMem AST#parameter_list#Left ( AST#parameter#Left wordId : 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#Right A...
removeMem(wordId: number): void { const index = this._wordIds.indexOf(wordId); if (index !== -1) { this._wordIds.splice(index, 1); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L62-L67
edc9f73a85586c05ab337e4c5977cfa110d2e660
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
AccountLogin
帐号登录
async AccountLogin(accountName: string) { Logger.info('AccountLogin start'); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' }; info.name = accountName; info.event = 'Ohos.account.event.LOGIN'; t...
AST#method_declaration#Left async AccountLogin AST#parameter_list#Left ( AST#parameter#Left accountName : 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#expression_sta...
async AccountLogin(accountName: string) { Logger.info('AccountLogin start'); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' }; info.name = accountName; info.event = 'Ohos.account.event.LOGIN'; t...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L113-L132
40aa52f4e8cbe7c81a8e6c8c1eff703445eb442f
gitee
MissTeven/ArkTS-demo.git
fd9f7695fa29889ad4a9ecf3330fda9991aca24c
entry/src/main/ets/model/MediaQueryModel.ets
arkts
register
Register listener.
public register(): void { let portraitFunc = this.onPortrait.bind(this); this.listener.on('change', portraitFunc); }
AST#method_declaration#Left public register 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 portraitFun...
public register(): void { let portraitFunc = this.onPortrait.bind(this); this.listener.on('change', portraitFunc); }
https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/model/MediaQueryModel.ets#L21-L24
8da0fd89618e596b409d4e20d49d24cfbf839a70
github
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
projectModule/src/main/ets/components/ProjectComp.ets
arkts
ProjectComp
@desc:项目 @author:hxy @date:2024/2/17
@Component export struct ProjectComp { mViewModel: ProjectViewModel = new ProjectViewModel() projectListDataSource = new LazyDataSource<ProjectItemModel>() aboutToAppear() { this.mViewModel.getProjectList() .then((res) => { res.data.forEach((item) => { this.projectListDataSource.pushD...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ProjectComp AST#component_body#Left { AST#property_declaration#Left mViewModel : AST#type_annotation#Left AST#primary_type#Left ProjectViewModel AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#ex...
@Component export struct ProjectComp { mViewModel: ProjectViewModel = new ProjectViewModel() projectListDataSource = new LazyDataSource<ProjectItemModel>() aboutToAppear() { this.mViewModel.getProjectList() .then((res) => { res.data.forEach((item) => { this.projectListDataSource.pushD...
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/projectModule/src/main/ets/components/ProjectComp.ets#L14-L29
210d668dfdc8ae7de0071da77dafe9dbf9b4dbf3
github