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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets | arkts | processReminderData | processReminderData | function processReminderData(params: PublishReminderInfo, preferences: preferences.Preferences, notifyId: string) {
let timer = fetchData(params);
reminderAgent.publishReminder(timer).then((reminderId: number) => {
putPreferencesValue(preferences, notifyId, reminderId);
}).catch((err: Error) => {
Logger.e... | AST#function_declaration#Left function processReminderData AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PublishReminderInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preferences : AST#type_annotation#Left AST#primary... | function processReminderData(params: PublishReminderInfo, preferences: preferences.Preferences, notifyId: string) {
let timer = fetchData(params);
reminderAgent.publishReminder(timer).then((reminderId: number) => {
putPreferencesValue(preferences, notifyId, reminderId);
}).catch((err: Error) => {
Logger.e... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets#L102-L109 | 241e5dc643839fbb0f48a4b2f3080b899039915e | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 定义接口返回数据结构 | export interface ResponseDao<T> {
success: boolean;
message: string | null;
code: string;
data: T;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ResponseDao AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | export interface ResponseDao<T> {
success: boolean;
message: string | null;
code: string;
data: T;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L8-L13 | 9b9b9445a2b57e8ee898c38763cbf61e67d04d99 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/navigation/MainGraph.ets | arkts | @file 主模块导航图
@author Joker.X | export class MainGraph implements RouteGraph {
/**
* 注册主模块导航路由
* @returns {void} 无返回值
*/
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
}
} | AST#export_declaration#Left export AST#class_declaration#Left class MainGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册主模块导航路由
* @returns {void} 无返回值
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : ... | export class MainGraph implements RouteGraph {
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/navigation/MainGraph.ets#L9-L17 | 97ded3c6e0f52c2d8bf04e44d8f24c216859c53d | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/common/UIUtils.ets | arkts | 路由参数 | export class RouteParams {
episodeId?: string;
podcastId?: string;
} | AST#export_declaration#Left export AST#class_declaration#Left class RouteParams AST#class_body#Left { AST#property_declaration#Left episodeId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left podcastI... | export class RouteParams {
episodeId?: string;
podcastId?: string;
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L5-L8 | 047676d8e0d59fe5dd7f1d22eb0c02d68771ddf9 | github | |
Autumnker/ArkTS_FreeKnowledgeChat.git | cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7 | entry/src/main/ets/commonViews/myShowToast.ets | arkts | 提示消息,持续时间两秒 | export function myShowToast(content:string){
promptAction.showToast({
message:content,
duration:2000,
alignment:Alignment.Center
})
} | AST#export_declaration#Left export AST#function_declaration#Left function myShowToast 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_list#Right AST#block_statement#Left { AS... | export function myShowToast(content:string){
promptAction.showToast({
message:content,
duration:2000,
alignment:Alignment.Center
})
} | https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/commonViews/myShowToast.ets#L4-L10 | 7e1c76c087eec47b8170fb822c0fce5bc1cf5ed9 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildSendMethodOption | 构建发送方式选项 | @Builder
buildSendMethodOption(label: string, method: NotificationMethod, icon: Resource) {
Column({ space: 4 }) {
Image(icon)
.width(24)
.height(24)
.fillColor(this.sendMethod === method ? '#007AFF' : '#666666')
Text(label)
.fontSize(12)
.fontColor(this.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendMethodOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annota... | @Builder
buildSendMethodOption(label: string, method: NotificationMethod, icon: Resource) {
Column({ space: 4 }) {
Image(icon)
.width(24)
.height(24)
.fillColor(this.sendMethod === method ? '#007AFF' : '#666666')
Text(label)
.fontSize(12)
.fontColor(this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L533-L552 | 248d9d83e3aadc71e4d6d742b54bd5da0b4393e8 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | isSupportTemplate | 查询模板是否存在,目前仅支持进度条模板。
@param templateName 模板名称。当前仅支持'downloadTemplate'。
@returns | static async isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> {
return notificationManager.isSupportTemplate(templateName);
} | AST#method_declaration#Left static async isSupportTemplate AST#parameter_list#Left ( AST#parameter#Left templateName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'downloadTemplate' AST#expression#Right AST#parameter#Right ) AST#parameter_... | static async isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> {
return notificationManager.isSupportTemplate(templateName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L123-L125 | 564320e17fc4e280fab3b1599f48bf72f5aa86c3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ObjectUtil.ets | arkts | plainToClass | 将普通纯对象转换为指定类的实例(嵌套类需要添加装饰器NestedClassV6)
@param clazz 目标类的构造函数
@param obj 普通JSON纯对象
@returns | static plainToClass<T>(clazz: Constructor<T>, obj: Object): T {
return ClassTransformer.plainToClass(clazz, obj);
} | AST#method_declaration#Left static plainToClass AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left clazz : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Constructor AST#type_arguments#Left < AST#ty... | static plainToClass<T>(clazz: Constructor<T>, obj: Object): T {
return ClassTransformer.plainToClass(clazz, obj);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L183-L185 | ce0f0796c18701db2f03a8195ba8c940ad24581b | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 体系分类下数据
@param date
@returns | export function systemCategoryItemList(cid:number,page:number) {
return axiosClient.get<HomeArticleModel>({
url: `article/list/${page}/json?cid=${cid}`,
showLoading:page == 0
})
} | AST#export_declaration#Left export AST#function_declaration#Left function systemCategoryItemList AST#parameter_list#Left ( AST#parameter#Left cid : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#L... | export function systemCategoryItemList(cid:number,page:number) {
return axiosClient.get<HomeArticleModel>({
url: `article/list/${page}/json?cid=${cid}`,
showLoading:page == 0
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L205-L210 | 5662fa71c187515f79b455a5cb6c99b65d2e3ce6 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets | arkts | send | Send a packet on the available WebSocket.
@param packet Packet to send | send(packet: Object): void {
if (!this.connection) {
this.debug('No connection to websocket');
return;
}
this.connection.send(packet);
} | AST#method_declaration#Left send AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#ty... | send(packet: Object): void {
if (!this.connection) {
this.debug('No connection to websocket');
return;
}
this.connection.send(packet);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets#L59-L65 | 6d5c03b4aa01bc62fb6875b2a87704e1894c59f4 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets | arkts | TabNode | Custom Component Reuse Pool Swiper Page | @Component
export struct TabNode {
// [StartExclude flow_item_node]
minSize: number = 80;
maxSize: number = 180;
fontSize: number = 24;
@State index: number = 0;
scroller: Scroller = new Scroller();
dataSource: WaterFlowDataSource = new WaterFlowDataSource();
// FlowItem component height list
private ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabNode AST#component_body#Left { // [StartExclude flow_item_node] AST#property_declaration#Left minSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export struct TabNode {
minSize: number = 80;
maxSize: number = 180;
fontSize: number = 24;
@State index: number = 0;
scroller: Scroller = new Scroller();
dataSource: WaterFlowDataSource = new WaterFlowDataSource();
private itemHeightArray: number[] = [];
private itemWidthArray: numb... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets#L32-L58 | b0345445f67a17aaed4cd5e49740233cb265042f | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/update/UpdateManager.ets | arkts | getCurrentVersion | 获取当前应用版本信息 | async getCurrentVersion(): Promise<{ version: string; versionCode: number }> {
try {
if (!this.context) {
throw new Error('Context not set');
}
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT);
return {
version: bun... | AST#method_declaration#Left async getCurrentVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Promise AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left < AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left ... | async getCurrentVersion(): Promise<{ version: string; versionCode: number }> {
try {
if (!this.context) {
throw new Error('Context not set');
}
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT);
return {
version: bun... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/update/UpdateManager.ets#L58-L72 | 119574bf7d66ecd8c4d5d043847afd6b8e544d7f | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets | arkts | verify | 验签
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey 公钥
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static async verify(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256);
} | AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | static async verify(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets#L53-L55 | 0e6a3563300f94fd724b72926ed16a0e31f0354f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets | arkts | get | 获取单例实例 | public static get shared(): CosDownloaderUserData {
return this.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CosDownloaderUserData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statem... | public static get shared(): CosDownloaderUserData {
return this.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets#L26-L28 | 892feca45fcffb2724e6b11e22e00f19b0ea3ae8 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/common/Card.ets | arkts | CompletedRoutableCard | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symb... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompletedRoutableCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right symbol : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#t... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symb... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/common/Card.ets#L16-L48 | a1c72dfbf48be668dd247672285b85d583f12165 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/JSONUtil.ets | arkts | beanToJsonStr | 对象转JSON字符串
@param data
@returns JSON字符串 | static beanToJsonStr(data: Object | Array<Object | String | Number | Boolean> | null | undefined): string {
try {
if (data == null || data == undefined) {
return ''
}
return JSON.stringify(data);
} catch (err) {
LogUtil.error(err);
return ""
}
} | AST#method_declaration#Left static beanToJsonStr AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left... | static beanToJsonStr(data: Object | Array<Object | String | Number | Boolean> | null | undefined): string {
try {
if (data == null || data == undefined) {
return ''
}
return JSON.stringify(data);
} catch (err) {
LogUtil.error(err);
return ""
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/JSONUtil.ets#L62-L72 | c9fdc1b1e96f74d366467f757e75d822360a7a1b | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/result/src/main/ets/RequestHelper.ets | arkts | toastIfNeeded | 按需弹出错误提示
@param {string} message - 错误信息 | private toastIfNeeded(message: string): void {
if (this.useToast) {
ToastUtils.showError(message);
}
} | AST#method_declaration#Left private toastIfNeeded AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary... | private toastIfNeeded(message: string): void {
if (this.useToast) {
ToastUtils.showError(message);
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L137-L141 | 2ba3edd2deef003152deaa86a481c5fd45703327 | github |
yinxing2008/note_hongmeng_ArkUI.git | 5c7459ca682903d9184539facc63136bbe6230b9 | entry/src/main/ets/data/UserDataStore.ets | arkts | save | 保存用户数据 | public save() {
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
storage.putSync("token", this.getToken());
storage.flushSync();
} else {
// ... | AST#method_declaration#Left public save 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#call_expression#Left AST#expression#Left AST#mem... | public save() {
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
storage.putSync("token", this.getToken());
storage.flushSync();
} else {
}
... | https://github.com/yinxing2008/note_hongmeng_ArkUI.git/blob/5c7459ca682903d9184539facc63136bbe6230b9/entry/src/main/ets/data/UserDataStore.ets#L55-L67 | a8dd99eff640e64073acd0891a3968a7dfb25c0f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets | arkts | CommonItemSelect | Select in item style, provide multiple choices based on menuList | @Component
export struct CommonItemSelect {
private selects: ResourceStr[] = [];
private callback: (index: number, value: string) => void = (index: number, value: string) => {};
private selectOption: SelectOption[] = [];
private name: ResourceStr = '';
private testId: string = 'test_itemSelect';
private sel... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemSelect AST#component_body#Left { AST#property_declaration#Left private selects : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceStr [ ] AST#array_type#Right AST#primary_type#Right... | @Component
export struct CommonItemSelect {
private selects: ResourceStr[] = [];
private callback: (index: number, value: string) => void = (index: number, value: string) => {};
private selectOption: SelectOption[] = [];
private name: ResourceStr = '';
private testId: string = 'test_itemSelect';
private sel... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L119-L167 | c0ba41a932b43d86d3acee416c8467d677f3f686 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/view/EditorComponent.ets | arkts | titleBuilder | Building a caption. | @Builder
titleBuilder(titleInfo: TitleInfo) {
if (titleInfo.titlePicUrl.length !== 0) {
Text() {
Span(titleInfo.titlePicUrl)
Span(titleInfo.title)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right titleBuilder AST#parameter_list#Left ( AST#parameter#Left titleInfo : AST#type_annotation#Left AST#primary_type#Left TitleInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | @Builder
titleBuilder(titleInfo: TitleInfo) {
if (titleInfo.titlePicUrl.length !== 0) {
Text() {
Span(titleInfo.titlePicUrl)
Span(titleInfo.title)
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/EditorComponent.ets#L167-L173 | 479c3379eebb88c3629482608df422ceff898132 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatController.ets | arkts | 聊天信息控制类
@author 却家庭
@version 1.0
@date 2024.10.10 | export class ChatController {
/**
* 聊天信息组件对象
*/
public chatCtrl: IChatUI | null = null;
/**
* 提交用户输入内容函数
*
* @param userIputText
*/
public submitUserInput(userIputText: string) {
if (this.chatCtrl) {
this.chatCtrl.submitUserInput(userIputText);
}
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ChatController AST#class_body#Left { /**
* 聊天信息组件对象
*/ AST#property_declaration#Left public chatCtrl : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IChatUI AST#primary_type#Right | AST#primary_type#Left null AST#primary_type... | export class ChatController {
public chatCtrl: IChatUI | null = null;
public submitUserInput(userIputText: string) {
if (this.chatCtrl) {
this.chatCtrl.submitUserInput(userIputText);
}
}
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatController.ets#L10-L27 | 64ff8a8e0acb8f2b70f783a2e30ab8562c5380f5 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatUserItemtUI.ets | arkts | ChatUserItemUI | User聊天单元信息显示组件类 | @Component
export struct ChatUserItemUI {
/**
* 消息对象
*/
public item: ChatMessage | null = null;
build(){
Column(){
//文本
Text(this.item!.content)
.width('100%')
.fontSize('18fp')
.textAlign(TextAlign.Start)
.fontColor(Color.Black)
.lineHeight('24fp')
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChatUserItemUI AST#component_body#Left { /**
* 消息对象
*/ AST#property_declaration#Left public item : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChatMessage AST#primary_type#Right | AST#prim... | @Component
export struct ChatUserItemUI {
public item: ChatMessage | null = null;
build(){
Column(){
Text(this.item!.content)
.width('100%')
.fontSize('18fp')
.textAlign(TextAlign.Start)
.fontColor(Color.Black)
.lineHeight('24fp')
if (this.i... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatUserItemtUI.ets#L7-L31 | 2535212256e0565573dfbaf15bfc2757b9dc3285 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | photoOutputCallBack | 监听拍照事件 | photoOutputCallBack(photoOutput: camera.PhotoOutput): void {
try {
// 监听拍照开始
photoOutput.on('captureStartWithInfo', (err: BusinessError, captureStartInfo: camera.CaptureStartInfo): void => {
Logger.info(TAG, `photoOutputCallBack captureStartWithInfo success: ${JSON.stringify(captureStartInfo)}`)... | AST#method_declaration#Left photoOutputCallBack AST#parameter_list#Left ( AST#parameter#Left photoOutput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . PhotoOutput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | photoOutputCallBack(photoOutput: camera.PhotoOutput): void {
try {
photoOutput.on('captureStartWithInfo', (err: BusinessError, captureStartInfo: camera.CaptureStartInfo): void => {
Logger.info(TAG, `photoOutputCallBack captureStartWithInfo success: ${JSON.stringify(captureStartInfo)}`);
}... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L581-L612 | fbd3084027b465e5baaaf57b7641920c759d2ee1 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/LocalSocket.ets | arkts | aboutToDisappear | 服务端状态 | aboutToDisappear(): void {
workerPort.terminate();
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | aboutToDisappear(): void {
workerPort.terminate();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/LocalSocket.ets#L40-L42 | 72dc9a371be935fdd64bb692dd32e7921576e357 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets | arkts | debug | Emits a debug event.
@param message Debug message | debug(message: string): void {
this.client.emit('debug', `[ws] ${message}`);
} | AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#... | debug(message: string): void {
this.client.emit('debug', `[ws] ${message}`);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets#L39-L41 | 2bb220a1b3b8ce73a12e168d7e2f652566525e92 | github |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/itemview/ItemCallView.ets | arkts | ItemCallView | 对讲-呼叫列表的Item | @ComponentV2
export struct ItemCallView {
@Require @Param itemData:CallListItemData
build() {
Column(){
Image(this.itemData.imageSrc)
.width(138)
.height(138)
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(24)
.margin({top:16})
}
.width('100%')
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ItemCallView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right itemData : AST#type_annotation#Left AST#primary_ty... | @ComponentV2
export struct ItemCallView {
@Require @Param itemData:CallListItemData
build() {
Column(){
Image(this.itemData.imageSrc)
.width(138)
.height(138)
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(24)
.margin({top:16})
}
.width('100%')
... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ItemCallView.ets#L6-L26 | b9ca742f349d61b6cf793978af6b5315203948be | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | createStream | 基于文件路径打开文件流,使用Promise异步回调。
@param path string 文件的应用沙箱路径。
@param mode string 文件打开类型
r:打开只读文件,该文件必须存在。
r+:打开可读写的文件,该文件必须存在。
w:打开只写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。
w+:打开可读写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。
a:以附加的方式打开只写文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾,即文件原先的内容会被保留。
a+:以附加方式打开可读写的文件。若文件不存在,则会建立该文件,如果文件存在,写... | static createStream(path: string, mode: string = 'r'): Promise<fs.Stream> {
return fs.createStream(path, mode)
} | AST#method_declaration#Left static createStream AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | static createStream(path: string, mode: string = 'r'): Promise<fs.Stream> {
return fs.createStream(path, mode)
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L779-L781 | a928ae158da3661cc5fbf97936e3f758c54bc371 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/entry/src/main/ets/managers/SendableFreeze.ets | arkts | init | 一些配置属性与方法 | init() {
// 初始化相关逻辑
freezeObj(this); // 初始化完成后冻结当前对象
} | AST#method_declaration#Left init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 初始化相关逻辑 AST#ui_custom_component_statement#Left freezeObj ( AST#expression#Left this AST#expression#Right ) ; AST#ui_custom_component_statement#Right // 初始化完成后冻结当前对象 } AST#builder_function_body#Right... | init() {
freezeObj(this);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/entry/src/main/ets/managers/SendableFreeze.ets#L23-L26 | c997402e75c96487296bc9ed0487e434cf9f7ca3 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildAppInfoDialog | 应用信息对话框 | @Builder
buildAppInfoDialog() {
Stack() {
// 遮罩层
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0,0,0,0.5)')
.onClick(() => {
this.showAppInfo = false;
})
// 对话框内容
Scroll() {
Column({ space: 20 }) {
// 应用图... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAppInfoDialog 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 Stack ( ) AST#container_content_body#Left { // 遮罩层 AST#... | @Builder
buildAppInfoDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0,0,0,0.5)')
.onClick(() => {
this.showAppInfo = false;
})
Scroll() {
Column({ space: 20 }) {
Column({ ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5630-L5778 | 668ee59ea6e4b6a31721da246edf15cf193a02f4 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AssetUtil.ets | arkts | add | 新增一条关键资产
@param key 关键资产别名key
@param value 关键资产明文
@param e10 在应用卸载时是否需要保留关键资产
@returns | static async add(key: string, value: string, e10: boolean = true): Promise<boolean> {
try {
if (!AssetUtil.canIUse()) {
LogUtil.error(`AssetStore-当前设备不支持该模块`);
return false;
}
let attr: asset.AssetMap = new Map();
attr.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key));
... | AST#method_declaration#Left static async add AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | static async add(key: string, value: string, e10: boolean = true): Promise<boolean> {
try {
if (!AssetUtil.canIUse()) {
LogUtil.error(`AssetStore-当前设备不支持该模块`);
return false;
}
let attr: asset.AssetMap = new Map();
attr.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key));
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AssetUtil.ets#L36-L57 | 82f12d04b2ee3d267839275b97dafa4fdecc636b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | appendDataList | 追加多条数据 | public appendDataList(dataList: T[]): void {
dataList.forEach(data => {
this.appendData(data)
})
this.notifyDataReload();
} | AST#method_declaration#Left public appendDataList AST#parameter_list#Left ( AST#parameter#Left dataList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le... | public appendDataList(dataList: T[]): void {
dataList.forEach(data => {
this.appendData(data)
})
this.notifyDataReload();
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L101-L106 | c7936a6ff63f99d5889a36f000364b7aa7219514 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/ArrayStringUtils.ets | arkts | getFirstCharIndex | 根据indexInArray计算出,此页的第一个字在text字中的index
@param indexInArray 数组中的索引 | static getFirstCharIndex(arr: string[], indexInArray: number): number {
if (indexInArray >= arr.length) {
return -1;
}
let index = 0;
for (let i = 0; i < indexInArray; i++) {
index += arr[i].length;
}
return index;
} | AST#method_declaration#Left static getFirstCharIndex AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left indexInArray : AST#type_ann... | static getFirstCharIndex(arr: string[], indexInArray: number): number {
if (indexInArray >= arr.length) {
return -1;
}
let index = 0;
for (let i = 0; i < indexInArray; i++) {
index += arr[i].length;
}
return index;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L34-L45 | d3e1eb9010efe7c3f370ce2c675e644394d806a6 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPVersionUtils.ets | arkts | clearHistory | 保留3个版本 | static async clearHistory(cacheVersion: string, dir: string) {
try {
let listFile = await fs.listFile(dir);
if (listFile != null) {
let filterList = listFile.filter((value) => (value !== 'config.json'))
filterList.sort((a, b) => DMPVersionUtil.compareVersion(b, a))
if (filterList... | AST#method_declaration#Left static async clearHistory AST#parameter_list#Left ( AST#parameter#Left cacheVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dir : AST#type_annotation#Left AST#primary_type#Left string AS... | static async clearHistory(cacheVersion: string, dir: string) {
try {
let listFile = await fs.listFile(dir);
if (listFile != null) {
let filterList = listFile.filter((value) => (value !== 'config.json'))
filterList.sort((a, b) => DMPVersionUtil.compareVersion(b, a))
if (filterList... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPVersionUtils.ets#L8-L30 | 3b40aa4424c14429e92fa6270a3fd9f0abe31ac9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | getCurrencyBalance | 获取货币余额 | getCurrencyBalance(currencyType: CurrencyType): number {
if (!this.userWallet) return 0;
return this.userWallet.balances.get(currencyType) || 0;
} | AST#method_declaration#Left getCurrencyBalance AST#parameter_list#Left ( AST#parameter#Left currencyType : AST#type_annotation#Left AST#primary_type#Left CurrencyType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number A... | getCurrencyBalance(currencyType: CurrencyType): number {
if (!this.userWallet) return 0;
return this.userWallet.balances.get(currencyType) || 0;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L259-L262 | 2edff42a24672da5a2356d2446e348c57092e1ec | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 14时06分55秒 | export const DATE_FORMAT17: string = "HH时mm分"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT17 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "HH时mm分" AST#expression#Right AST#variable_declarator#Right ; AST#variable_decl... | export const DATE_FORMAT17: string = "HH时mm分"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L36-L36 | 60c02caff67466e2878ebbd048387289f493aa6e | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | restartApp | 应用重启并拉起自身指定UIAbility。重启时不会收到onDestroy回调。仅支持主线程调用,且待重启的应用需要处于获焦状态。
@param want Want类型参数,传入需要启动的UIAbility的信息,Bundle名称不做校验。 | static restartApp(want?: Want) {
const context= ArkWebHelper.getContext();
if (want === undefined) {
want = {
bundleName: context.abilityInfo.bundleName, //设置应用bundleName
abilityName: context.abilityInfo.name, //设置应用abilityName
}
}
context.getApplicationContext().restartApp(w... | AST#method_declaration#Left static restartApp AST#parameter_list#Left ( AST#parameter#Left want ? : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#L... | static restartApp(want?: Want) {
const context= ArkWebHelper.getContext();
if (want === undefined) {
want = {
bundleName: context.abilityInfo.bundleName,
abilityName: context.abilityInfo.name,
}
}
context.getApplicationContext().restartApp(want);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L30-L39 | 8ae315f08c257933fceb5fc36fe838b73ec9924b | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | Global Component Reuse Pool | export class NodePool {
// [StartExclude builder_node_pool]
private static instance: NodePool;
private idGen: number;
private nodePool: HashMap<string, Array<NodeItem>>;
private constructor() {
this.nodePool = new HashMap();
this.idGen = 0;
}
// Using singleton mode for global management of comp... | AST#export_declaration#Left export AST#class_declaration#Left class NodePool AST#class_body#Left { // [StartExclude builder_node_pool] AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left NodePool AST#primary_type#Right AST#type_annotation#Right ; AST#property_declarati... | export class NodePool {
private static instance: NodePool;
private idGen: number;
private nodePool: HashMap<string, Array<NodeItem>>;
private constructor() {
this.nodePool = new HashMap();
this.idGen = 0;
}
public static getInstance() {
if (!NodePool.instance) {
NodePool.instance =... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L63-L133 | 29f6791ecc48a428f60d222bb500c449a62f47ec | gitee | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/Manacher.ets | arkts | isPalindrome | 检查字符串是否为回文
@param str 输入字符串
@returns 是否为回文 | static isPalindrome(str: string): boolean {
if (!str || str.length === 0) {
return true;
}
let left = 0;
let right = str.length - 1;
while (left < right) {
if (str[left] !== str[right]) {
return false;
}
left++;
right--;
}
return true;
} | AST#method_declaration#Left static isPalindrome AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty... | static isPalindrome(str: string): boolean {
if (!str || str.length === 0) {
return true;
}
let left = 0;
let right = str.length - 1;
while (left < right) {
if (str[left] !== str[right]) {
return false;
}
left++;
right--;
}
return true;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Manacher.ets#L63-L80 | 1209172e946a70b9d37b51793486a70793e31eb7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets | arkts | getParams | 获取输入参数
@param name - tab项标题
@returns: 输入参数 | public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
} | AST#method_declaration#Left public getParams 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_list#Right : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_typ... | public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets#L68-L70 | 698d7a5c517da5747208d1365df6c41c69b3090e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets | arkts | onTouchEvent | touch事件触发后绘制手指移动轨迹 | onTouchEvent(event: TouchEvent): void {
// TODO:知识点:在手指按下时创建新的MyRenderNode对象,挂载到rootRenderNode上,手指移动时根据触摸点坐标绘制线条,并重新渲染节点
// 获取手指触摸位置的坐标点
const positionX: number = vp2px(event.touches[0].x);
const positionY: number = vp2px(event.touches[0].y);
logger.info(TAG, `Touch positionX: ${positionX}, Touch po... | AST#method_declaration#Left onTouchEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | onTouchEvent(event: TouchEvent): void {
const positionX: number = vp2px(event.touches[0].x);
const positionY: number = vp2px(event.touches[0].y);
logger.info(TAG, `Touch positionX: ${positionX}, Touch positionY: ${positionY}`);
switch (event.type) {
case TouchType.Down: {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets#L149-L171 | 05e4b90756e74aa7d92475fca0c40e36ab4cfdbd | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | interfaces/ets/ani/displaySync/ets/arkui.component.common.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface ExpectedFrameRateRange {
min: number,
max: number,
expected: number,
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ExpectedFrameRateRange AST#object_type#Left { AST#type_member#Left min : 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 max : AST#type_annotati... | export interface ExpectedFrameRateRange {
min: number,
max: number,
expected: number,
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/displaySync/ets/arkui.component.common.ets#L16-L20 | e0dcdade576ef5694a6471ea10e58fe087560a8d | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHA.ets | arkts | digestSHA224 | SHA224摘要
@param str 带摘要的字符串
@returns 摘要后的字符串 | static async digestSHA224(str: string): Promise<string> {
return CryptoUtil.digest(str, 'SHA224');
} | AST#method_declaration#Left static async digestSHA224 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | static async digestSHA224(str: string): Promise<string> {
return CryptoUtil.digest(str, 'SHA224');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L41-L43 | 31fd8045b4414b84f662a8c88c9eab0b30b5a106 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/view/components/PersonContent.ets | arkts | PersonContent | 好友选择列表,包含顶部搜索栏(仅实现添加图片效果)和好友列表 | @Component
export struct PersonContent {
private personList: PersonData[] = [...PERSON_LIST];
@State searchHeight: number = 30;
@Link selectPersonList: PersonData[];
build() {
Column() {
// 搜索栏:使用横向List组件实现群组成员滑动列表
Row() {
List() {
// TODO: 需求:真实场景下,当用户数据较大时,建议使用LazyForEach组件
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PersonContent AST#component_body#Left { AST#property_declaration#Left private personList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PersonData [ ] AST#array_type#Right AST#primary_type#Right ... | @Component
export struct PersonContent {
private personList: PersonData[] = [...PERSON_LIST];
@State searchHeight: number = 30;
@Link selectPersonList: PersonData[];
build() {
Column() {
Row() {
List() {
ForEach(this.selectPersonList, (item: PersonData, index: numb... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/view/components/PersonContent.ets#L21-L213 | b5d281b6479cfae1f0b815feb5c3b3520ebd18d0 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | setFillColor | Sets the color that is used for filling the area below the line.
Resets an eventually set "fillDrawable".
@param color | public setFillColor(color: number): void {
this.mFillColor = color;
this.mFillDrawable = null;
} | AST#method_declaration#Left public setFillColor 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 void AST#primary_typ... | public setFillColor(color: number): void {
this.mFillColor = color;
this.mFillDrawable = null;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineRadarDataSet.ets#L69-L72 | 1a78fafd5dd8419d2492ff8f1a3b3855be2b4e28 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets | arkts | @file 优惠券相关数据源实现类
@author Joker.X | export class CouponNetworkDataSourceImpl implements CouponNetworkDataSource {
/**
* 领取优惠券
* @param {ReceiveCouponRequest} request - 领取参数
* @returns {Promise<NetworkResponse<string>>} 领取结果
*/
async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> {
const resp: AxiosRespo... | AST#export_declaration#Left export AST#class_declaration#Left class CouponNetworkDataSourceImpl AST#implements_clause#Left implements CouponNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 领取优惠券
* @param {ReceiveCouponRequest} request - 领取参数
* @returns {Promise<NetworkResponse<string>>... | export class CouponNetworkDataSourceImpl implements CouponNetworkDataSource {
async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> {
const resp: AxiosResponse<NetworkResponse<string>> =
await NetworkClient.http.post("market/coupon/user/receive", request);
return resp.d... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets#L10-L43 | e85b04ca579aa439fe8329d214551a473f82bbbc | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Message.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Message {
content: string
sendResult: string
constructor | AST#export_declaration#Left export AST#ERROR#Left default class Message { content : string sendResult : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export default class Message {
content: string
sendResult: string
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Message.ets#L16-L20 | 062f87abdbec024739cb1113a914cb052573308b | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomEmitter/feature/emitter/src/main/ets/components/feature/CustomEmitter.ets | arkts | listenerEvents | 以持久化方式订阅购物车购买事件 | public listenerEvents() {
emitter.on(EmitterConst.BUY_EVENT_ID, (eventData: emitter.EventData) => {
});
} | AST#method_declaration#Left public listenerEvents 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 emitter AST#expression#Right . on AST#memb... | public listenerEvents() {
emitter.on(EmitterConst.BUY_EVENT_ID, (eventData: emitter.EventData) => {
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomEmitter/feature/emitter/src/main/ets/components/feature/CustomEmitter.ets#L109-L112 | f9277ce197f9aaf303ee631a61b4989eecc15c98 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getPreviousMonthLastDays | 用于获取前一个月的最后几天
@param year 年
@param month 月
@param firstDayOfWeek 当前月份的第一天是周几
@returns | static getPreviousMonthLastDays(year: number, month: number, firstDayOfWeek: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_PREVIOUS_MONTH = TimeUtils.getLastDayOfMonth(year, month - 1);
for (let i = LAST_DAY_OF_PREVIOUS_MONTH - firstDayOfWeek + 1; i <= LAST_DAY_OF_PREVIOUS_MONTH; i++) {
... | AST#method_declaration#Left static getPreviousMonthLastDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AS... | static getPreviousMonthLastDays(year: number, month: number, firstDayOfWeek: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_PREVIOUS_MONTH = TimeUtils.getLastDayOfMonth(year, month - 1);
for (let i = LAST_DAY_OF_PREVIOUS_MONTH - firstDayOfWeek + 1; i <= LAST_DAY_OF_PREVIOUS_MONTH; i++) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L55-L62 | f88606f2f4c2775a640e383a002f6caed57d2a86 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/special_expression/spread_operator_001_T.ets | arkts | Introduction 扩展运算符 | export function spread_operator_001_T(taint_src : string) {
let array1 = ['a', 'b', taint_src];
let array = ['c', ...array1];
taint.Sink(array[4]);
} | AST#export_declaration#Left export AST#function_declaration#Left function spread_operator_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_stateme... | export function spread_operator_001_T(taint_src : string) {
let array1 = ['a', 'b', taint_src];
let array = ['c', ...array1];
taint.Sink(array[4]);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/spread_operator_001_T.ets#L6-L10 | 23328e5112447ded3481e766590d090cffa17ee4 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment2.ets | arkts | isRenderSpecialImage | Default transparency isRenderSpecialImage function | private isRenderSpecialImage(): number {
// Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1.
this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange;
return this.opacityNum;
} | AST#method_declaration#Left private isRenderSpecialImage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Image transparency increases by 0.1 each time it is rendered, cycling betwe... | private isRenderSpecialImage(): number {
this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange;
return this.opacityNum;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment2.ets#L103-L107 | 49253a45bdf55641bf27394c86165b8039adeaf6 | gitee |
azhuge233/Wake-HarmonyOS.git | 68c4e961f9cf5fab8699af99313dd5854ea313a1 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | macValidate | 检查 MAC 合法性,分隔符仅支持 ':' 和 '-' | public macValidate(mac: string): Resource | string {
if (mac.length < StyleConstants.TEXT_INPUT_MAC_MAX_LENGTH) {
return $r("app.string.validate_mac_too_short");
}
const regex = /^(?:[0-9A-Fa-f]{2}([-:]))(?:[0-9A-Fa-f]{2}\1){4}[0-9A-Fa-f]{2}$/
if (!regex.test(mac)) {
... | AST#method_declaration#Left public macValidate AST#parameter_list#Left ( AST#parameter#Left mac : 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 Res... | public macValidate(mac: string): Resource | string {
if (mac.length < StyleConstants.TEXT_INPUT_MAC_MAX_LENGTH) {
return $r("app.string.validate_mac_too_short");
}
const regex = /^(?:[0-9A-Fa-f]{2}([-:]))(?:[0-9A-Fa-f]{2}\1){4}[0-9A-Fa-f]{2}$/
if (!regex.test(mac)) {
... | https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/common/utils/CommonUtils.ets#L56-L65 | be477d07df626c0dda4fa666ef068c5d007f396d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildSearchResults | 构建搜索结果 | @Builder
buildSearchResults() {
if (this.searchResult.total === 0) {
SearchEmptyView({ searchKeyword: this.searchKeyword })
} else {
List({ space: 16 }) {
// 联系人结果
if ((this.activeTab === 'all' || this.activeTab === 'contacts') && this.searchResult.contacts.length > 0) {
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expre... | @Builder
buildSearchResults() {
if (this.searchResult.total === 0) {
SearchEmptyView({ searchKeyword: this.searchKeyword })
} else {
List({ space: 16 }) {
if ((this.activeTab === 'all' || this.activeTab === 'contacts') && this.searchResult.contacts.length > 0) {
ListItem... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L407-L432 | cf9dcce2512b933c8ef44e475355a3c971f13899 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoHelper.ets | arkts | dataBlobToStr | DataBlob转字符串
@param dataBlob DataBlob
@param coding 编码方式(base64/hex/utf8/utf-8)。
@returns | static dataBlobToStr(dataBlob: cryptoFramework.DataBlob, coding: crypto.BhuCoding): string {
return CryptoHelper.uint8ArrayToStr(dataBlob.data, coding);
} | AST#method_declaration#Left static dataBlobToStr AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left co... | static dataBlobToStr(dataBlob: cryptoFramework.DataBlob, coding: crypto.BhuCoding): string {
return CryptoHelper.uint8ArrayToStr(dataBlob.data, coding);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L49-L51 | cd75210797cc9d3f0a3ed51caaa89d507e31f49a | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | resetStats | 重置统计数据 | async resetStats(): Promise<void> {
this.stats = this.getDefaultStats();
await StorageUtils.remove(this.STORAGE_KEY);
this.notifyListeners('statsReset', null);
} | AST#method_declaration#Left async resetStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async resetStats(): Promise<void> {
this.stats = this.getDefaultStats();
await StorageUtils.remove(this.STORAGE_KEY);
this.notifyListeners('statsReset', null);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L393-L397 | ce2708a323a925774ccfd4c882aaaf3179f15f33 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets | arkts | createWantAgentForCommonEvent | create wantAgent for common event
@param mAction
@return return the created WantAgent object. | async createWantAgentForCommonEvent(action: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{ action: action }],
operationType: ohosWantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: REQUEST_CODE // requestCode是WantAgentInfo的请求码,是使用者定义的一个私有值
}
return await wantAgent.g... | AST#method_declaration#Left async createWantAgentForCommonEvent AST#parameter_list#Left ( AST#parameter#Left action : 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#va... | async createWantAgentForCommonEvent(action: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{ action: action }],
operationType: ohosWantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: REQUEST_CODE
}
return await wantAgent.getWantAgent(wantAgentInfo);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets#L48-L55 | 03dc441d89d8584f3b87acba489f6ec840540cbd | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | 语音命令接口 | export interface VoiceCommand {
phrase: string;
action: InteractionAction;
targetModel?: string;
parameters?: Record<string, any>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VoiceCommand AST#object_type#Left { AST#type_member#Left phrase : 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 action : AST#type_annotation#L... | export interface VoiceCommand {
phrase: string;
action: InteractionAction;
targetModel?: string;
parameters?: Record<string, any>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L231-L236 | 878876eff1f65252583e51a869b700bcc29de06a | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/goods/GoodsGridItem.ets | arkts | 构建商品网格卡片
@returns {void} 无返回值 | build(): void {
Card({
heightValue: bp({ sm: 230, md: 250, lg: 270 }),
paddingValue: $r("app.float.space_padding_small"),
onTap: (): void => this.onItemClick(this.goods.id)
}) {
ColumnSpaceBetween({ heightValue: P100 }) {
NetWorkImage({
model: this.goods.mainPic,
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left heightValue ... | build(): void {
Card({
heightValue: bp({ sm: 230, md: 250, lg: 270 }),
paddingValue: $r("app.float.space_padding_small"),
onTap: (): void => this.onItemClick(this.goods.id)
}) {
ColumnSpaceBetween({ heightValue: P100 }) {
NetWorkImage({
model: this.goods.mainPic,
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/GoodsGridItem.ets#L39-L80 | 2f4fa7995407b3d32cfe5fd78fd6138ca67c3cc9 | github | |
linyu13/ArkTSCloudMusic.git | ff9455dfe900164b04a45244aebfb05bab4e8e8d | entry/src/main/ets/pages/Start.ets | arkts | StartBuilder | 跳转页面入口函数 | @Builder
export function StartBuilder() {
Start();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function StartBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left Start ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body... | @Builder
export function StartBuilder() {
Start();
} | https://github.com/linyu13/ArkTSCloudMusic.git/blob/ff9455dfe900164b04a45244aebfb05bab4e8e8d/entry/src/main/ets/pages/Start.ets#L2-L5 | 9fac83e4293cc32d68dee1b1fefc0e86758f8173 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | component with or height percent | export const enum STRING_PERCENT {
SLIDER_WITH = '56.7%',
NINETY_PERCENT = '90%',
INDEX_COMPONENT_WITH_PERCENT = '93.3%',
INDEX_SWIPER_HEIGHT_PERCENT = '24.1%',
INDEX_MODULE_HEIGHT_PERCENT = '25.8%',
INDEX_SWIPER_LEFT_RIGHT_MARGIN = '3.3%'
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum STRING_PERCENT AST#enum_body#Left { AST#enum_member#Left SLIDER_WITH = AST#expression#Left '56.7%' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NINETY_PERCENT = AST#expression#Left '90%' AST#expression#Right AST#enum_member#Rig... | export const enum STRING_PERCENT {
SLIDER_WITH = '56.7%',
NINETY_PERCENT = '90%',
INDEX_COMPONENT_WITH_PERCENT = '93.3%',
INDEX_SWIPER_HEIGHT_PERCENT = '24.1%',
INDEX_MODULE_HEIGHT_PERCENT = '25.8%',
INDEX_SWIPER_LEFT_RIGHT_MARGIN = '3.3%'
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L104-L111 | b8d57adad55ce325664ff185b48308e864b1827f | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/view/UserPrivacyDialog.ets | arkts | startSettingsAppInfoAbilityExplicit | The application information page is displayed. | startSettingsAppInfoAbilityExplicit(): void {
let context = getContext(this) as common.UIAbilityContext;
let want: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.AppInfoAbility',
action: 'action.settings.app.info',
parameters: {
settingsPa... | AST#method_declaration#Left startSettingsAppInfoAbilityExplicit AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declara... | startSettingsAppInfoAbilityExplicit(): void {
let context = getContext(this) as common.UIAbilityContext;
let want: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.AppInfoAbility',
action: 'action.settings.app.info',
parameters: {
settingsPa... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/view/UserPrivacyDialog.ets#L39-L53 | 15a1910e197888236a5dc8142a5b3d768d21f56d | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/util/PictureSavingUtil.ets | arkts | 打开系统相册选择一张图片并返回其 URI
@returns Promise<string> - 返回选中图片的 URI | export async function photoPickerGetUri(): Promise<string> {
try {
// 创建图片选择选项
let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
// 创建图片选择器实例
let photoPicke... | AST#export_declaration#Left export AST#function_declaration#Left async function photoPickerGetUri 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 string AST#primar... | export async function photoPickerGetUri(): Promise<string> {
try {
let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelp... | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/util/PictureSavingUtil.ets#L13-L38 | ce5926bce534248ec6de49cfe7e4434d88709972 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.TabTitleBar.d.ets | arkts | Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class TabTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicserv... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TabTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon resource for this ... | export declare class TabTitleBarMenuItem {
value: ResourceStr;
symbolStyle?: SymbolGlyphModifier;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
accessibilityLevel?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TabTitleBar.d.ets#L36-L127 | d46cdda6a553493d0a0c3acacf243f1a42262065 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuildChannel.ets | arkts | setup | 根据约束2,保持对象布局不变 | private setup(data: GuildChannelData): void {
this.id = data.id;
this.name = data.name;
// 根据约束1,避免any类型,假设Constants已正确定义类型
this.type = Constants.ChannelTypes.TEXT === data.type ? 'text' : 'voice';
} | AST#method_declaration#Left private setup AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left GuildChannelData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_... | private setup(data: GuildChannelData): void {
this.id = data.id;
this.name = data.name;
this.type = Constants.ChannelTypes.TEXT === data.type ? 'text' : 'voice';
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuildChannel.ets#L27-L33 | fd7daf80c968e852a2756b05de5aa1d9e9d23759 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets | arkts | wantParams:图片文件 | export class FileMessage extends MessageBody {
height: number | string
width: number | string
image: image.PixelMap
constructor | AST#export_declaration#Left export AST#ERROR#Left class FileMessage extends AST#type_annotation#Left AST#primary_type#Left MessageBody AST#primary_type#Right AST#type_annotation#Right { height : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left stri... | export class FileMessage extends MessageBody {
height: number | string
width: number | string
image: image.PixelMap
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets#L131-L136 | 949a798a1b9d3dab21664c522c756423b1105bcf | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets | arkts | deleteDataByIndex | 删除列表中处于index位置的对象 | public deleteDataByIndex(index: number): void {
Logger.info(TAG, `delete data , index = ${index}}`);
this.trendsList.splice(index, 1);
this.notifyDataDelete(index);
} | AST#method_declaration#Left public deleteDataByIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | public deleteDataByIndex(index: number): void {
Logger.info(TAG, `delete data , index = ${index}}`);
this.trendsList.splice(index, 1);
this.notifyDataDelete(index);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets#L59-L63 | 1fd87bb9fccfdce244fc800907566b53d9c8d469 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets | arkts | 视频组件数据 | export interface VideoCompData {
videoUrl: ResourceStr;
duration: number; // 视频时长
previewUri: ResourceStr | image.PixelMap, // 视频预览图
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VideoCompData AST#object_type#Left { AST#type_member#Left videoUrl : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left duration : AST#type_an... | export interface VideoCompData {
videoUrl: ResourceStr;
duration: number;
previewUri: ResourceStr | image.PixelMap,
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L25-L29 | 92d68085c9094d3233f7df14a45050640e10cb6c | gitee | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/VideoThumbnailExtractor.ets | arkts | getThumbnailFromUri | 从视频 URI 获取封面
@param videoUri 视频文件 URI
@param timeUs 提取时间点(微秒)
@returns Promise<image.PixelMap> | static async getThumbnailFromUri(videoUri: string, width: number, height: number,
timeUs: number = 0): Promise<image.PixelMap | null> {
try {
// 创建AVMetadataExtractor对象
const metadataExtractor = await media.createAVMetadataExtractor();
const headers: Record<string, string> = {
"User-Ag... | AST#method_declaration#Left static async getThumbnailFromUri AST#parameter_list#Left ( AST#parameter#Left videoUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left numb... | static async getThumbnailFromUri(videoUri: string, width: number, height: number,
timeUs: number = 0): Promise<image.PixelMap | null> {
try {
const metadataExtractor = await media.createAVMetadataExtractor();
const headers: Record<string, string> = {
"User-Agent": "Mozilla/5.0 (Harmon... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/VideoThumbnailExtractor.ets#L12-L45 | 9c687b7d740bd44025a2f23c1cf393de0d378c79 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/AudioCapturerManager.ets | arkts | createAudioCapturer | 静态异步方法,用于创建音频捕获器实例 | static async createAudioCapturer() {
if (AudioCaptureManager.audioCapturer) {
return AudioCaptureManager.audioCapturer
}
// 设置音频流信息配置
let audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, // 设置采样率为16kHz
channels: audio.AudioChannel.CHAN... | AST#method_declaration#Left static async createAudioCapturer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCaptureManager AST#expression#Right . audioCapturer AST#membe... | static async createAudioCapturer() {
if (AudioCaptureManager.audioCapturer) {
return AudioCaptureManager.audioCapturer
}
let audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioCapturerManager.ets#L25-L54 | 2b884c95e9264338fe2fd7d20279a8bb5d753320 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets | arkts | Destroy | [Start call_the_ondestroy_method] | Destroy() {
Logger.info('developTag', '%{public}s', 'vpn Destroy');
// 关闭VPN
this.vpnConnection.destroy().then(() => {
Logger.info('developTag', '%{public}s', 'vpn Destroy Success');
}).catch((err: Error) => {
Logger.error('developTag', 'vpn Destroy Failed: %{public}s', JSON.stringify(err) ?... | AST#method_declaration#Left Destroy 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 Logger AST#expression#Right . info AST#member_expression... | Destroy() {
Logger.info('developTag', '%{public}s', 'vpn Destroy');
this.vpnConnection.destroy().then(() => {
Logger.info('developTag', '%{public}s', 'vpn Destroy Success');
}).catch((err: Error) => {
Logger.error('developTag', 'vpn Destroy Failed: %{public}s', JSON.stringify(err) ?? '');
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets#L73-L81 | 48879d4edf55cb525fa3ccbb6bf997d443f82f20 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getOverdueTasks | 获取过期任务 | getOverdueTasks(): TaskItem[] {
const now = new Date();
return this.tasks.filter(task => {
return !task.completed && task.dueDate && task.dueDate < now;
});
} | AST#method_declaration#Left getOverdueTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | getOverdueTasks(): TaskItem[] {
const now = new Date();
return this.tasks.filter(task => {
return !task.completed && task.dueDate && task.dueDate < now;
});
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L470-L475 | 90959b1ab25660fe5db7e8a37d9a22584e9a62c9 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/GlobalThemeState.ets | arkts | addThemeChangeListener | 添加主题变化监听器 | addThemeChangeListener(listener: (version: number) => void): void {
this.listeners.push(listener);
} | AST#method_declaration#Left addThemeChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#par... | addThemeChangeListener(listener: (version: number) => void): void {
this.listeners.push(listener);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L27-L29 | 4f8dc876ef2097fd11fa7bfcc2fd324db1944dfd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets | arkts | itemHead | list上部的标题栏 | @Builder
itemHead(text: string) {
Column() {
Row() {
Text(text)
.fontSize($r('app.string.bottomdrawerslidecase_fontsize_15'))
.fontColor($r("app.color.bottomdrawerslidecase_list_header_text"))
}
.shadow({
radius: $r("app.integer.bottomdrawerslidecase_number_10... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemHead AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
itemHead(text: string) {
Column() {
Row() {
Text(text)
.fontSize($r('app.string.bottomdrawerslidecase_fontsize_15'))
.fontColor($r("app.color.bottomdrawerslidecase_list_header_text"))
}
.shadow({
radius: $r("app.integer.bottomdrawerslidecase_number_10... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets#L182-L213 | fb13820d89848f649da4251be8e265b4385cd63f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | 多行文本输入弹框Align | export enum TextAlignment { Top, Center, Bottom } | AST#export_declaration#Left export AST#enum_declaration#Left enum TextAlignment AST#enum_body#Left { AST#enum_member#Left Top AST#enum_member#Right , AST#enum_member#Left Center AST#enum_member#Right , AST#enum_member#Left Bottom AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declarat... | export enum TextAlignment { Top, Center, Bottom } | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L35-L35 | 53627d7084c29d8b8e9bd1a3a727494f3e42d8b7 | gitee | |
yiyefangzhou24/hmwechat | 27d11056003843c7e331e683478720d8efa49d17 | entry/src/main/ets/default/model/data/MessageData.ets | arkts | 消息类型
主要有:文本消息/图片消息/视频/语音 | export enum msgType{
//文本消息
Text ,
//图片消息
Pic ,
//语音消息
Sound ,
//视频消息
Video
} | AST#export_declaration#Left export AST#enum_declaration#Left enum msgType AST#enum_body#Left { //文本消息 AST#enum_member#Left Text AST#enum_member#Right , //图片消息 AST#enum_member#Left Pic AST#enum_member#Right , //语音消息 AST#enum_member#Left Sound AST#enum_member#Right , //视频消息 AST#enum_member#Left Video AST#enum_member#Righ... | export enum msgType{
Text ,
Pic ,
Sound ,
Video
} | https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/MessageData.ets#L20-L29 | 7a8621004f67088ccb799c160960c77537a2a67a | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | getSelectStr | 获取已选日期的年月日时分秒
@param containType 是否包含
@param type 1-年、2-月、3-日、4-时、5-分、6-秒。
@param selectDate 选中日期
@returns | static getSelectStr(containType: boolean, type: number, selectDate: Date): string {
let selectStr: string = '';
if (containType) {
if (type == 1) { //年
selectStr = `${selectDate.getFullYear()}年`;
} else if (type == 2) { //月
selectStr = `${DateHelper.padZero(selectDate.getMonth() + 1)... | AST#method_declaration#Left static getSelectStr AST#parameter_list#Left ( AST#parameter#Left containType : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | static getSelectStr(containType: boolean, type: number, selectDate: Date): string {
let selectStr: string = '';
if (containType) {
if (type == 1) {
selectStr = `${selectDate.getFullYear()}年`;
} else if (type == 2) {
selectStr = `${DateHelper.padZero(selectDate.getMonth() + 1)}月`;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L247-L265 | a4ccffb6645eb257bba9fd30be4befb03ae1ffea | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/TokenStoreRepository.ets | arkts | 构造函数
@param {TokenStoreDataSource} [dataSource] 可选自定义数据源 | constructor(dataSource?: TokenStoreDataSource) {
this.dataSource = dataSource ?? new TokenStoreDataSourceImpl();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource ? : AST#type_annotation#Left AST#primary_type#Left TokenStoreDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#e... | constructor(dataSource?: TokenStoreDataSource) {
this.dataSource = dataSource ?? new TokenStoreDataSourceImpl();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/TokenStoreRepository.ets#L17-L19 | 5a06e9cfd733d329faf4cf9c9711c68eccc0d307 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | on | Event registration and processing.
The event will not be destroyed after being processed.
@param { type } event Registered Events.
@param callback.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Event registration and processing.
The event will not be destroyed after being processed.
@param { type } event Re... | public on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void {
if (Array.isArray(type)) {
for (let i = 0, l = type.length; i < l; i++) {
this.on((type as TreeListenType[])[i], callback);
}
} else {
(this._events[type] || (this._events[type] = [])).push(callba... | AST#method_declaration#Left public on AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#... | public on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void {
if (Array.isArray(type)) {
for (let i = 0, l = type.length; i < l; i++) {
this.on((type as TreeListenType[])[i], callback);
}
} else {
(this._events[type] || (this._events[type] = [])).push(callba... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L804-L812 | bebf1397da869bd46b5a4d2fd45503089d9ad283 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/BinarySearch.ets | arkts | 二分查找算法实现 | export class BinarySearch {
/**
* 标准二分查找
* @param arr 已排序的数组
* @param target 目标值
* @returns 目标值在数组中的索引,如果不存在则返回-1
*/
public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
while (... | AST#export_declaration#Left export AST#class_declaration#Left class BinarySearch AST#class_body#Left { /**
* 标准二分查找
* @param arr 已排序的数组
* @param target 目标值
* @returns 目标值在数组中的索引,如果不存在则返回-1
*/ AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_anno... | export class BinarySearch {
public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
if (arr[mid] === target... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/BinarySearch.ets#L4-L153 | 8e1e48b8558dfacd4037e7daf280bcea100ee703 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets | arkts | PaintComponentComponent | 本示例介绍使用绘制组件中的Circle组件以及Path组件实现实时进度效果。该场景多用于手机电池电量、汽车油量、水位变化等动态变化中。
实现步骤:
1. 使用Circle组件绘制外层的圆环。
2. 绘制中间的进度的填充。中间的填充有两个状态:1、在进度100%时是填充颜色的圆形;2、在进度不足100%时,使用Path组件绘制闭合曲线实现。
3. 计算封闭曲线。水位线的端点的纵坐标y与进度k的关系为:y=(1-k)*2r,而圆心坐标为(r,r),以此确定水位线的坐标,然后拼接成绘制封闭曲线的commands。
4. 绘制最上层的百分比显示。
功能描述: 本示例介绍使用绘制组件中的Circle组件以及Path组件实现实时进度效果。该... | @Component
export struct PaintComponentComponent {
// 进度
@State progressNum: number = 0;
// 绘制封闭曲线的命令
@State pathCommands: string = '';
// 随着进度填充封闭曲线的颜色
@State colorBackgroundFill: string = Constants.COLOR_NORMAL;
// 背景颜色
@State bgColor: string = Constants.COLOR_TRANSPARENT;
// 进度是否在变化
isRunning: bo... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PaintComponentComponent AST#component_body#Left { // 进度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right progressNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | @Component
export struct PaintComponentComponent {
@State progressNum: number = 0;
@State pathCommands: string = '';
@State colorBackgroundFill: string = Constants.COLOR_NORMAL;
@State bgColor: string = Constants.COLOR_TRANSPARENT;
是否在变化
isRunning: boolean = false;
aboutToAppear(): void {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L42-L254 | fb35d86df5296d81ef133d7523d383e20d08a0ab | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/History.ets | arkts | delItem | 删 | delItem(keyword: string) {
this.getStore().deleteSync(keyword);
this.getStore().flushSync();
} | AST#method_declaration#Left delItem AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#L... | delItem(keyword: string) {
this.getStore().deleteSync(keyword);
this.getStore().flushSync();
} | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L29-L32 | b67ea604ebe9ed5e4d25c8605f5845a8d8425822 | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | getCurrentIndex | 获取当前卡片索引 | public getCurrentIndex(): number {
return this.currentIndex;
} | AST#method_declaration#Left public getCurrentIndex AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e... | public getCurrentIndex(): number {
return this.currentIndex;
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L86-L88 | 820c4985acc3bb33558ec2e3d0dfe7b48d32c3ca | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/example/dto/FileItem.ets | arkts | FileItem | 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... | @Observed
export class FileItem {
name: string = '';
type: FileType = FileType.UN_KNOWN;
icon: Resource = $r("app.media.encapsulation_dialog_png");
size: string = (Math.random() * 10).toFixed(1) + 'MB';
time: number = Date.now();
formattedDate: string = '';
isSelected: boolean = false;
constructor(name... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class FileItem AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; ... | @Observed
export class FileItem {
name: string = '';
type: FileType = FileType.UN_KNOWN;
icon: Resource = $r("app.media.encapsulation_dialog_png");
size: string = (Math.random() * 10).toFixed(1) + 'MB';
time: number = Date.now();
formattedDate: string = '';
isSelected: boolean = false;
constructor(name... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/example/dto/FileItem.ets#L16-L53 | 95802c29d9542f4fd7254d3266113756a970d978 | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/pages/VideoCoursePage.ets | arkts | formatTime | 格式化时间显示 | formatTime(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
} | AST#method_declaration#Left formatTime AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | formatTime(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/VideoCoursePage.ets#L83-L87 | e1d72441e547c1f88e7df4cf162adfa0ca4e1513 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/model/AttributeSet.ets | arkts | AttributeSet | 工具项属性集 | @Observed
export class AttributeSet {
// 动效参数属性集
private animation_?: CustomAnimation;
// 静态参数属性集
private params_?: CustomParams;
constructor(animation?: CustomAnimation, params?: CustomParams) {
this.animation_ = animation;
this.params_ = params;
}
get animation(): CustomAnimation | undefined ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class AttributeSet AST#class_body#Left { // 动效参数属性集 AST#property_declaration#Left private animation_ ? : AST#type_annotation#Left AST#primary_type#Left CustomAnimation AST#primary_type#Right AST#type_annotation#Right ; AST#pr... | @Observed
export class AttributeSet {
private animation_?: CustomAnimation;
private params_?: CustomParams;
constructor(animation?: CustomAnimation, params?: CustomParams) {
this.animation_ = animation;
this.params_ = params;
}
get animation(): CustomAnimation | undefined {
return this.an... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/AttributeSet.ets#L22-L46 | 03438c60693965e023c3953d6b1c6c6ad239c270 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageMovie.ets | arkts | PageMovie | Tab content of movie. | @Component
export struct PageMovie {
build() {
Scroll() {
Column() {
Banner()
MovieSort()
}
.width(CommonConstants.FULL_WIDTH)
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageMovie AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left {... | @Component
export struct PageMovie {
build() {
Scroll() {
Column() {
Banner()
MovieSort()
}
.width(CommonConstants.FULL_WIDTH)
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageMovie.ets#L23-L36 | 92b0a6398d8b5c513c824af6cfa2eaa73e265923 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/International/Internationalization/entry/src/main/ets/component/AssertEqual.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export function assertEqual<T>(actual: T, expected: T, description: Resource): string {
if (actual === expected) {
return `${getContext().resourceManager.getStringSync(description)}${expected} --passed`;
} else {
return `${getContext().resourceManager
.getStringSync(description)} --failed: expected ${... | AST#export_declaration#Left export AST#function_declaration#Left function assertEqual AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left actual : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AS... | export function assertEqual<T>(actual: T, expected: T, description: Resource): string {
if (actual === expected) {
return `${getContext().resourceManager.getStringSync(description)}${expected} --passed`;
} else {
return `${getContext().resourceManager
.getStringSync(description)} --failed: expected ${... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/International/Internationalization/entry/src/main/ets/component/AssertEqual.ets#L16-L23 | 7dc6c97725edb75a4061822fb32b085cba3557f6 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 删除梦想
@param id 梦想ID
@returns 删除结果,通常为空对象或状态码 | export function deleteDream(id: number): Promise<void> {
console.info(`开始删除梦想, ID: ${id}`);
try {
return request<void>(RequestMethod.DELETE, `/dreams/${id}`);
} catch (error) {
const errorMsg = `删除梦想失败: ${error instanceof Error ? error.message : String(error)}`;
console.error(errorMsg);
console.er... | AST#export_declaration#Left export AST#function_declaration#Left function deleteDream AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri... | export function deleteDream(id: number): Promise<void> {
console.info(`开始删除梦想, ID: ${id}`);
try {
return request<void>(RequestMethod.DELETE, `/dreams/${id}`);
} catch (error) {
const errorMsg = `删除梦想失败: ${error instanceof Error ? error.message : String(error)}`;
console.error(errorMsg);
console.er... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1151-L1161 | 0ae992e41b581af3a904c50e77acd3defb0dd773 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/LoginPage.ets | arkts | buildThirdPartySection | 构建第三方登录区域
@returns {void} 无返回值 | @Builder
private buildThirdPartySection(): void {
Text($r("app.string.other_login_methods"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
SpaceVerticalXLarge();
RowSpaceEvenlyCenter({ widthValue: P100 }) {
// 第三方登录按钮
this.buildThirdPartyLoginB... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildThirdPartySection 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#arkts_ui_element#Le... | @Builder
private buildThirdPartySection(): void {
Text($r("app.string.other_login_methods"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
SpaceVerticalXLarge();
RowSpaceEvenlyCenter({ widthValue: P100 }) {
this.buildThirdPartyLoginButton($r("... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L120-L144 | abc7332dbb6723c9af7eadb954f7cb37fcc55503 | github |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | setValueRange | 设置最大时间 | setValueRange(min: number, max: number) {
if (min > max) {
this.getInstance().setRange(max, min)
return
}
this.getInstance().setRange(min, max)
} | AST#method_declaration#Left setValueRange AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ... | setValueRange(min: number, max: number) {
if (min > max) {
this.getInstance().setRange(max, min)
return
}
this.getInstance().setRange(min, max)
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L400-L406 | 46bcb21118a727dbe7a3e3d86854109dd6df0e52 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PhotoBrowserUIElement. include CHECKBOX and BACK_BUTTON
@enum { number } PhotoBrowserUIElement
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13 | export declare enum PhotoBrowserUIElement {
/**
* CHECKBOX. checkbox
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/
CHECKBOX = 0,
/**
* BACK_BUTTON. back button
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoBrowserUIElement AST#enum_body#Left { /**
* CHECKBOX. checkbox
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/ AST#enum_member#Left CHECKBOX ... | export declare enum PhotoBrowserUIElement {
CHECKBOX = 0,
BACK_BUTTON = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L1140-L1158 | 053522bbb013c21ece788c277d1ba712916ba063 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/data_operation_tools.ets | arkts | Types & conversions
Converts a boolean to string.
@param bool A boolean.
@returns A string form of the boolean: 'true' | 'false'. | export function boolean_to_string(bool: boolean) {
return bool ? 'true' : 'false';
} | AST#export_declaration#Left export AST#function_declaration#Left function boolean_to_string AST#parameter_list#Left ( AST#parameter#Left bool : 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#block_statement#Left ... | export function boolean_to_string(bool: boolean) {
return bool ? 'true' : 'false';
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L234-L236 | 7e94130f55bc9e46b6ba2e9f6e2f9cfd4c3bdd70 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | getBarBounds | The passed outputRect will be assigned the values of the bounding box of the specified Entry in the specified DataSet.
The rect will be assigned Float.MIN_VALUE in all locations if the Entry could not be found in the charts data.
@param e
@return | public getBarBounds(e: BarEntry, outputRect: MyRect): void {
if (!this.mData) {
return;
}
let bounds: MyRect = outputRect;
let set: IBarDataSet | null = this.mData.getDataSetForEntry(e);
if (!set) {
bounds.set(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
... | AST#method_declaration#Left public getBarBounds AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputRect : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primar... | public getBarBounds(e: BarEntry, outputRect: MyRect): void {
if (!this.mData) {
return;
}
let bounds: MyRect = outputRect;
let set: IBarDataSet | null = this.mData.getDataSetForEntry(e);
if (!set) {
bounds.set(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L167-L196 | 8195a442fea8eeb9920036b7f269cff1e563947a | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets | arkts | EmptyCart | 空购物车 | @Builder
EmptyCart() {
Column({ space: AppDimensions.spaceLarge }) {
Text('🛒')
.fontSize(80)
.opacity(0.3)
Text('购物车是空的')
.fontSize(AppTypography.fontSizeLarge)
.fontColor(AppColors.textSecondary)
Text('快去添加商品吧')
.fontSize(AppTypography.fontSizeMedium)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right EmptyCart 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_parameter... | @Builder
EmptyCart() {
Column({ space: AppDimensions.spaceLarge }) {
Text('🛒')
.fontSize(80)
.opacity(0.3)
Text('购物车是空的')
.fontSize(AppTypography.fontSizeLarge)
.fontColor(AppColors.textSecondary)
Text('快去添加商品吧')
.fontSize(AppTypography.fontSizeMedium)
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L69-L87 | 747a1a39d786469e1ef3607c4da71d2a4aa74a5c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/constants/AppConstants.ets | arkts | 正则表达式常量(兼容性) | export class RegexConstants {
static readonly EMAIL: string = '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$';
static readonly EMAIL_REGEX: string = '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$';
static readonly PHONE: string = '^1[3-9]\\d{9}$';
static readonly PHONE_REGEX: string = '^1[3-9]\\d{9}$';
static readonly NAME: string = '^[\\... | AST#export_declaration#Left export AST#class_declaration#Left class RegexConstants AST#class_body#Left { AST#property_declaration#Left static readonly EMAIL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$' AST... | export class RegexConstants {
static readonly EMAIL: string = '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$';
static readonly EMAIL_REGEX: string = '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$';
static readonly PHONE: string = '^1[3-9]\\d{9}$';
static readonly PHONE_REGEX: string = '^1[3-9]\\d{9}$';
static readonly NAME: string = '^[\\... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L162-L175 | d96cb53f7afc34b9ad3418c99e7695d011a641e7 | github | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/MessageApi.type.ets | arkts | 用户消息详情 | export interface UserMessageInfo extends BaseTime {
/**
* 用户消息id
*/
id: number
/**
* 是否查看 '0'未查看 '1'查看
*/
isLook: string
/**
* 消息id
*/
messageId?: number
/**
* 消息标题
*/
title: string
/**
* 消息内容
*/
content: string
/**
* 消息类型'1' 系统消息 '2' 通知公告
*/
type?: string
/... | AST#export_declaration#Left export AST#interface_declaration#Left interface UserMessageInfo AST#extends_clause#Left extends BaseTime AST#extends_clause#Right AST#object_type#Left { /**
* 用户消息id
*/ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annot... | export interface UserMessageInfo extends BaseTime {
id: number
isLook: string
messageId?: number
title: string
content: string
type?: string
time: string
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/MessageApi.type.ets#L78-L108 | c0dee8507644764fd3dc3219069be05d2aafdc48 | gitee | |
zeroone001/harmonyAPP.git | 49c8fa1b56de89cb7513b25f3b1b753ba857968a | features/quickstart/src/main/ets/view/Header.ets | arkts | Header | import { Speaker } from '@ohos/utils'; import { Speaker } from '../../../../../../commons/utils'; | @Component
export struct Header {
@State message: string = '快速入门';
@State isPlaying: boolean = false;
speaker: Speaker = new Speaker();
content: string = '邀请你开启鸿蒙体验之旅 欢迎来到HarmonyOS世界';
aboutToAppear(): void {
emitter.on('eventId', () => {
this.isPlaying = false;
});
}
build() {
Row() {... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Header AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#... | @Component
export struct Header {
@State message: string = '快速入门';
@State isPlaying: boolean = false;
speaker: Speaker = new Speaker();
content: string = '邀请你开启鸿蒙体验之旅 欢迎来到HarmonyOS世界';
aboutToAppear(): void {
emitter.on('eventId', () => {
this.isPlaying = false;
});
}
build() {
Row() {... | https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/features/quickstart/src/main/ets/view/Header.ets#L5-L50 | a24ca67d932c61a063ac7ab795c1a779e38f04eb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets | arkts | setOffCallback | 移除播放状态机AVPlayerState切换的事件监听和播放时间监听
@returns | setOffCallback(): void {
if (this.avPlayer) {
this.avPlayer?.off('timeUpdate');
this.avPlayer?.off('stateChange');
}
} | AST#method_declaration#Left setOffCallback 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex... | setOffCallback(): void {
if (this.avPlayer) {
this.avPlayer?.off('timeUpdate');
this.avPlayer?.off('stateChange');
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets#L132-L137 | 0de8cfcf527f107e415ad6fc1b30c658436c1284 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | setUseAutoScaleMaxRestriction | Sets autoscale restriction for axis max value as enabled/disabled
@Deprecated | public setUseAutoScaleMaxRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMax = isEnabled;
} | AST#method_declaration#Left public setUseAutoScaleMaxRestriction AST#parameter_list#Left ( AST#parameter#Left isEnabled : 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#Lef... | public setUseAutoScaleMaxRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMax = isEnabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L487-L489 | fd6289ebf83bd6ef4ac129afd61137b6f271ea21 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/AuthorizedButton.ets | arkts | AuthorizedButton | 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... | @Component
export struct AuthorizedButton {
private title: Resource = $r('app.string.EntryAbility_label');
@Link image: Resource;
@Link backColor: Resource;
@Link textColor: Resource;
build() {
Row() {
Image(this.image)
.width(24)
.height(24)
.objectFit(ImageFit.Contain)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AuthorizedButton AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left A... | @Component
export struct AuthorizedButton {
private title: Resource = $r('app.string.EntryAbility_label');
@Link image: Resource;
@Link backColor: Resource;
@Link textColor: Resource;
build() {
Row() {
Image(this.image)
.width(24)
.height(24)
.objectFit(ImageFit.Contain)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/AuthorizedButton.ets#L16-L42 | 6f8fe43a0ad94d1729da63f5404515f198ecd6b7 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 验证规则接口 | export interface NameValidationRule {
required: boolean;
minLength: number;
maxLength: number;
pattern?: RegExp;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NameValidationRule AST#object_type#Left { AST#type_member#Left required : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left minLength : AST#type_... | export interface NameValidationRule {
required: boolean;
minLength: number;
maxLength: number;
pattern?: RegExp;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L45-L50 | c9701e91bfcece76f3b778b87e6c2ec7effe9adc | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.