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
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowSpaceAroundBottom
横向环绕分布 + 垂直底部
@ComponentV2 export struct RowSpaceAroundBottom { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Para...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceAroundBottom AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_...
@ComponentV2 export struct RowSpaceAroundBottom { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1345-L1420
3575b9b1db6989d7dde1a5e5d5f992ed44adb94f
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/home/Home.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 interface Articles { icon: string | Resource title: string | Resource disc: string | Resource }
AST#export_declaration#Left export AST#interface_declaration#Left interface Articles AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_a...
export interface Articles { icon: string | Resource title: string | Resource disc: string | Resource }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/home/Home.ets#L16-L20
eae6cb8c62bb9d62f2b35cf3aba1e44b00ef6665
gitee
queueit/harmony-sdk.git
ba7b4b38c03730bfbe305789acba6db0012d5f5c
queueit_sdk/src/main/ets/Index.ets
arkts
QueueView
--- UI Components & Management (Recommended Integration) --- Export the ArkUI component itself
export { QueueView } from './components/QueueView';
AST#export_declaration#Left export { QueueView } from './components/QueueView' ; AST#export_declaration#Right
export { QueueView } from './components/QueueView';
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/Index.ets#L25-L25
4ff5c32f1f4a474982ea380ec5ad8269040a5c2c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets
arkts
addData
插入单个数据
public addData(index: number, data: T): void { this.articleData.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 T AST#primary_type#Right A...
public addData(index: number, data: T): void { this.articleData.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets#L80-L83
2b9a3a720db3a5cd5d7c84070005eb23a4534322
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment4.ets
arkts
appendMsg
Define methods for changing state variables (multiple modifications of state variables)
appendMsg(newMsg: string) { this.message += newMsg; this.message += ';'; this.message += '<br/>'; }
AST#method_declaration#Left appendMsg AST#parameter_list#Left ( AST#parameter#Left newMsg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#...
appendMsg(newMsg: string) { this.message += newMsg; this.message += ';'; this.message += '<br/>'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment4.ets#L27-L31
b45b8962bcc383185d59bb019c27faed06040d60
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildExportDialog
构建导出对话框
@Builder buildExportDialog() { Column({ space: UIConstants.LARGE_PADDING }) { Text('导出统计数据') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Row({ space: UIConstants.DEFAULT_PADDING }) { Button('JSON格式') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildExportDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p...
@Builder buildExportDialog() { Column({ space: UIConstants.LARGE_PADDING }) { Text('导出统计数据') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Row({ space: UIConstants.DEFAULT_PADDING }) { Button('JSON格式') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L625-L650
59bd72091cc36d2b3a5bb27efd4de50a5d789a31
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Performance/NBody/entry/src/main/ets/model/CalculateUtil.ets
arkts
使用TaskPool开启子线程,执行轨道计算任务 @param totalTimeSteps 时间推移量
export function computeNBodyByTaskPool(totalTimeSteps: number): void { Logger.info(TAG, "computeNBodyByTaskPool: start executing"); let task: taskpool.Task = new taskpool.Task(computeTask, totalTimeSteps); try { Logger.info(TAG, 'computeNBodyByTaskPool: start calculating...'); // 向taskpool线程池派发子线程任务 ...
AST#export_declaration#Left export AST#function_declaration#Left function computeNBodyByTaskPool AST#parameter_list#Left ( AST#parameter#Left totalTimeSteps : 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_...
export function computeNBodyByTaskPool(totalTimeSteps: number): void { Logger.info(TAG, "computeNBodyByTaskPool: start executing"); let task: taskpool.Task = new taskpool.Task(computeTask, totalTimeSteps); try { Logger.info(TAG, 'computeNBodyByTaskPool: start calculating...'); taskpool.execute(task,...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Performance/NBody/entry/src/main/ets/model/CalculateUtil.ets#L65-L80
9a2c3ef43e9b5eb575bdfc63d1b5f954e511345a
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/constants/MsgType.ets
arkts
Copyright (C) 2024 即时通讯网(52im.net) & Jack Jiang. The MobileIMSDK-鸿蒙Next客户端 Project. All rights reserved. 联系邮件:jack.jiang@52im.net 联系微信:hellojackjiang 联系QQ: 413980957 技术社区:http://www.52im.net 聊天消息类型常量定义。 代码参考自IM产品RainbowChat:http://www.52im.net/thread-19-1-1.html 特别注意:本类中定义的常量切勿重复,否则将影响聊天列表UI的正常展现! @author Jack J...
export default class MsgType { /** 聊天消息类型之:普通文字消息 */ static readonly TYPE_TEXT: number = 0; /** 聊天消息类型之:图片消息(即消息内容就是存放于服务端的磁盘图片文件名) */ static readonly TYPE_IMAGE: number = 1; /** 聊天消息类型之:语音留言消息(即消息内容就是存放于服务端的语音留言文件名) */ static readonly TYPE_VOICE: number = 2; /** 聊天消息类型之:系统消息或提示信息(...
AST#export_declaration#Left export default AST#class_declaration#Left class MsgType AST#class_body#Left { /** 聊天消息类型之:普通文字消息 */ AST#property_declaration#Left static readonly TYPE_TEXT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#exp...
export default class MsgType { static readonly TYPE_TEXT: number = 0; static readonly TYPE_IMAGE: number = 1; static readonly TYPE_VOICE: number = 2; static readonly TYPE_SYSTEAM$INFO: number = 90; }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/constants/MsgType.ets#L21-L36
4e37e626a5f36dea136b4e967b8311b0a8208185
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets
arkts
The style of ToolBarComponent.
export class ToolBarStyle { /** * The bottom margin. */ static readonly MARGIN_BOTTOM: number = 10; /** * The size of image. */ static readonly IMAGE_SIZE: number = 24; /** * The weight of layout. */ static readonly LAYOUT_WEIGHT: string = '25%'; /** * The height of divider. */ ...
AST#export_declaration#Left export AST#class_declaration#Left class ToolBarStyle AST#class_body#Left { /** * The bottom margin. */ AST#property_declaration#Left static readonly MARGIN_BOTTOM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#L...
export class ToolBarStyle { static readonly MARGIN_BOTTOM: number = 10; static readonly IMAGE_SIZE: number = 24; static readonly LAYOUT_WEIGHT: string = '25%'; static readonly DIVIDER_HEIGHT: number = 0.5; static readonly DIVIDER_OPACITY: number = 0.05; };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L100-L125
24829654b0e44611efad038cf13b3a5b91c6562c
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
aboutToAppear
页面出现时的生命周期回调 @returns {void} 无返回值
aboutToAppear(): void { this.viewModel.aboutToAppear(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.viewModel.aboutToAppear(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L73-L75
cefdf940da23f01c2eeabe6d976660f30d2f3ba2
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets
arkts
asyncRefreshSubscriptionInfo
/ 异步 自动刷新 订阅时间,
asyncRefreshSubscriptionInfo(isReadServerOnly: boolean = false){ this.refreshSubscriptionInfo(isReadServerOnly); // 只读 }
AST#method_declaration#Left asyncRefreshSubscriptionInfo AST#parameter_list#Left ( AST#parameter#Left isReadServerOnly : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#R...
asyncRefreshSubscriptionInfo(isReadServerOnly: boolean = false){ this.refreshSubscriptionInfo(isReadServerOnly); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets#L102-L104
2cba3e669eb8e803c1666479082adfe19e47c6ce
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/CommentComponent.ets
arkts
buildCommentList
@author: wuwenqiang @description: 创建评论列表,参数必须用对象或者接口形式传递,否则参数变化了,视图不更新 @date: 2024-05-25 16:30
@Builder buildCommentList(commentParams: CommentParamsInterface) { Column({ space: size.pagePadding }) { ForEach(commentParams.commentList, (aItem: CommentInterface, aIndex: number) => { Row() { Image(aItem.avater ? HOST + aItem.avater : $r('app.media.default_avater')) .width(aIt...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCommentList AST#parameter_list#Left ( AST#parameter#Left commentParams : AST#type_annotation#Left AST#primary_type#Left CommentParamsInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right...
@Builder buildCommentList(commentParams: CommentParamsInterface) { Column({ space: size.pagePadding }) { ForEach(commentParams.commentList, (aItem: CommentInterface, aIndex: number) => { Row() { Image(aItem.avater ? HOST + aItem.avater : $r('app.media.default_avater')) .width(aIt...
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/CommentComponent.ets#L168-L196
f60533fa8253a356b71e4e99ecbfc72f72376fa5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets
arkts
startUpdateBookCheckIfNeeds
MARK: - BookDb functions 启动更新 BookDb Check
public startUpdateBookCheckIfNeeds(baseName: string | null, title: string | null = null, forceDownload: boolean = false, proccessing: ((percent: number) => void) | null = null, finished: ((succeed: boolean, msg: string | null) => void) | null = null): void { if (!baseName) return; /// 判断网络 链接 if (!NetWorkT...
AST#method_declaration#Left public startUpdateBookCheckIfNeeds AST#parameter_list#Left ( AST#parameter#Left baseName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#p...
public startUpdateBookCheckIfNeeds(baseName: string | null, title: string | null = null, forceDownload: boolean = false, proccessing: ((percent: number) => void) | null = null, finished: ((succeed: boolean, msg: string | null) => void) | null = null): void { if (!baseName) return; if (!NetWorkTool.checkIn...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L46-L94
3431e18ed95a93f9a09066cbddd2e7d3b3dc6152
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q2/DxinTranslate/entry/src/main/ets/fun/getData.ets
arkts
取出来历史数据
export function getHistory(): Resp[] { // API9 return AppStorage.Get(Constants.history) || [] // NEXT // return AppStorage.get(Constants.history) || [] }
AST#export_declaration#Left export AST#function_declaration#Left function getHistory AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resp [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // API...
export function getHistory(): Resp[] { return AppStorage.Get(Constants.history) || [] }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/fun/getData.ets#L48-L53
e2b433c07e5a44924df5e8c16fb2fb789236fd3a
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setCenterAxisLabels
Centers the axis labels instead of drawing them at their original position. This is useful especially for grouped BarChart. @param enabled
public setCenterAxisLabels(enabled: boolean): void { this.mCenterAxisLabels = enabled; }
AST#method_declaration#Left public setCenterAxisLabels AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#p...
public setCenterAxisLabels(enabled: boolean): void { this.mCenterAxisLabels = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L231-L233
41453f87a11871f25a31d5ced296cc01739ff3fd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/icon/ArrowRightIcon.ets
arkts
构建右箭头图标 @returns {void} 无返回值
build(): void { CommonIcon({ icon: $r("app.media.ic_right"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left CommonIcon ( AST#component_parameters#Left { AST#component_parameter#Left icon : AST#expression#Left AST#resource_expression...
build(): void { CommonIcon({ icon: $r("app.media.ic_right"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/ArrowRightIcon.ets#L29-L36
d1c578177a140e2caca601161a3c5b1197e27a0f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarLineScatterCandleBubbleData.ets
arkts
Baseclass for all Line, Bar, Scatter, Candle and Bubble data.
export default abstract class BarLineScatterCandleBubbleData<T extends IBarLineScatterCandleBubbleDataSet< /*T extends */ EntryOhos>> extends ChartData<T> { constructor(); constructor
AST#export_declaration#Left export AST#ERROR#Left default abstract class BarLineScatterCandleBubbleData AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IBarLineScatterCandleBubbleDataSet AST#type_arguments#Left < /*T extends */ AST#type_a...
export default abstract class BarLineScatterCandleBubbleData<T extends IBarLineScatterCandleBubbleDataSet< EntryOhos>> extends ChartData<T> { constructor(); constructor
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarLineScatterCandleBubbleData.ets#L25-L30
80e7831c38a64150071c470ab8b3037203b17218
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/FileUriDevelopment_C/entry/src/main/ets/pages/Index.ets
arkts
从文件路径获取 URI
export function createFile(): string { // 新建并打开文件 let file = fs.openSync(filesDir + '/test.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); // 写入一段内容至文件 let writeLen = fs.writeSync(file.fd, 'Try to write str : hello world'); Logger.info('The length of str is: ' + writeLen); // 写入内容的长度 // 从文件读取一段内容 let ...
AST#export_declaration#Left export AST#function_declaration#Left function createFile 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_declara...
export function createFile(): string { let file = fs.openSync(filesDir + '/test.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let writeLen = fs.writeSync(file.fd, 'Try to write str : hello world'); Logger.info('The length of str is: ' + writeLen); let arrayBuffer = new ArrayBuffer(1024); let ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/FileUriDevelopment_C/entry/src/main/ets/pages/Index.ets#L28-L48
9f096f442726feae1011c00d3ce0f8f0d9b3d71c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
getLocalName
获取蓝牙名称
getLocalName(): string { let localName = ''; try { localName = connection.getLocalName(); Log.showInfo(TAG, `getLocalName: localName = ${localName}`); } catch (err) { Log.showError(TAG, `getLocalName: err = ${err}`); } return localName; }
AST#method_declaration#Left getLocalName 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 let AST#variable_declarator#Left localName = ...
getLocalName(): string { let localName = ''; try { localName = connection.getLocalName(); Log.showInfo(TAG, `getLocalName: localName = ${localName}`); } catch (err) { Log.showError(TAG, `getLocalName: err = ${err}`); } return localName; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets#L95-L104
a77b048130d46b6fbbd4cdab2241e745acc6570a
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.app.d.ets
arkts
terminate
Destroys the current ability. @syscap SystemCapability.ArkUI.ArkUI.Lite @since 3 Destroys the current ability. It does not work in StageModel. @syscap SystemCapability.ArkUI.ArkUI.Lite @atomicservice @since 12
static terminate(): void;
AST#method_declaration#Left static terminate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static terminate(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L269-L269
32f4f67701a4650d7d29a8296045322434e47530
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildCalendarGrid
日历网格
@Builder buildCalendarGrid() { Column({ space: 16 }) { Text('日历视图') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) Column({ space: 8 }) { // 星期标题行 Row() { ForEach(['日', '一', '二', '三...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarGrid AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p...
@Builder buildCalendarGrid() { Column({ space: 16 }) { Text('日历视图') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) Column({ space: 8 }) { Row() { ForEach(['日', '一', '二', '三', '四', ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2565-L2604
5bba1c7cbde0ac1e3a2e7dbac37048478662077f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets
arkts
getParentData
获取指定数据项
getParentData(parentId: string): NewsCommentModel | null { for (let i = 0; i < this.comments.length; i++) { if (this.comments[i].id === parentId) { return this.comments[i]; } } return null; }
AST#method_declaration#Left getParentData AST#parameter_list#Left ( AST#parameter#Left parentId : 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#Left New...
getParentData(parentId: string): NewsCommentModel | null { for (let i = 0; i < this.comments.length; i++) { if (this.comments[i].id === parentId) { return this.comments[i]; } } return null; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L130-L137
ca3b957438720358b374517711e7066e07069d1e
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
green
from Color green() @param color
public static green(color: number): number { return (color >> 8) & 0xFF; }
AST#method_declaration#Left public static green AST#parameter_list#Left ( AST#parameter#Left color : 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 AST#primary_t...
public static green(color: number): number { return (color >> 8) & 0xFF; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L258-L260
5dac9b24d839e5d65d78b1bead2e3f3f24d22fd1
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets
arkts
应用约束18: 禁止在构造函数参数中声明类字段
constructor(message: Message, data: MessageAttachmentData) { // 应用约束2: 通过构造函数初始化字段 this.client = message.client; this.message = message; // 应用约束39: 将setup方法逻辑合并到构造函数 this.id = data.id; this.filename = data.filename; this.filesize = data.size; this.url = data.url; this.proxyURL = dat...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left MessageAttachmentData...
constructor(message: Message, data: MessageAttachmentData) { this.client = message.client; this.message = message; this.id = data.id; this.filename = data.filename; this.filesize = data.size; this.url = data.url; this.proxyURL = data.proxy_url; this.height = data.height ?? nul...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets#L18-L31
ac0595c0856042fa972fc37e248f399e0f775c91
github
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/model/userModel.ets
arkts
登录函数
export function login(username: string, password: string): boolean { const user = users.find(u => u.username === username && u.password === password); return user !== undefined; }
AST#export_declaration#Left export AST#function_declaration#Left function login AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#...
export function login(username: string, password: string): boolean { const user = users.find(u => u.username === username && u.password === password); return user !== undefined; }
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/model/userModel.ets#L21-L24
41a44aa3d3a20728aa231efd7805bd78c2088096
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/HeartRate.ets
arkts
showWarningReminder
心率异常警告
showWarningReminder(): boolean { return this.tooHigh() || this.tooLow(); }
AST#method_declaration#Left showWarningReminder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expre...
showWarningReminder(): boolean { return this.tooHigh() || this.tooLow(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/HeartRate.ets#L67-L69
d69adec8a8a49f29ee44f1d804eea8621097167f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/FeedbackService.ets
arkts
showProgress
显示进度提示
async showProgress(options: ProgressOptions): Promise<void> { const percentage = options.showPercentage !== false ? ` (${Math.round(options.progress)}%)` : ''; const message = `${options.message}${percentage}`; hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Progress: ${options.title} - $...
AST#method_declaration#Left async showProgress AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
async showProgress(options: ProgressOptions): Promise<void> { const percentage = options.showPercentage !== false ? ` (${Math.round(options.progress)}%)` : ''; const message = `${options.message}${percentage}`; hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Progress: ${options.title} - $...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/FeedbackService.ets#L127-L138
39cc4e86011206e525ff9c7317e1d9a3007f5592
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets
arkts
genRsaPubKeySpec
RSA公钥密钥参数生成函数
function genRsaPubKeySpec(nIn: bigint, eIn: bigint): cryptoFramework.RSAPubKeySpec { let rsaCommSpec: cryptoFramework.RSACommonParamsSpec = { n: nIn, algName: 'RSA', specType: cryptoFramework.AsyKeySpecType.COMMON_PARAMS_SPEC }; let rsaPubKeySpec: cryptoFramework.RSAPubKeySpec = { params: rsaCommS...
AST#function_declaration#Left function genRsaPubKeySpec AST#parameter_list#Left ( AST#parameter#Left nIn : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eIn : AST#type_annotation#Left AST#primary_type#Left bigint AST#prima...
function genRsaPubKeySpec(nIn: bigint, eIn: bigint): cryptoFramework.RSAPubKeySpec { let rsaCommSpec: cryptoFramework.RSACommonParamsSpec = { n: nIn, algName: 'RSA', specType: cryptoFramework.AsyKeySpecType.COMMON_PARAMS_SPEC }; let rsaPubKeySpec: cryptoFramework.RSAPubKeySpec = { params: rsaCommS...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets#L20-L33
32db0ab184a4be0a1efa6058f87245dca2854dc5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
等级福利接口
export interface LevelBenefit { type: BenefitType; description: string; value: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LevelBenefit AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left BenefitType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description : AST#type_anno...
export interface LevelBenefit { type: BenefitType; description: string; value: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L72-L76
c047e22b7c3af010267ac4783a39d777ac8ab53b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM3.ets
arkts
digest
对称密钥SymKey SM3摘要,同步 @param data 待摘要的数据 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @returns
static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, 'SM3', resultCoding); }
AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_...
static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, 'SM3', resultCoding); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L36-L38
e9de2394aea8f79582156a6dde291331763bb34b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/LoadingView.ets
arkts
startAnimation
骨架屏的闪烁动画
startAnimation(): void { // TODO: 知识点:显式动画animateTo(value: AnimateParam, event: () => void): void接口可以给状态变化添加过渡动画。同属性动画,布局类改变宽高的动画,内容都是直接到终点状态。 animateTo(CommonConstants.SKELETON_ANIMATION, () => { // 动态修改骨架屏的透明度 this.listOpacity = CommonConstants.HALF_OPACITY; }); }
AST#method_declaration#Left 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 { // TODO: 知识点:显式动画animateTo(value: AnimateParam, event: () => void): void接口可以给状态变化添加过渡动画。...
startAnimation(): void { animateTo(CommonConstants.SKELETON_ANIMATION, () => { this.listOpacity = CommonConstants.HALF_OPACITY; }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/LoadingView.ets#L26-L32
3ebe5c5bb2252b766c5a51b6a548fc5352a5a63c
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxModifier.ets
arkts
CheckboxModifierBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function CheckboxModifierBuilder(name: string, param: Object) { CheckboxModifierExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxModifierBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le...
@Builder export function CheckboxModifierBuilder(name: string, param: Object) { CheckboxModifierExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxModifier.ets#L16-L19
d80421e8d1607fe0d58ba140d140f90ad915a569
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/closure_function/closure_function_001_T.ets
arkts
Introduction 闭包
export function closure_function_001_T(taint_src : string) { let z1 = f(); z1(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function closure_function_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function closure_function_001_T(taint_src : string) { let z1 = f(); z1(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/closure_function/closure_function_001_T.ets#L6-L9
9090ba92c18c09930f4770e6def5cfb6fd6c9d17
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
scalePriorityCompress
优先压缩图片尺寸 @param sourcePixelMap 原始待压缩图片的PixelMap @param maxCompressedImageSize 指定图片的压缩目标大小 @param quality
async scalePriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number, quality: number) { // TODO 知识点:自动模式(指定压缩目标大小)优先压缩图片尺寸。优先使用scale对图片进行尺寸缩放,采用while循环每次递减reduceScaleVal倍数(对应‘scale每次缩小倍数’)进行尺寸缩放,再用packing(其中图片质量参数quality根据‘最低图片质量’设置)获取压缩后的图片大小,最终查找压缩到最接近指定图片压缩目标的大小,并获取图片压缩数据用于后续图片保存。 let ...
AST#method_declaration#Left async scalePriorityCompress AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left...
async scalePriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number, quality: number) { let compressedImageData: ArrayBuffer = await this.packing(sourcePixelMap, quality, this.afterCompressFmt); if (quality !== IMAGE_QUALITY_HUNDRED && (compressedImageData.byteLength <= ma...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L273-L324
c2f536bd384588685de50fcb1c62c513b000dfea
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
isMatch
给定内容是否匹配正则(配合RegexUtil里的正则常量一起使用) @param content 内容 @param regex 正则
static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } }
AST#method_declaration#Left static isMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left regex : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Reg...
static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L197-L207
0310b25886c196171af17ff186e8be911689bdc9
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ProgressButton.d.ets
arkts
Declare Color options of the ProgressButton. @interface ProgressButtonColorOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export declare interface ProgressButtonColorOptions { /** * Set progress color of the ProgressButton. * * @type { ?ResourceColor }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ progressColor?: ResourceColor; /** * Set border color of the ProgressButton. ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface ProgressButtonColorOptions AST#object_type#Left { /** * Set progress color of the ProgressButton. * * @type { ?ResourceColor }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice ...
export declare interface ProgressButtonColorOptions { progressColor?: ResourceColor; borderColor?: ResourceColor; textColor?: ResourceColor; backgroundColor?: ResourceColor; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ProgressButton.d.ets#L147-L188
a2aec03a2d0b355083a404fa97265dbe9f892eb9
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
An object holding a key combination, which consists of a main key and some modifier keys, if the main key isn't a function key. @param main A string or FunctionKey @param mod A ModifierKey[]
constructor(main?: string | FunctionKey, mod?: Array<ModifierKey>) { if (main) { this.main_key = main; } if (mod) { this.modifier = mod; } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left main ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left FunctionKey AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ...
constructor(main?: string | FunctionKey, mod?: Array<ModifierKey>) { if (main) { this.main_key = main; } if (mod) { this.modifier = mod; } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L145-L152
d37b210d2017d5edc83fc0ea228945f4c0970362
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
clearBadge
重置角标
static async clearBadge() { await notificationManager.setBadgeNumber(0); }
AST#method_declaration#Left static async clearBadge AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expr...
static async clearBadge() { await notificationManager.setBadgeNumber(0); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L396-L398
b14dd0455e003518949128e8a80f115bd9ffb597
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/AgentService.ets
arkts
enhanceInputWithModeHint
增强用户输入,添加模式识别提示 帮助AI更准确地识别用户意图 @param input - 原始用户输入 @returns 增强后的输入(包含技术性提示,不显示给用户)
private enhanceInputWithModeHint(input: string): string { const text = input.toLowerCase(); // 助手模式关键词(更全面的检测) // 移除单纯的时间词(如"今天"),避免误判闲聊 const taskKeywords = [ '任务', '日程', '提醒', '待办', '备忘', '笔记', '记录', '保存', '预约', '会议', '截止', '提醒我', '帮我记', '创建', '添加', '设置', '安排', '计划', '记下', '别忘...
AST#method_declaration#Left private enhanceInputWithModeHint 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string ...
private enhanceInputWithModeHint(input: string): string { const text = input.toLowerCase(); const taskKeywords = [ '任务', '日程', '提醒', '待办', '备忘', '笔记', '记录', '保存', '预约', '会议', '截止', '提醒我', '帮我记', '创建', '添加', '设置', '安排', '计划', '记下', '别忘', '要记得' ]; const chatKeyword...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L269-L328
2a59fbdcc15d985ac9fb6d7bdea396dfb2627b4e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/floatwindow/src/main/ets/common/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly PAGE_PADDING: number = 12; // 页面内容内边距,用于悬浮窗位置计算 static readonly ASPECT_RATIO: number = 1; // 图标宽高比 static readonly PRODUCT_SERVICE_SPACE: number = 16; // 商品服务项间距 static readonly FLOAT_WINDOW_WIDTH: number = 120; // 悬浮窗宽度 static readonly FLOAT_WINDOW_HEIGHT: number = 16...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly PAGE_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#prop...
export class Constants { static readonly PAGE_PADDING: number = 12; static readonly ASPECT_RATIO: number = 1; static readonly PRODUCT_SERVICE_SPACE: number = 16; static readonly FLOAT_WINDOW_WIDTH: number = 120; static readonly FLOAT_WINDOW_HEIGHT: number = 160; static readonly INIT_POSITION_Y: number ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/floatwindow/src/main/ets/common/Constants.ets#L16-L26
914cbf995a73370be6b28b85bacea44aface877c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
完整农历系统设计.ets
arkts
getLunarMonthCn
获取农历月份中文表示
private static getLunarMonthCn(lunarMonth: number, isLeapMonth: boolean): string { const prefix = isLeapMonth ? "闰" : ""; return prefix + LUNAR_MONTHS[lunarMonth - 1]; }
AST#method_declaration#Left private static getLunarMonthCn AST#parameter_list#Left ( AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Lef...
private static getLunarMonthCn(lunarMonth: number, isLeapMonth: boolean): string { const prefix = isLeapMonth ? "闰" : ""; return prefix + LUNAR_MONTHS[lunarMonth - 1]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L414-L417
31c43098add4de43a9c076511f24888eab9fc23e
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/DialogHelper.ets
arkts
升级失败弹框 @param operator 回调
export function displayUpgradeFailDialog(operator ?: DialogOperator): void { defaultNoTitleDialog($r('app.string.update_fail'), operator); }
AST#export_declaration#Left export AST#function_declaration#Left function displayUpgradeFailDialog AST#parameter_list#Left ( AST#parameter#Left operator ? : AST#type_annotation#Left AST#primary_type#Left DialogOperator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST...
export function displayUpgradeFailDialog(operator ?: DialogOperator): void { defaultNoTitleDialog($r('app.string.update_fail'), operator); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L87-L89
fae9d1fcd97a09d694d470c829991fd35cdd3901
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
setSupportedProcessCache
应用设置自身是否支持缓存后快速启动。仅支持主线程调用。 @param isSupported 表示应用是否支持缓存后快速启动。true表示支持,false表示不支持。
static setSupportedProcessCache(isSupported: boolean) { AppUtil.getApplicationContext().setSupportedProcessCache(isSupported); }
AST#method_declaration#Left static setSupportedProcessCache AST#parameter_list#Left ( AST#parameter#Left isSupported : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_st...
static setSupportedProcessCache(isSupported: boolean) { AppUtil.getApplicationContext().setSupportedProcessCache(isSupported); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L202-L204
a7617635e310aa93e732cb85451b6bdcf013a2ce
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
formatDate
格式化日期为YYYY-MM-DD
private formatDate(date: Date): string { const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
AST#method_declaration#Left private formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
private formatDate(date: Date): string { const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L134-L139
6d43a13ad49db1b48ae4b45ce24b799bd3ab6610
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxSize.ets
arkts
CheckboxSizeBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function CheckboxSizeBuilder(name: string, param: Object) { CheckboxSizeExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxSizeBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p...
@Builder export function CheckboxSizeBuilder(name: string, param: Object) { CheckboxSizeExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxSize.ets#L16-L19
a6b3c15907bc4f3c3e589df04855ee8ab06f56aa
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.base.d.ets
arkts
@file @kit BasicServicesKit Defines the basic callback. @typedef { Callback<T> } @syscap SystemCapability.Base @crossplatform @form @atomicservice @since 20
export type Callback<T> = (data: T) => void;
AST#export_declaration#Left export AST#type_declaration#Left type Callback AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_...
export type Callback<T> = (data: T) => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.base.d.ets#L31-L31
d6067740f757aa3c31f1104b657f3f01d21939a6
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/PrivateChatComponent.ets
arkts
subscribeChatDisable
订阅禁言事件
subscribeChatDisable() { EmitterUtil.subscribe(VHRoomEventType.CHAT_DISABLE, (msgData: EmitterMsgData) => { this.chatDisable = true; }); EmitterUtil.subscribe(VHRoomEventType.CHAT_PERMIT, (msgData: EmitterMsgData) => { this.chatDisable = false; }); EmitterUtil.subscribe(VHRoomEventType....
AST#method_declaration#Left subscribeChatDisable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EmitterUtil AST#expression#Right . subscrib...
subscribeChatDisable() { EmitterUtil.subscribe(VHRoomEventType.CHAT_DISABLE, (msgData: EmitterMsgData) => { this.chatDisable = true; }); EmitterUtil.subscribe(VHRoomEventType.CHAT_PERMIT, (msgData: EmitterMsgData) => { this.chatDisable = false; }); EmitterUtil.subscribe(VHRoomEventType....
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L89-L109
f70defb91f02f593a294eda2f92ec8614c2d4819
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
视频录制配置接口
export interface VideoRecordConfig { videoFormat: media.CodecMimeType; audioFormat: media.CodecMimeType; videoWidth: number; videoHeight: number; videoFrameRate: number; videoBitRate: number; audioBitRate: number; maxDuration: number; outputPath: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface VideoRecordConfig AST#object_type#Left { AST#type_member#Left videoFormat : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . CodecMimeType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right A...
export interface VideoRecordConfig { videoFormat: media.CodecMimeType; audioFormat: media.CodecMimeType; videoWidth: number; videoHeight: number; videoFrameRate: number; videoBitRate: number; audioBitRate: number; maxDuration: number; outputPath: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L73-L83
27fdcc319a98cc22b42cbb6e58068bec93270150
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets
arkts
The constant of PreviewerComponent.
export class GoodsPreviewer { /** * The bottom padding of image. */ static readonly PADDING_IMAGE_BOTTOM: number = 40; /** * The top padding of image. */ static readonly PADDING_IMAGE_TOP: number = 20; /** * The text of indicator. */ static readonly INDICATOR_TEXT: string = '1/4'; /**...
AST#export_declaration#Left export AST#class_declaration#Left class GoodsPreviewer AST#class_body#Left { /** * The bottom padding of image. */ AST#property_declaration#Left static readonly PADDING_IMAGE_BOTTOM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right...
export class GoodsPreviewer { static readonly PADDING_IMAGE_BOTTOM: number = 40; static readonly PADDING_IMAGE_TOP: number = 20; static readonly INDICATOR_TEXT: string = '1/4'; static readonly INDICATOR_MARGIN_RIGHT: number = 24; static readonly INDICATOR_MARGIN_BOTTOM: number = 17; s...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L259-L314
0028a55acee2291c5b0fd61cc2655f0b66216769
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/view/components/CommandTile.ets
arkts
RunningBlock
运行时的覆盖层
@Builder RunningBlock() { Column() .height(StyleConstants.THIRTEEN_PERCENT) .width(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}) Column() { Progre...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right RunningBlock AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expressi...
@Builder RunningBlock() { Column() .height(StyleConstants.THIRTEEN_PERCENT) .width(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}) Column() { Progre...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/view/components/CommandTile.ets#L67-L90
1757106885b40d833aa00e160a73b94b7d20634c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getBundleInfo
获取当前应用的BundleInfo
static async getBundleInfo(): Promise<bundleManager.BundleInfo> { const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_...
AST#method_declaration#Left static async getBundleInfo 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#qualified_type#Left bundleManager . BundleInfo AST#quali...
static async getBundleInfo(): Promise<bundleManager.BundleInfo> { const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L436-L449
e1cf09443a6b440a206bb74f469df66c99ca1567
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
onThemeModeChange
切换主题模式
async onThemeModeChange(mode: ThemeMode) { try { this.selectedThemeMode = mode; await this.themeManager.setThemeMode(mode); this.currentTheme = this.themeManager.getCurrentTheme(); } catch (error) { console.error('Failed to change theme mode:', error); } }
AST#method_declaration#Left async onThemeModeChange AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement...
async onThemeModeChange(mode: ThemeMode) { try { this.selectedThemeMode = mode; await this.themeManager.setThemeMode(mode); this.currentTheme = this.themeManager.getCurrentTheme(); } catch (error) { console.error('Failed to change theme mode:', error); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L75-L83
a97110c2007b1ff0ce72e2dde00183eb0afe3171
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_asynchronous.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv); let decryptData = await decoder.doFinal(cipherText); return decry...
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv); let decryptData = await decoder.doFinal(cipherText); return decry...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_asynchronous.ets#L46-L51
52517ccb682a5f9aff708b14333d652bb010521d
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@olxbr_gitlab-node-sdk/99.2.3/package/index.ets
arkts
应用约束61:使用命名导出代替export=语法
export const helloWorldExport = exports.helloWorld;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left helloWorldExport = AST#expression#Left AST#member_expression#Left AST#expression#Left exports AST#expression#Right . helloWorld AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variabl...
export const helloWorldExport = exports.helloWorld;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@olxbr_gitlab-node-sdk/99.2.3/package/index.ets#L20-L20
349ab0448a04d04f9175c4ad262246cc9a32edea
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/game/GameCenterPage.ets
arkts
buildUserLevelSection
构建用户等级信息
@Builder buildUserLevelSection() { Column({ space: 12 }) { // 等级头像和基本信息 Row({ space: 16 }) { // 等级头像 Stack() { Circle({ width: 80, height: 80 }) .fill(this.gameData?.level.color || '#4CAF50') .opacity(0.2) Circle({ width: 60, height: 60 }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserLevelSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compone...
@Builder buildUserLevelSection() { Column({ space: 12 }) { Row({ space: 16 }) { Stack() { Circle({ width: 80, height: 80 }) .fill(this.gameData?.level.color || '#4CAF50') .opacity(0.2) Circle({ width: 60, height: 60 }) .fill(th...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/game/GameCenterPage.ets#L108-L183
6fb8721f3d2363f8fed6c1204fd85fdc138bbfe5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onBackground
Ability后台隐藏时的回调
onBackground(): void { console.log('[EntryAbility] Ability onBackground'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onBackground'); // 应用进入后台时的处理 this.handleBackground(); }
AST#method_declaration#Left onBackground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#...
onBackground(): void { console.log('[EntryAbility] Ability onBackground'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onBackground'); this.handleBackground(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L78-L84
60cf68711079d857599e6440c53959999af654d0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
handleSendGreeting
通知操作处理方法
private async handleSendGreeting(contactId: string): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Handling send greeting for contact: ${contactId}`); // 这里可以集成到祝福生成页面 }
AST#method_declaration#Left private async handleSendGreeting AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST...
private async handleSendGreeting(contactId: string): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationCenterService] Handling send greeting for contact: ${contactId}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L489-L493
239f942597966efda4b7ba2a9f4362f602f301e5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppConstants.ets
arkts
get
/返回固定的rdb路径../entry/rdb/
static get rdbPath(): string { const context = getAppContext() // HarmonyOS的目录结构不同,使用databaseDir作为基础路径 return `${context.databaseDir}/${this.APP_RDB}/`; }
AST#method_declaration#Left static get AST#ERROR#Left rdbPath 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#variable_declaration#Left const AS...
static get rdbPath(): string { const context = getAppContext() return `${context.databaseDir}/${this.APP_RDB}/`; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppConstants.ets#L38-L42
ad029b8b3f4340aa97b694474f905bfeeb901ac0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets
arkts
onAvailableDevicesChange
当前连的设备 可用设备变化事件
onAvailableDevicesChange(): void { Log.showInfo(TAG, `onAvailableDevicesChange: availableDevices = ${JSON.stringify(this.availableDevices)}`); }
AST#method_declaration#Left onAvailableDevicesChange 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...
onAvailableDevicesChange(): void { Log.showInfo(TAG, `onAvailableDevicesChange: availableDevices = ${JSON.stringify(this.availableDevices)}`); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets#L69-L71
30aebbeb90a35de2ffcdaf1ebaaa1051f6a455f2
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhAlert.ets
arkts
showAlert
中间弹框 @param options
public static showAlert(options: JhAlertOptions) { DialogUtil.showPrimaryDialog({ title: options.title, message: options.message ?? '', primaryButton: { value: options.leftText ?? _cancelText, fontColor: Color.Black, action: () => { options.onCancel?.() } ...
AST#method_declaration#Left public static showAlert AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhAlertOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme...
public static showAlert(options: JhAlertOptions) { DialogUtil.showPrimaryDialog({ title: options.title, message: options.message ?? '', primaryButton: { value: options.leftText ?? _cancelText, fontColor: Color.Black, action: () => { options.onCancel?.() } ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L104-L123
2670e04bdf082f2978d475086c40ea8388832bbb
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/VirtualEconomyService.ets
arkts
特殊优惠接口
export interface SpecialOffer { id: string; title: string; description: string; discountPercentage: number; originalPrice: Map<CurrencyType, number>; discountedPrice: Map<CurrencyType, number>; startTime: string; endTime: string; isActive: boolean; maxPurchases: number; purchaseCount: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SpecialOffer AST#object_type#Left { AST#type_member#Left id : 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 title : AST#type_annotation#Left A...
export interface SpecialOffer { id: string; title: string; description: string; discountPercentage: number; originalPrice: Map<CurrencyType, number>; discountedPrice: Map<CurrencyType, number>; startTime: string; endTime: string; isActive: boolean; maxPurchases: number; purchaseCount: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L114-L126
1a0a6ad3cf75529b255af6e4d0ad162ae6955784
github
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getDnsServers
Getter and setter for dnsServers
getDnsServers(): Array<string> | undefined { return this.dnsServers; }
AST#method_declaration#Left getDnsServers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right...
getDnsServers(): Array<string> | undefined { return this.dnsServers; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L164-L166
5b1e7151dbaba0d3b7ee9dba33b20a52b266fe9b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
query
查询数据库 @param context 上下文 @param predicates predicates @return ret | resultSet 结果
public async query(context: common.Context): Promise<Array<Contact>> { logger.info(TAG, 'query begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); return []; } let predicates = new rdb.RdbPredicates(TABLE_NAME); predicates.orderByAsc('category') if (predicate...
AST#method_declaration#Left public async query AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#typ...
public async query(context: common.Context): Promise<Array<Contact>> { logger.info(TAG, 'query begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); return []; } let predicates = new rdb.RdbPredicates(TABLE_NAME); predicates.orderByAsc('category') if (predicate...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L99-L125
57c30ec2afb50fd9a2fa04e93c09c052f5bb685f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
pushUri
根据路由信息跳转到对应的页面
public static pushUri(name: string, param?: ESObject) { // 如果路由表中没有该路由信息,直接中断执行 if (!DynamicsRouter.routerMap.has(name)) { return; } // 根据路由名获取路由信息 let routerInfo: AppRouterInfo = DynamicsRouter.routerMap.get(name)!; // 如果是第一次跳转,则需要动态引入模块 if (!DynamicsRouter.builderMap.has(name)) { ...
AST#method_declaration#Left public static pushUri AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left ESObject AST#prim...
public static pushUri(name: string, param?: ESObject) { if (!DynamicsRouter.routerMap.has(name)) { return; } let routerInfo: AppRouterInfo = DynamicsRouter.routerMap.get(name)!; if (!DynamicsRouter.builderMap.has(name)) { import(`${routerInfo.pageModule}`) .then...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L91-L125
1ae2106992de8df4397b9e610fa70b8d827f3bea
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/DB/relationDB.ets
arkts
createDatabaseTable
创建并得到指定类型的KVStore数据库
async createDatabaseTable(sqlCreateTable: string) { const STORE_CONFIG = await this.getRdbStoreConfig(); relationalStore.getRdbStore(context, STORE_CONFIG, (err, rdbStore: relationalStore.RdbStore) => { if (err) { console.error(`Failed to get RdbStore. Code:${err.code}, message:${err.message}`); ...
AST#method_declaration#Left async createDatabaseTable AST#parameter_list#Left ( AST#parameter#Left sqlCreateTable : 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#vari...
async createDatabaseTable(sqlCreateTable: string) { const STORE_CONFIG = await this.getRdbStoreConfig(); relationalStore.getRdbStore(context, STORE_CONFIG, (err, rdbStore: relationalStore.RdbStore) => { if (err) { console.error(`Failed to get RdbStore. Code:${err.code}, message:${err.message}`); ...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/DB/relationDB.ets#L23-L36
ead4dd0a7c6cafdfe78612bc7de56b64953b3d0b
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
时间维度统计
export interface TimeStats { totalFocusTime: number; // 总专注时间(分钟) averageTaskTime: number; // 平均任务耗时(分钟) totalPomodoroCount: number; // 总番茄钟数 thisWeekFocusTime: number; // 本周专注时间 thisMonthFocusTime: number; // 本月专注时间 dailyFocusTime: number[]; // 每日专注时间(近7天) peakProductiveHour: ...
AST#export_declaration#Left export AST#interface_declaration#Left interface TimeStats AST#object_type#Left { AST#type_member#Left totalFocusTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 总专注时间(分钟) AST#type_member#Left averageTaskT...
export interface TimeStats { totalFocusTime: number; averageTaskTime: number; totalPomodoroCount: number; thisWeekFocusTime: number; thisMonthFocusTime: number; dailyFocusTime: number[]; peakProductiveHour: number; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L810-L818
4cd80140cc4834508c52f3cca8345e5e08eb0645
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
getUploadInfo
获取上传数据信息
async getUploadInfo() { try { const httpRequest = http.createHttp(); const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/task/preupload/${this.taskId}`); if (response.responseCode === 200) { const data: Record<string, Object> = JSON.parse(response.result as ...
AST#method_declaration#Left async getUploadInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left A...
async getUploadInfo() { try { const httpRequest = http.createHttp(); const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/task/preupload/${this.taskId}`); if (response.responseCode === 200) { const data: Record<string, Object> = JSON.parse(response.result as ...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L452-L473
6cc2eb3eb1cf6bda56282ceb18a1aa9fedcb9b8f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets
arkts
ExamManager
考卷
@ObservedV2 export class ExamManager { /** * 考卷Id */ id: string; /** * 考卷名称 */ name: string | Resource; /** * 当前题目Id, 退出后重新进入时展示退出前的题目id */ currentQuestionId: number; /** * 题目数量 */ total: number; /** * 时间限制(分钟为单位) */ timeLimit: number; /** * 答题正确数量 */ @Trace c...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class ExamManager AST#class_body#Left { /** * 考卷Id */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaratio...
@ObservedV2 export class ExamManager { id: string; name: string | Resource; currentQuestionId: number; total: number; timeLimit: number; @Trace correctNumber: number; @Trace errorNumber: number; examDetails: Array<ExamDetail>; constructor(name: string | Resource, examDetails: ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets#L49-L116
dd404b09d8be107ed8fd7042d3f5df99203c87d6
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/WantUtil.ets
arkts
toWebBrowser
拉起系统浏览器
static async toWebBrowser(url: string): Promise<void> { const context = AppUtil.getContext(); const want: Want = { action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: url, parameters: { bundleName: context.abilityInfo.bundleName, //拉起方应用包名 } ...
AST#method_declaration#Left static async toWebBrowser AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async toWebBrowser(url: string): Promise<void> { const context = AppUtil.getContext(); const want: Want = { action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: url, parameters: { bundleName: context.abilityInfo.bundleName, } } re...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/WantUtil.ets#L176-L187
757574dd69ff65713e010b7d5d290d3e9660e6fe
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
sharedlibrary/src/main/ets/utils/Calc.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export function add(a:number, b:number) { return a + b; }
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a:number, b:number) { return a + b; }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/sharedlibrary/src/main/ets/utils/Calc.ets#L15-L17
ed7c7e023b0fe435563fe348c84d6485a3d5abd7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
arkts
SelectDialogBuilder
SelectDialog
@Builder export function SelectDialogBuilder(options: DialogOptions) { SelectDialog(options) .height(options.height) .width(options.width) .constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight }) .backgroundColor(options.backgroundColor) .backgroundBlurStyle(options.background...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parame...
@Builder export function SelectDialogBuilder(options: DialogOptions) { SelectDialog(options) .height(options.height) .width(options.width) .constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight }) .backgroundColor(options.backgroundColor) .backgroundBlurStyle(options.background...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L98-L111
1d75198f580ba8b1b19d9fd86b030a9654f1caa2
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/components/EnglishKeyboardView.d.ets
arkts
EnglishKeyboardView
@keepTs @ts-nocheck AUTHOR:AbnerMing DATE:2024/10/30 INTRODUCE:英文键盘
@Component export declare struct EnglishKeyboardView { bgColor: ResourceColor; englishBgColor: ResourceColor; otherBgColor: ResourceColor; rectBorderWidth: Length; rectBorderRadius: Length; rectTextSize: Length; rectTextColor: ResourceColor; deleteIconWidth: Length; deleteIconSrc: Pi...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct EnglishKeyboardView AST#component_body#Left { AST#property_declaration#Left bgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type...
@Component export declare struct EnglishKeyboardView { bgColor: ResourceColor; englishBgColor: ResourceColor; otherBgColor: ResourceColor; rectBorderWidth: Length; rectBorderRadius: Length; rectTextSize: Length; rectTextColor: ResourceColor; deleteIconWidth: Length; deleteIconSrc: Pi...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/components/EnglishKeyboardView.d.ets#L8-L29
b2f22bfdda0e7779bae6b0299be3cc39e58d328a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
农历日期信息(兼容性)
export interface LunarDateInfo extends LunarDate {}
AST#export_declaration#Left export AST#interface_declaration#Left interface LunarDateInfo AST#extends_clause#Left extends LunarDate AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface LunarDateInfo extends LunarDate {}
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L41-L41
c5299c574f5e87034692183f47d55399f47d3706
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
buildCustomColorDialog
构建自定义颜色对话框
@Builder buildCustomColorDialog() { Column({ space: UIConstants.LARGE_PADDING }) { Text('自定义颜色') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Column({ space: UIConstants.DEFAULT_PADDING }) { // 主色 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCustomColorDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compon...
@Builder buildCustomColorDialog() { Column({ space: UIConstants.LARGE_PADDING }) { Text('自定义颜色') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Column({ space: UIConstants.DEFAULT_PADDING }) { R...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L724-L833
8c88906af6eefb8a815783d45f25e6d1b88589a1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
safeStringify
安全序列化 @param {Unknown} value - 待序列化的值 @returns {string} 序列化后的字符串
function safeStringify(value: Unknown, pretty: boolean = false): string { if (value === undefined) { return "undefined"; } if (typeof value === "string") { return value; } try { const result: string | undefined = JSON.stringify(value, null, pretty ? 2 : undefined); return result !== undefined ...
AST#function_declaration#Left function safeStringify AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pretty : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
function safeStringify(value: Unknown, pretty: boolean = false): string { if (value === undefined) { return "undefined"; } if (typeof value === "string") { return value; } try { const result: string | undefined = JSON.stringify(value, null, pretty ? 2 : undefined); return result !== undefined ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L155-L168
07bcc81935be957ed1603cedd1d7c1a13467d449
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Common.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class CommonFunc { static sleep(time: number) { return new Promise<string>((resolve: (value: string) => void) => { setTimeout(() => { resolve("ok") }, time) }).then(() => { console.info(`sleep ${time} over...`) }) } }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonFunc AST#class_body#Left { AST#method_declaration#Left static sleep AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#R...
export default class CommonFunc { static sleep(time: number) { return new Promise<string>((resolve: (value: string) => void) => { setTimeout(() => { resolve("ok") }, time) }).then(() => { console.info(`sleep ${time} over...`) }) } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Common.ets#L16-L27
223eafe644b3760d9bcfeb7f42209b529e62e5b3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets
arkts
[End release_camera]
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres...
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets#L61-L74
d3c6f58de306062321684fad5ee56d7d8499ba66
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api12/entry/src/main/ets/MainAbility/pages/RichEditor/RichEditorApi6.ets
arkts
CustomKeyboardBuilder
自定义键盘组件
@Builder CustomKeyboardBuilder() { Column() { Row(){ Button('增加特表情包').onClick(() => { this.controller.addTextSpan("\uD83D\uDE0A", { style: { fontColor: Color.Orange, } }) }) } Grid() { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CustomKeyboardBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ark...
@Builder CustomKeyboardBuilder() { Column() { Row(){ Button('增加特表情包').onClick(() => { this.controller.addTextSpan("\uD83D\uDE0A", { style: { fontColor: Color.Orange, } }) }) } Grid() { ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api12/entry/src/main/ets/MainAbility/pages/RichEditor/RichEditorApi6.ets#L26-L58
336d1af423c1c65205795ba10146237653adc55f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets
arkts
getInfo
new function in derived class
getInfo(): string { return 'this page used Derived NavPathStack, id: ' + this.id; }
AST#method_declaration#Left getInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left ...
getInfo(): string { return 'this page used Derived NavPathStack, id: ' + this.id; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets#L25-L27
86d30d3a3d19478b0bcb3bb85248bd97b00e3f52
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/GridSceneView.ets
arkts
itemWhileDrag
设置GridItem拖拽过程中显示的图形
@Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r('app.string.drag_and_exchange_icon_square_size')) .height($r('app.string.drag_and_exchange_icon_square_size')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemWhileDrag 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 IconWithNameView ( AST#component_parameters#Left { AST#compo...
@Builder itemWhileDrag() { IconWithNameView({ app: this.movedItem }) .width($r('app.string.drag_and_exchange_icon_square_size')) .height($r('app.string.drag_and_exchange_icon_square_size')) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/GridSceneView.ets#L92-L97
af4fa367d851979d6f70a71e978c2c010123f8ad
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getParentPath
通过URI或路径,获取对应文件父目录的路径名。 @param uriOrPath URI或路径
static getParentPath(uriOrPath: string): string { const parentUri = FileUtil.getParentUri(uriOrPath); return FileUtil.getFilePath(parentUri) }
AST#method_declaration#Left static getParentPath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#prim...
static getParentPath(uriOrPath: string): string { const parentUri = FileUtil.getParentUri(uriOrPath); return FileUtil.getFilePath(parentUri) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L223-L226
50da71bd8663bf3720c32b738ee624e6016d057a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/common/Item.ets
arkts
Item
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...
@Sendable // [Start item] export class Item { url: string = ''; id: number = 0; name: string = ''; // [StartExclude item] constructor(url:string,id:number,name:string) { this.url = url; this.id = id; this.name = name; } // [EndExclude item] }
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right // [Start item] export class Item AST#class_body#Left { AST#property_declaration#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expressi...
@Sendable export class Item { url: string = ''; id: number = 0; name: string = ''; constructor(url:string,id:number,name:string) { this.url = url; this.id = id; this.name = name; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/common/Item.ets#L16-L29
c428b1157cdacb39536b1653ac824789c67a6700
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
arkts
decodePKCS1
解密 @param decodeStr 待解密的字符串 @param priKey RSA私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
AST#method_declaration#Left static decodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L110-L113
016502435fa25a9925d13374f5865c64e0171946
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeCBC128
加密-CBC模式-128位 @param str 待加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeCBC128(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeCBC128 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static encodeCBC128(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L137-L140
8c74d528d1ba6508e6a151f76c7040e69d73c758
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
getPassword
获取date日期对应的浏览历史
async getPassword(userAccount:string) { let token = <string> await this.getPreference(userAccount) return token ?? null }
AST#method_declaration#Left async getPassword AST#parameter_list#Left ( AST#parameter#Left userAccount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar...
async getPassword(userAccount:string) { let token = <string> await this.getPreference(userAccount) return token ?? null }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L83-L86
8263376750998b5067643bc53e241f672055eab5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildPreviewDialog
构建预览对话框
@Builder buildPreviewDialog() { Column() { // 背景遮罩 Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showPreview = false; }) // 预览内容 Column({ space: 16 }) { Row() { Text...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPreviewDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 背景遮罩 AS...
@Builder buildPreviewDialog() { Column() { Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showPreview = false; }) Column({ space: 16 }) { Row() { Text('祝福语预览') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L693-L804
ca1fc7b3c7374b6622af4d27bb6e9f31b72505cf
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/SettingsStorage.ets
arkts
默认站点设置
export async function getDefaultSite(): Promise<boolean> { const settings = getSettingsInstance(); // false = S站, true = T站 return (await settings.get("defaultSiteT", true)) as boolean; }
AST#export_declaration#Left export AST#function_declaration#Left async function getDefaultSite AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_...
export async function getDefaultSite(): Promise<boolean> { const settings = getSettingsInstance(); return (await settings.get("defaultSiteT", true)) as boolean; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L23-L27
92bc9e785beefc56582161cce74543d0a98b6399
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Play mode.
export enum PlayMode { LIST_LOOP = 0, SINGLE_LOOP = 1, RANDOM_PLAY = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum PlayMode AST#enum_body#Left { AST#enum_member#Left LIST_LOOP = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SINGLE_LOOP = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left R...
export enum PlayMode { LIST_LOOP = 0, SINGLE_LOOP = 1, RANDOM_PLAY = 2 }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L186-L190
28e002bd5aa1e2ff359c724c54e80baea1b2d275
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildOverviewTab
构建总览标签页
@Builder buildOverviewTab(overview: OverviewStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { // 核心指标卡片 this.buildStatsCard('核心数据', [ { label: '总联系人', value: overview.totalContacts.toString(), icon: $r('app.media.ic_contacts') }, { label: '总祝福语', value:...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildOverviewTab AST#parameter_list#Left ( AST#parameter#Left overview : AST#type_annotation#Left AST#primary_type#Left OverviewStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_f...
@Builder buildOverviewTab(overview: OverviewStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { this.buildStatsCard('核心数据', [ { label: '总联系人', value: overview.totalContacts.toString(), icon: $r('app.media.ic_contacts') }, { label: '总祝福语', value: overview...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L200-L272
92efb032c16f4d28d6593200b9984db182ed8d16
github
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/view/IndexModule.ets
arkts
VideoModule
The modules in index
@Component export struct VideoModule { private moduleName: string = ''; build() { Column() { Flex({ direction: FlexDirection.Row }) { Text(this.moduleName) .fontSize(MARGIN_FONT_SIZE.THIRD_MARGIN) .fontWeight(FontWeight.Bolder) } .margin({ left: STRING_PERC...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoModule AST#component_body#Left { AST#property_declaration#Left private moduleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' ...
@Component export struct VideoModule { private moduleName: string = ''; build() { Column() { Flex({ direction: FlexDirection.Row }) { Text(this.moduleName) .fontSize(MARGIN_FONT_SIZE.THIRD_MARGIN) .fontWeight(FontWeight.Bolder) } .margin({ left: STRING_PERC...
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/view/IndexModule.ets#L11-L52
68895c76a1df933635f9f835bde8a9f04c5c20db
github
liudi25385/mybit.git
865f64ff6b2e10f5b79100064dff05e67607a5bc
entry/src/main/ets/utils/PermissionsUtil.ets
arkts
权限工具
export class PermissionsUtil { static async reqPermissionsFromUser(permissionList: Permissions[]): Promise<number[]> { let context = getContext() as common.UIAbilityContext; let atManager = abilityAccessCtrl.createAtManager(); let grantStatus = await atManager.requestPermissionsFromUser(context, permissio...
AST#export_declaration#Left export AST#class_declaration#Left class PermissionsUtil AST#class_body#Left { AST#method_declaration#Left static async reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissionList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#a...
export class PermissionsUtil { static async reqPermissionsFromUser(permissionList: Permissions[]): Promise<number[]> { let context = getContext() as common.UIAbilityContext; let atManager = abilityAccessCtrl.createAtManager(); let grantStatus = await atManager.requestPermissionsFromUser(context, permissio...
https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/utils/PermissionsUtil.ets#L6-L28
c2172f306136d6258bfc52e3bb3a55e81de941db
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeAsymSegment
非对称分段加密 @param encodeStr 待加密的字符串 @param pubKey 给定秘钥规格公钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @param isPem 是否为pem格式的key
static encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): string { //将公钥转换 let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) : ...
AST#method_declaration#Left static encodeAsymSegment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): string { let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) : Cryp...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L296-L328
a3de18c95010be34dcbd3bb8fa76651e3f0e1c27
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
arkts
应用图标工具类
export class AppIcons { // 通用图标 static readonly back: string = '/common/icons/back.png'; static readonly home: string = '/common/icons/home.png'; static readonly task: string = '/common/icons/task.png'; static readonly dream: string = '/common/icons/dream.png'; static readonly discover: string = '/common/ic...
AST#export_declaration#Left export AST#class_declaration#Left class AppIcons AST#class_body#Left { // 通用图标 AST#property_declaration#Left static readonly back : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/common/icons/back.png' AST#expres...
export class AppIcons { static readonly back: string = '/common/icons/back.png'; static readonly home: string = '/common/icons/home.png'; static readonly task: string = '/common/icons/task.png'; static readonly dream: string = '/common/icons/dream.png'; static readonly discover: string = '/common/icons/dis...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L17-L82
6b59b14b7d36e7ce08da0d8eaf7dd50ff060f02a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
getCompressedPicture
获取压缩通知的图片(图像像素的总字节数不能超过2MB) @param pixelMap:原始待压缩图片的PixelMap对象 @returns 返回压缩后的图片数据
static async getCompressedPicture(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 2 * 1024 * 1024; //通知的图片内容(图像像素的...
AST#method_declaration#Left static async getCompressedPicture AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#R...
static async getCompressedPicture(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 2 * 1024 * 1024; let pixelB...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L415-L427
d19edac6658189fff13a90af1698e8398bc708df
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isLess
日期比较(小于) @param date1 基准日期 @param date2 对比日期 @returns true 如果 date1 < date2
static isLess(date1: Date, date2: Date): boolean { return date1.getTime() < date2.getTime(); }
AST#method_declaration#Left static isLess AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right ...
static isLess(date1: Date, date2: Date): boolean { return date1.getTime() < date2.getTime(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L52-L54
3d988fb1a1fe4288f64de50f855adbe99361e0b3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets
arkts
pictures of photo.
export const PICTURE_PHOTO: PictureItem[] = [ { id: '1', name: '蓝·静', description: '用放大镜看世界', image: $r("app.media.ic_photo1") }, { id: '2', name: '花', description: '每个人心中都有一个童话', image: $r("app.media.ic_photo2") }, { id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") }, { id: '4'...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PICTURE_PHOTO : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#...
export const PICTURE_PHOTO: PictureItem[] = [ { id: '1', name: '蓝·静', description: '用放大镜看世界', image: $r("app.media.ic_photo1") }, { id: '2', name: '花', description: '每个人心中都有一个童话', image: $r("app.media.ic_photo2") }, { id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") }, { id: '4'...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets#L40-L45
e772d7bc1f85838ee6abcdd39cb80a3834adcbfd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/DataManagement/UDMF/UniformTypeDescriptor/UTDType/entry/src/main/ets/pages/Index.ets
arkts
CreatePrecastFile
预制文件
function CreatePrecastFile(): void { try { let res = fs.accessSync(filesDir); if (res) { logger.info(TAG, `file path: ${filesDir} exists`); } else { logger.info(TAG, `file path: ${filesDir} not exists`); fs.mkdirSync(filesDir); } } catch (error) { let err: BusinessError = error...
AST#function_declaration#Left function CreatePrecastFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#sta...
function CreatePrecastFile(): void { try { let res = fs.accessSync(filesDir); if (res) { logger.info(TAG, `file path: ${filesDir} exists`); } else { logger.info(TAG, `file path: ${filesDir} not exists`); fs.mkdirSync(filesDir); } } catch (error) { let err: BusinessError = error...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DataManagement/UDMF/UniformTypeDescriptor/UTDType/entry/src/main/ets/pages/Index.ets#L58-L90
f7a115530c9261c49bc2c0a91c149a3ebf65cb42
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
confirmDialog
信息确认类弹出框
confirmDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showConfirmDialog({ checkTips: "是否记住密码?", content: "您是否退出当前应用", onCheckedChange: (check) => { ToastUtil.showToast(`${check}`); }, onAction: (action) => { ToastUtil.showToast(`...
AST#method_declaration#Left confirmDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_stateme...
confirmDialog(index: number) { if (index == 0) { DialogHelper.showConfirmDialog({ checkTips: "是否记住密码?", content: "您是否退出当前应用", onCheckedChange: (check) => { ToastUtil.showToast(`${check}`); }, onAction: (action) => { ToastUtil.showToast(`${acti...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L261-L317
4358c09a9fb98b20522a87309b646fccde1aaae1
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/init_process.ets
arkts
tabs
Inits and fills bunch_of_tabs settings. MUST BE EXECUTED AFTER INITIALIZATION OF bunch_of_settings! @param t0 Start time of the whole initialization process.
function tabs(storage: LocalStorage) { let tabs = new bunch_of_tabs(false, storage); // AppStorage.setOrCreate('bunch_of_tabs', tabs); storage.setOrCreate('bunch_of_tabs', tabs); storage.setOrCreate('showing_tabs', bunch_of_settings.get('status_tabs_open') as boolean); // Store tabs of this window let all_...
AST#function_declaration#Left function tabs AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar...
function tabs(storage: LocalStorage) { let tabs = new bunch_of_tabs(false, storage); storage.setOrCreate('bunch_of_tabs', tabs); storage.setOrCreate('showing_tabs', bunch_of_settings.get('status_tabs_open') as boolean); let all_bunch_of_tabs: bunch_of_tabs[] | undefined = AppStorage.get('all_bunch_of_tab...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L495-L538
725fa19c077edf80f7dededce354dfbcb183bfca
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
downloadJsonTemplate
下载JSON模板
private downloadJsonTemplate() { const template = JsonParser.generateJsonTemplate(); this.jsonContent = template; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'JSON template generated'); }
AST#method_declaration#Left private downloadJsonTemplate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left template = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#L...
private downloadJsonTemplate() { const template = JsonParser.generateJsonTemplate(); this.jsonContent = template; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'JSON template generated'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L815-L819
8a8bcabe092817b8be8bf50ec4987771c1bb5a44
github