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/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setAxisMaxLabels
The maximum number of labels on the axis
public setAxisMaxLabels(labels: number): void { if (labels > 0) { this.mAxisMaxLabels = labels; } }
AST#method_declaration#Left public setAxisMaxLabels AST#parameter_list#Left ( AST#parameter#Left labels : 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 setAxisMaxLabels(labels: number): void { if (labels > 0) { this.mAxisMaxLabels = labels; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L184-L188
2c481ae1ab3a82cdbf88e1dc7a901bde2c1817e0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
getConversationHistory
获取对话历史
getConversationHistory(sessionId?: string): ChatMessage[] { const currentSessionId = sessionId || this.currentSessionId; const context = this.conversations.get(currentSessionId); return context ? context.history : []; }
AST#method_declaration#Left getConversationHistory AST#parameter_list#Left ( AST#parameter#Left sessionId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_t...
getConversationHistory(sessionId?: string): ChatMessage[] { const currentSessionId = sessionId || this.currentSessionId; const context = this.conversations.get(currentSessionId); return context ? context.history : []; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L430-L434
856b33e1a76c80579c6265a821d268609f9b4315
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbUtils.ets
arkts
getDb
创建或获取一个数据库连接工具
getDb(): Promise<RdbHelper> { return new Promise<RdbHelper>((success, error) => { let dbName = mDatabaseName; if (!dbContext || !dbName || dbName.length === 0) { // 检查上下文和数据库名是否为空 error("init err"); return; } let dbHelper = this.rdbHelpers.get(dbName); // 获取一个操作数据库的工具类 ...
AST#method_declaration#Left getDb 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 RdbHelper AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#R...
getDb(): Promise<RdbHelper> { return new Promise<RdbHelper>((success, error) => { let dbName = mDatabaseName; if (!dbContext || !dbName || dbName.length === 0) { error("init err"); return; } let dbHelper = this.rdbHelpers.get(dbName); if (!dbHelper) { let rdb...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L19-L39
f8a85c942bf69495be56df2a9e6a4893bc0e5825
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/components/MyTitleBar.ets
arkts
MyTitleBar
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 MyTitleBar { build() { Row() { Text($r('app.string.library_title')) .id('library') .fontFamily('HarmonyHeiTi') .fontWeight(FontWeight.Bold) .fontSize(32) .fontWeight(700) .fontColor($r('app.color.text_color')) } .width('100%') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyTitleBar 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 Row ( ) AST#container_content_body#Left { A...
@Component export struct MyTitleBar { build() { Row() { Text($r('app.string.library_title')) .id('library') .fontFamily('HarmonyHeiTi') .fontWeight(FontWeight.Bold) .fontSize(32) .fontWeight(700) .fontColor($r('app.color.text_color')) } .width('100%') ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/components/MyTitleBar.ets#L16-L30
a627e87badc5de351586e7d7c65c0c2a7d50ce2c
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/references_object/field_len_001_T.ets
arkts
Introduction 路径长度
export function field_len_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.b.c.data) }
AST#export_declaration#Left export AST#function_declaration#Left function field_len_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Lef...
export function field_len_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.b.c.data) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/references_object/field_len_001_T.ets#L7-L10
a5e722b9c8127ed48d1dc0b53757a34af065ad05
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
onFormEvent
响应卡片的message 事件
onFormEvent(formId: string, message: string) { //设置新数据 const newData: Record<string, string> = { 'poemContent': dxinPoetryUtil.getRandomPoem() }; const formData = formBindingData.createFormBindingData(newData) formProvider.updateForm(formId, formData) }
AST#method_declaration#Left onFormEvent AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
onFormEvent(formId: string, message: string) { const newData: Record<string, string> = { 'poemContent': dxinPoetryUtil.getRandomPoem() }; const formData = formBindingData.createFormBindingData(newData) formProvider.updateForm(formId, formData) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/entryformability/EntryFormAbility.ets#L25-L32
0862657e1c019f6523149f0ccc5cea9ce28a78c7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
sharePost
分享帖子
async sharePost(postId: string, platform?: string): Promise<boolean> { try { if (!this.currentUser) return false; // TODO: 实现分享逻辑 hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Post shared: ${postId}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP...
AST#method_declaration#Left async sharePost AST#parameter_list#Left ( AST#parameter#Left postId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left platform ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
async sharePost(postId: string, platform?: string): Promise<boolean> { try { if (!this.currentUser) return false; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Post shared: ${postId}`); return true; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants....
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L430-L442
3d49e10d041209ab570674f164f0f90f8acdbcc4
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CommonRepository.ets
arkts
@file 公共基础仓库 @author Joker.X
export class CommonRepository { /** * 通用网络数据源 */ private networkDataSource: CommonNetworkDataSource; /** * 构造函数 * @param networkDataSource 可选的数据源实例,便于单元测试注入 */ constructor(networkDataSource?: CommonNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CommonNetworkDataSource...
AST#export_declaration#Left export AST#class_declaration#Left class CommonRepository AST#class_body#Left { /** * 通用网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left CommonNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#proper...
export class CommonRepository { private networkDataSource: CommonNetworkDataSource; constructor(networkDataSource?: CommonNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CommonNetworkDataSourceImpl(); } async getParam(key: string): Promise<NetworkResponse<string>> { ret...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CommonRepository.ets#L8-L47
a89c402f66be3c894ddbef024558bca2ef9b3834
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/address/AddressCard.ets
arkts
buildEmptyContent
构建空地址状态内容 @returns {void} 无返回值
@Builder private buildEmptyContent(): void { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { Text($r("app.string.address_not_selected")) .fontSize($r("app.float.headline_large")) .fontColor($r("app.color.text_primary")) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildEmptyContent 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#Left AS...
@Builder private buildEmptyContent(): void { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { Text($r("app.string.address_not_selected")) .fontSize($r("app.float.headline_large")) .fontColor($r("app.color.text_primary")) ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressCard.ets#L165-L197
590165e851506bfef72c83b94ccdfa503f1a2dc4
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationManagementUtil.ets
arkts
addNotification
添加一条消息
async addNotification(notification: notification.NotificationRequest) { const typeId = notification.content.contentType; if(typeId !== undefined ) { this.typeNotifications[typeId].push(notification); this.countsByType[typeId] += 1; this.badgeNum += 1; await notificationManagement.setBadg...
AST#method_declaration#Left async addNotification AST#parameter_list#Left ( AST#parameter#Left notification : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para...
async addNotification(notification: notification.NotificationRequest) { const typeId = notification.content.contentType; if(typeId !== undefined ) { this.typeNotifications[typeId].push(notification); this.countsByType[typeId] += 1; this.badgeNum += 1; await notificationManagement.setBadg...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationManagementUtil.ets#L85-L94
aa463ff9d27ea8aa31d6d6a28edc4d580196e4fd
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/viewModel/TimeBarModel.ets
arkts
clampToBounds
Clamp a time value to the valid bounds (prevent exceeding timeRange). @param time Time to clamp (milliseconds). @returns The clamped time.
private clampToBounds(time: number): number { if (this._minTime !== Number.MIN_SAFE_INTEGER && time < this._minTime) { return this._minTime; } if (this._maxTime !== Number.MAX_SAFE_INTEGER && time > this._maxTime) { return this._maxTime; } return time; }
AST#method_declaration#Left private clampToBounds AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
private clampToBounds(time: number): number { if (this._minTime !== Number.MIN_SAFE_INTEGER && time < this._minTime) { return this._minTime; } if (this._maxTime !== Number.MAX_SAFE_INTEGER && time > this._maxTime) { return this._maxTime; } return time; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L142-L150
24453521a007664869facf60a0066fd88d40da52
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
getActualPayment
获取实付金额 @returns {number} 实付金额
private getActualPayment(order: Order): number { return order.price - order.discountPrice; }
AST#method_declaration#Left private getActualPayment AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
private getActualPayment(order: Order): number { return order.price - order.discountPrice; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L448-L450
648c36304f4ccfa2ab6480a6de8ac3bf2aac58cc
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getFileExtention
根据文件名获取文件后缀 @param fileName 例如: test.txt test.doc @returns
static getFileExtention(fileName: string) { if (StrUtil.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : 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#if_statement...
static getFileExtention(fileName: string) { if (StrUtil.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L243-L248
6b281930b4a89ace99292768f680c86e4b643267
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets
arkts
TabView
tab样式页面
@Builder TabView() { Row() { ForEach(this.TabsInfo, (item: string, index: number) => { this.TabItem(item, index); }) Blank() .width($r('app.string.pip_window_tab_view_blank_width')) TextInput({ placeholder: $r('app.string.pip_window_tab_view_text') }) .focusable(fal...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left...
@Builder TabView() { Row() { ForEach(this.TabsInfo, (item: string, index: number) => { this.TabItem(item, index); }) Blank() .width($r('app.string.pip_window_tab_view_blank_width')) TextInput({ placeholder: $r('app.string.pip_window_tab_view_text') }) .focusable(fal...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets#L65-L105
878d4f92d41e3af701baeb3688256c45e756c95b
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets
arkts
getContent
加载文件内容
getContent(filePath: string): ArrayBuffer | undefined { let content: ArrayBuffer | undefined = undefined try { let buf = new ArrayBuffer(1024 * 64); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); content = buf.slice(0, rea...
AST#method_declaration#Left getContent AST#parameter_list#Left ( AST#parameter#Left filePath : 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 ArrayB...
getContent(filePath: string): ArrayBuffer | undefined { let content: ArrayBuffer | undefined = undefined try { let buf = new ArrayBuffer(1024 * 64); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); content = buf.slice(0, rea...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets#L184-L196
fb931111073e6737c9f8b1eb20bf39bbf91ae3d0
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index.ets
arkts
log_head_worker
The head of logging information for workers. @returns "[Meow][bunch_of_history_index]"
static log_head_worker() { return '[Meow][bunch_of_history_index][Worker]'; }
AST#method_declaration#Left static log_head_worker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '[Meow][bunch_of_history_index][Worker]' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#...
static log_head_worker() { return '[Meow][bunch_of_history_index][Worker]'; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L228-L230
c8f57e7d9020a1a10b46aa74f9b66f4909a96288
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/UserProfile.ets
arkts
setup
应用约束:45. 显式标注返回类型
setup(data: UserProfileData): void { this.premium = data.premium; this.premiumSince = data.premium_since ? new Date(data.premium_since) : null; // 应用约束:21. 使用点操作符访问属性 for (const guild of data.mutual_guilds) { if (this.client.guilds.has(guild.id)) { this.mutua...
AST#method_declaration#Left setup AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left UserProfileData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
setup(data: UserProfileData): void { this.premium = data.premium; this.premiumSince = data.premium_since ? new Date(data.premium_since) : null; for (const guild of data.mutual_guilds) { if (this.client.guilds.has(guild.id)) { this.mutualGuilds.set(guild.id, ...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/UserProfile.ets#L39-L54
5db4bf7bb37aa61c9c520434b4b0a36dc1ff74ed
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets
arkts
getHighlightsAtXValue
Returns a list of Highlight objects representing the entries closest to the given xVal. The returned list contains two objects per DataSet (closest rounding up, closest rounding down). @param xVal the transformed x-value of the x-touch position @param x touch position @param y touch position @return
protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> { this.mHighlightBuffer.clear(); let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getData(); if (data == null) { return this.mHighlightBuffer; ...
AST#method_declaration#Left protected getHighlightsAtXValue AST#parameter_list#Left ( AST#parameter#Left xVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> { this.mHighlightBuffer.clear(); let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getData(); if (data == null) { return this.mHighlightBuffer; ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets#L137-L158
0be34f46efcbd9cc3c8cd39430a70ec4eefe89f1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/empty/EmptyError.ets
arkts
EmptyError
@file 错误缺省页 @author Joker.X
@ComponentV2 export struct EmptyError { /** * 描述文案 */ @Param description: ResourceStr = "出错了"; /** * 操作按钮文案(仅当 onAction 存在时展示) */ @Param actionText: ResourceStr = "重试"; /** * 操作按钮点击回调(不传则不展示按钮) */ @Param onAction: (() => void) | undefined = undefined; /** * 构建错误缺省页视图 * @re...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyError AST#component_body#Left { /** * 描述文案 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#prim...
@ComponentV2 export struct EmptyError { @Param description: ResourceStr = "出错了"; @Param actionText: ResourceStr = "重试"; @Param onAction: (() => void) | undefined = undefined; build(): void { Empty({ description: this.description, imageRes: $r("app.media.ic_empty_page"), ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyError.ets#L7-L39
3154c11b4d9ff27ec9cb28e7176a2e3bf41e33c8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/myHar/Index.ets
arkts
[Start const_dynamic_import_har]
export function add(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am a HAR, %d + %d = %d', a, b, c); return c; }
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am a HAR, %d + %d = %d', a, b, c); return c; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/myHar/Index.ets#L19-L23
50cf8cb0d86edabccd4ca8dae512dfc918379088
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Extend/Extend0010.ets
arkts
pictureRendering
001 测试:Extend样式组合复用
@Extend(Text) function pictureRendering(weightValue: number, color: Color) { .fontStyle(FontStyle.Italic) .fontWeight(weightValue) .backgroundColor(color) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function pictureRendering AST#parameter_list#Left ( AST#parameter#Left weightValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#...
@Extend(Text) function pictureRendering(weightValue: number, color: Color) { .fontStyle(FontStyle.Italic) .fontWeight(weightValue) .backgroundColor(color) }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Extend/Extend0010.ets#L17-L22
414304d2f3acb739fc3b69f9031b795e91d09dd0
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/textInput/TextEditNodeController.ets
arkts
undo
撤销操作,从栈顶撤销操作记录
undo(): void { Logger.i(MODULE, TAG, 'undo size:' + this.textRecords.length + ',rootNode lastIndex=' + this.rootNode?.getLastChildIndexWithoutExpand()); if (this.rootNode && this.textRecords.length > 0) { let record = this.textRecords.pop(); if (record) { this.removeChild(this.rootNode.g...
AST#method_declaration#Left undo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST...
undo(): void { Logger.i(MODULE, TAG, 'undo size:' + this.textRecords.length + ',rootNode lastIndex=' + this.rootNode?.getLastChildIndexWithoutExpand()); if (this.rootNode && this.textRecords.length > 0) { let record = this.textRecords.pop(); if (record) { this.removeChild(this.rootNode.g...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L196-L205
50e8c4dcc9b71fdb0d9e69e3211d3bb604472eed
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
filterNonEmpty
过滤非空消息 @param messages 消息数组 @returns 只包含非空消息的数组 使用示例: ```typescript const people = [person1, emptyPerson, person3] const nonEmptyPeople = MessageUtils.filterNonEmpty(people) // nonEmptyPeople: [person1, person3] ```
static filterNonEmpty<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isEmpty()) }
AST#method_declaration#Left static filterNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left message...
static filterNonEmpty<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isEmpty()) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L160-L162
273648fbe47e003fcf1f4df484c3d8fca2b91f94
github
hackeris/HiSH
6485c7b24ee47727fe464dc3a69484f44689e85b
entry/src/main/ets/lib/QemuAgentManager.ets
arkts
导出单例
export const QemuAgentManager = QemuAgentManagerImpl.getInstance()
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left QemuAgentManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left QemuAgentManagerImpl AST#expression#Right . getInstance AST#member_expression#Right AST#e...
export const QemuAgentManager = QemuAgentManagerImpl.getInstance()
https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/lib/QemuAgentManager.ets#L342-L342
bd9b0728d9f0b20d7de1d8ea4e2bb95db4087f27
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
watermark
添加水印(右下角) 注意:overlay 滤镜需要软解码,硬编码输出
public static watermark(input: string, watermarkImg: string, output: string): string[] { return [ 'ffmpeg', '-i', input, '-i', watermarkImg, '-filter_complex', '[0:v][1:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10[outv]', '-map', '[outv]', '-map', '0:a', '-c:v', FFmpeg...
AST#method_declaration#Left public static watermark AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left watermarkImg : AST#type_annotation#Left AST#primary_type#Left string AS...
public static watermark(input: string, watermarkImg: string, output: string): string[] { return [ 'ffmpeg', '-i', input, '-i', watermarkImg, '-filter_complex', '[0:v][1:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10[outv]', '-map', '[outv]', '-map', '0:a', '-c:v', FFmpeg...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L139-L151
dfb12e5559de607de4627d9da9c196bcbbca67ab
github
buqiuz/game-puzzle.git
605dc0fac0738466db308a8ba255b5e9094c52ac
entry/src/main/ets/View/ButtonComponent.ets
arkts
clearInterval
this.gameTime = 300;
clearInterval(this.timer);
AST#method_declaration#Left clearInterval AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . timer AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
clearInterval(this.timer);
https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/View/ButtonComponent.ets#L68-L68
b31b73db7621398b924409c13629d8d9dc6c1063
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
resetToDefaults
重置为默认配置
async resetToDefaults(): Promise<boolean> { try { this.configs = []; // 添加默认的OpenAI配置模板 const defaultConfig: LLMConfig = { url: 'https://api.openai.com/v1/chat/completions', modelName: 'gpt-3.5-turbo', apiKey: '', provider: 'openai', isDefault: true, ...
AST#method_declaration#Left async resetToDefaults AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#ty...
async resetToDefaults(): Promise<boolean> { try { this.configs = []; const defaultConfig: LLMConfig = { url: 'https://api.openai.com/v1/chat/completions', modelName: 'gpt-3.5-turbo', apiKey: '', provider: 'openai', isDefault: true, createTime: new ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L735-L758
51531abfecacd66f1670f585f0a6d0b26e7f252b
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets
arkts
onValidDefinitions
当前房间支持的清晰度列表 @param definitions 支持的清晰度列表
onValidDefinitions(definitions: VHPlayDefinition[]) { let hasDef: boolean = false; this.definitions_list = []; this.playDefinitionList = []; definitions.forEach((item) => { //是否隐藏原画 if (item == VHPlayDefinition.VH_ORIGIN && this.configList.live_hidden_same == 1) { return; } ...
AST#method_declaration#Left onValidDefinitions AST#parameter_list#Left ( AST#parameter#Left definitions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VHPlayDefinition [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block...
onValidDefinitions(definitions: VHPlayDefinition[]) { let hasDef: boolean = false; this.definitions_list = []; this.playDefinitionList = []; definitions.forEach((item) => { if (item == VHPlayDefinition.VH_ORIGIN && this.configList.live_hidden_same == 1) { return; } this....
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets#L235-L260
5c4f20dd7a61913f6ec3649184c878465f8f90b1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
removeFromFavorites
从收藏夹移除
async removeFromFavorites(favoriteId: string): Promise<boolean> { const index = this.favorites.findIndex(f => f.id === favoriteId); if (index === -1) { return false; } const removed = this.favorites.splice(index, 1)[0]; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConsta...
AST#method_declaration#Left async removeFromFavorites AST#parameter_list#Left ( AST#parameter#Left favoriteId : 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#gener...
async removeFromFavorites(favoriteId: string): Promise<boolean> { const index = this.favorites.findIndex(f => f.id === favoriteId); if (index === -1) { return false; } const removed = this.favorites.splice(index, 1)[0]; await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConsta...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L72-L83
d234f6e00da7fa6f32fb12ff025838b9864d0d51
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
arkts
clearCacheAndRestartAppEasy
清除应用缓存,并重启APP。
clearCacheAndRestartAppEasy(){ this.clearAppCacheEasy(); this.clearWebCacheEasy(); DialogUtils.showPrimaryDialog({ primaryButton: $r('app.string.harmony_web_btn_cancel'), secondaryButton: $r('app.string.harmony_web_btn_ok'), message: $r('app.string.harmony_web_dialog_tip1'), backCanc...
AST#method_declaration#Left clearCacheAndRestartAppEasy 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 this AST#expression#Right . clearApp...
clearCacheAndRestartAppEasy(){ this.clearAppCacheEasy(); this.clearWebCacheEasy(); DialogUtils.showPrimaryDialog({ primaryButton: $r('app.string.harmony_web_btn_cancel'), secondaryButton: $r('app.string.harmony_web_btn_ok'), message: $r('app.string.harmony_web_dialog_tip1'), backCanc...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L158-L177
f29f84a00bff377af5e8eb6a62d8855295a0741c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets
arkts
decompressFileByWorker
性能:使用Worker子线程解压文件,https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/multi_thread_capability.md/
decompressFileByWorker(rawfileZipName: string): void { /** * TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。 * TODO:知识点:@标识路径加载形式:所有种类的模块加载本地HAR中的Worker线程文件,加载路径规则:@{moduleName}/ets/{relativePath}。 */ let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../workers/Worker.ets'); ...
AST#method_declaration#Left decompressFileByWorker AST#parameter_list#Left ( AST#parameter#Left rawfileZipName : 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...
decompressFileByWorker(rawfileZipName: string): void { let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../workers/Worker.ets'); workerInstance.onmessage = (e: MessageEvents): void => { if (e.data) { promptAction.showToast({ message: $r('app.string.decompress_...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets#L58-L85
43a1476a4ed46640a35d75f74fb7adf94b68a4c0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/menuitems/src/main/ets/components/MainItem.ets
arkts
MainItem
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 MainItem { private title: string | Resource = ''; @LocalStorageProp('isSplitMode') isSplitMode: boolean = false; @State isTouched: boolean = false; build() { Row() { Text(this.title) .fontSize(20) .lineHeight(22) .fontWeight(FontWeight.Medium) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainItem AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#pr...
@Component export struct MainItem { private title: string | Resource = ''; @LocalStorageProp('isSplitMode') isSplitMode: boolean = false; @State isTouched: boolean = false; build() { Row() { Text(this.title) .fontSize(20) .lineHeight(22) .fontWeight(FontWeight.Medium) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/menuitems/src/main/ets/components/MainItem.ets#L16-L52
482194da81ffb91e2e621cde17aadd35f09f7016
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
parseTime
解析时间字符串为Date对象 @param timeString 时间字符串 (如: "14:30") @param baseDate 基准日期,默认为今天 @returns Date对象
static parseTime(timeString: string, baseDate: Date = new Date()): Date { const timeParts = timeString.split(':').map(Number); const hours = timeParts[0] || 0; const minutes = timeParts[1] || 0; const result = new Date(baseDate); result.setHours(hours, minutes, 0, 0); return result; }
AST#method_declaration#Left static parseTime AST#parameter_list#Left ( AST#parameter#Left timeString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left baseDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primar...
static parseTime(timeString: string, baseDate: Date = new Date()): Date { const timeParts = timeString.split(':').map(Number); const hours = timeParts[0] || 0; const minutes = timeParts[1] || 0; const result = new Date(baseDate); result.setHours(hours, minutes, 0, 0); return result; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L196-L203
f56981b9de67b614fc9cee5252ad266ab431f118
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/SmartHomeCenter/entry/src/main/ets/MainAbility/app.ets
arkts
Copyright (c) 2021 JianGuo 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, sof...
export default { onCreate() { console.info('Application onCreate') }, onDestroy() { console.info('Application onDestroy') }, }
AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCreate AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le...
export default { onCreate() { console.info('Application onCreate') }, onDestroy() { console.info('Application onDestroy') }, }
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/SmartHomeCenter/entry/src/main/ets/MainAbility/app.ets#L15-L22
67174e651a0f819877d62f233ac324c51a11a46b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/DailyCountManaer.ets
arkts
============================================================ DailyCountType:每日计数类型 ============================================================
export enum DailyCountType { wordPron = 'wordPron', examplePron = 'examplePron', dictShow = 'dictShow', onlineDict = 'onlineDict', challenge = 'challenge' }
AST#export_declaration#Left export AST#enum_declaration#Left enum DailyCountType AST#enum_body#Left { AST#enum_member#Left wordPron = AST#expression#Left 'wordPron' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left examplePron = AST#expression#Left 'examplePron' AST#expression#Right AST#enum_member#Righ...
export enum DailyCountType { wordPron = 'wordPron', examplePron = 'examplePron', dictShow = 'dictShow', onlineDict = 'onlineDict', challenge = 'challenge' }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/DailyCountManaer.ets#L18-L24
f9679976097e74526eada49b4eb43b1429b4a9b5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsDetailPage.ets
arkts
构建商品详情页面 @returns {void} 无返回值
build() { AppNavDestination({ hideTitleBar: true, viewModel: this.vm, paddingValue: { left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.v...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left hideTitleBar : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#express...
build() { AppNavDestination({ hideTitleBar: true, viewModel: this.vm, paddingValue: { left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.v...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsDetailPage.ets#L47-L62
ebf9487271c2fa4c4a266f313c048dfc07bb1dc5
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
getMessages
获取消息列表
async getMessages(conversationId: string): Promise<Message[]> { try { if (this.messages.has(conversationId)) { return [...(this.messages.get(conversationId) || [])]; } // 从存储加载 const data = await StorageManager.getString(`${this.MESSAGES_PREFIX}${conversationId}`, '[]'); ...
AST#method_declaration#Left async getMessages AST#parameter_list#Left ( AST#parameter#Left conversationId : 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_t...
async getMessages(conversationId: string): Promise<Message[]> { try { if (this.messages.has(conversationId)) { return [...(this.messages.get(conversationId) || [])]; } const data = await StorageManager.getString(`${this.MESSAGES_PREFIX}${conversationId}`, '[]'); const m...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L131-L146
c5c83204e72e27574d78b8e09cb62629ebebbd03
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
getCommunityTopics
获取社区话题
async getCommunityTopics(limit: number = 20): Promise<CommunityTopic[]> { try { // TODO: 实现真实的API调用 return this.getMockTopics(limit); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get community topics: ${error}`); return []; } }
AST#method_declaration#Left async getCommunityTopics AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
async getCommunityTopics(limit: number = 20): Promise<CommunityTopic[]> { try { return this.getMockTopics(limit); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get community topics: ${error}`); return []; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L500-L509
03328f2caa17d6e8d639fd3713a09f29e18a8aec
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets
arkts
isNull
判断对象是否为空 @param source @returns
static isNull(source: object|undefined) { return source === undefined || source === null; }
AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left object AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) A...
static isNull(source: object|undefined) { return source === undefined || source === null; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets#L17-L19
eadb46ac9b96daee47a0ccba38b0c4c35968b871
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieEntry.ets
arkts
@SuppressLint("ParcelCreator")
export default class PieEntry extends EntryOhos { public label: string = ''; constructor(yValue: number, label ?: string, icon ?: ChartPixelMap /*Drawable*/ , data?: Object) { super(0, yValue, icon, data); this.label = label ? label : ''; } /** * This is the same as getY(). Returns th...
AST#export_declaration#Left export default AST#class_declaration#Left class PieEntry extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public label : AST#type_annotation#Left AST#primary_type#Left string ...
export default class PieEntry extends EntryOhos { public label: string = ''; constructor(yValue: number, label ?: string, icon ?: ChartPixelMap , data?: Object) { super(0, yValue, icon, data); this.label = label ? label : ''; } public getValue(): number { return super.getY(); }...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieEntry.ets#L19-L64
869af55f4b5fc887fb9c9578a73a04974910275b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/AudioCapturerHelper.ets
arkts
stop
停止采集
static async stop(): Promise<boolean> { let blResult: boolean = false; if (AudioCapturerHelper.audioCapturer !== undefined) { const state = AudioCapturerHelper.audioCapturer.state.valueOf(); //只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 if (state !== audio.AudioState.STATE_RUNNING && state !== ...
AST#method_declaration#Left static async stop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
static async stop(): Promise<boolean> { let blResult: boolean = false; if (AudioCapturerHelper.audioCapturer !== undefined) { const state = AudioCapturerHelper.audioCapturer.state.valueOf(); if (state !== audio.AudioState.STATE_RUNNING && state !== audio.AudioState.STATE_PAUSED) { ret...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/AudioCapturerHelper.ets#L113-L129
4b4bed6edde60790bcb2f3d2d5f283a58a58d295
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppFunctions.ets
arkts
创建目录(如果需要)
export function createFolderIfNeeds(folderPath: string): void { FileUtility.createFolderIfNeeds(folderPath) }
AST#export_declaration#Left export AST#function_declaration#Left function createFolderIfNeeds AST#parameter_list#Left ( AST#parameter#Left folderPath : 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_annotat...
export function createFolderIfNeeds(folderPath: string): void { FileUtility.createFolderIfNeeds(folderPath) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L9-L11
1ad16200aa51fbbfbd56d5f0060d80a44cfb43f2
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/PrefUtil.ets
arkts
delDefStroePrimose
销毁默认store
static delDefStroePrimose(context: Context, storeName?: string): Promise<boolean> { let prefName: string = PrefUtil.prefName if (storeName !== undefined && storeName !== '') { prefName = storeName } console.info('PrefUtil delDefStroePrimose {' + prefName + '} start') return new Promise<boolean...
AST#method_declaration#Left static delDefStroePrimose AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storeName ? : AST#type_annotation#Left AST#primary_type#Left strin...
static delDefStroePrimose(context: Context, storeName?: string): Promise<boolean> { let prefName: string = PrefUtil.prefName if (storeName !== undefined && storeName !== '') { prefName = storeName } console.info('PrefUtil delDefStroePrimose {' + prefName + '} start') return new Promise<boolean...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L118-L135
eca3c217cceaa9c93be9e7336edf04dd53b74faa
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DeviceUtils.ets
arkts
isActive
检测当前设备是否处于活动状态。有屏的设备为亮屏状态,无屏的设备为非休眠状态。 @returns
static isActive(): boolean { return power.isActive(); }
AST#method_declaration#Left static isActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressio...
static isActive(): boolean { return power.isActive(); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L225-L227
90a9101747692d3f199c5acea4b16729120c4cc3
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
example/BasicUsage.ets
arkts
run
============================================================ 工具方法 ============================================================
private run(cmd: string[]): void { const callback: TaskCallback = { onStart: (): void => { console.info('开始'); }, onProgress: (p: number): void => { console.info(`进度: ${(p * 100).toFixed(1)}%`); }, onSuccess: (): void => { console.info('成功'); }, onFailure: (): void => { console.info('失败'); }...
AST#method_declaration#Left private run AST#parameter_list#Left ( AST#parameter#Left cmd : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri...
private run(cmd: string[]): void { const callback: TaskCallback = { onStart: (): void => { console.info('开始'); }, onProgress: (p: number): void => { console.info(`进度: ${(p * 100).toFixed(1)}%`); }, onSuccess: (): void => { console.info('成功'); }, onFailure: (): void => { console.info('失败'); }...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L123-L131
f85a13939c23c33e64c4d5bc65578499b95cd4ce
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
getCombinedData
@Override
public getCombinedData(): CombinedData | null { return this.mData; }
AST#method_declaration#Left public getCombinedData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CombinedData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_st...
public getCombinedData(): CombinedData | null { return this.mData; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L91-L93
f86275549022f84bf9da056449c38036fe739fab
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarDataSet.ets
arkts
setGradientColor
Sets the start and end color for gradient color, ONLY color that should be used for this DataSet. @param startColor @param endColor
public setGradientColor(startColor: number, endColor: number): void { if (this.mFills) { this.mFills.clear(); this.mFills.insert(new Fill(startColor, endColor)); } }
AST#method_declaration#Left public setGradientColor AST#parameter_list#Left ( AST#parameter#Left startColor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endColor : AST#type_annotation#Left AST#primary_type#Left number A...
public setGradientColor(startColor: number, endColor: number): void { if (this.mFills) { this.mFills.clear(); this.mFills.insert(new Fill(startColor, endColor)); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L113-L118
c846b22c6588f3770f5e3edff17433dc00f9c66f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
deactivatePermission
取消使能授权过的多个文件或目录。(需要权限:ohos.permission.FILE_ACCESS_PERSIST) @returns 无返回结果的Promise对象。
static async deactivatePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.deactivatePermission(policies); }
AST#method_declaration#Left static async deactivatePermission AST#parameter_list#Left ( AST#parameter#Left policies : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fileShare . PolicyInfo AST#qua...
static async deactivatePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.deactivatePermission(policies); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L987-L989
670b86909dcc1133007f4c22f1f39637eff93e94
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AddressRepository.ets
arkts
addAddress
新增地址 @param params 地址信息 @returns 新增地址ID
async addAddress(params: Address): Promise<NetworkResponse<Id>> { return this.networkDataSource.addAddress(params); }
AST#method_declaration#Left async addAddress AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
async addAddress(params: Address): Promise<NetworkResponse<Id>> { return this.networkDataSource.addAddress(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L62-L64
0a273e89dd779272a0d1abbdd9265b9bfb518fe4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets
arkts
getSameRootStringByText
============================================================ 同根词描述 ============================================================
async getSameRootStringByText(enText: string): Promise<string | null> { if (!this.db) return null; const encoded = StringEncoder.encodedToBase64(enText); if (!encoded) return null; const sql = ` SELECT ${CigenTable.CSameRoot.sameRoot} FROM ${CigenTable.CSameRoot.table} WHERE SUBSTR( ...
AST#method_declaration#Left async getSameRootStringByText AST#parameter_list#Left ( AST#parameter#Left enText : 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#gener...
async getSameRootStringByText(enText: string): Promise<string | null> { if (!this.db) return null; const encoded = StringEncoder.encodedToBase64(enText); if (!encoded) return null; const sql = ` SELECT ${CigenTable.CSameRoot.sameRoot} FROM ${CigenTable.CSameRoot.table} WHERE SUBSTR( ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L143-L164
14d7897446053fe89bb9590ac91fa6c58c723b23
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets
arkts
updateMoveBookIdsByGroupId
移除分组下的bookId
updateMoveBookIdsByGroupId(data:Record<number, number>){ BookGroupsDao.updateMoveBookIdsByGroupId(data) }
AST#method_declaration#Left updateMoveBookIdsByGroupId AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#ty...
updateMoveBookIdsByGroupId(data:Record<number, number>){ BookGroupsDao.updateMoveBookIdsByGroupId(data) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L93-L95
60d057a037336ee3ed14fc30eb025b0fe06cee3c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets
arkts
当前正在绘制的节点
build() { Column() { // 画布 Row() { // TODO:知识点:自定义节点容器组件NodeContainer,接收MyNodeController的实例,将自定义的渲染节点挂载到组件上,实现自定义绘制 NodeContainer(this.myNodeController) .width('100%') .height($r('app.integer.hand_writing_canvas_height')) .onTouch((event: TouchEvent) => { ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 画布 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // TODO...
build() { Column() { Row() { NodeContainer(this.myNodeController) .width('100%') .height($r('app.integer.hand_writing_canvas_height')) .onTouch((event: TouchEvent) => { this.onTouchEvent(event); }) .id(NODE_CONTAINER_ID) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets#L53-L144
15d1fefc05e96730d32b1041aeb6ab1b76de39a2
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
loadSettings
从数据库加载设置条目
private async loadSettings() { this.currentAddress = await this.db.getSetting(CommonConstants.DB_KEY_HostInfo_KEY_NAME_Address); this.currentASFPassword = await this.db.getSetting(CommonConstants.DB_KEY_HostInfo_KEY_NAME_Password); }
AST#method_declaration#Left private async loadSettings AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentAddress AST#memb...
private async loadSettings() { this.currentAddress = await this.db.getSetting(CommonConstants.DB_KEY_HostInfo_KEY_NAME_Address); this.currentASFPassword = await this.db.getSetting(CommonConstants.DB_KEY_HostInfo_KEY_NAME_Password); }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L177-L180
4762534ec4ea45c2001acdd491a9b402cf340a48
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/greeting/GreetingService.ets
arkts
getGreetingById
根据ID获取祝福语 @param greetingId 祝福语ID @returns 祝福语信息
async getGreetingById(greetingId: string): Promise<Greeting | null> { try { const dbData = await this.databaseService.queryFirst( StorageConstants.TABLE_GREETINGS, 'id = ?', [greetingId] ); if (!dbData) { return null; } return this.dbDataToGreeting(thi...
AST#method_declaration#Left async getGreetingById AST#parameter_list#Left ( AST#parameter#Left greetingId : 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_t...
async getGreetingById(greetingId: string): Promise<Greeting | null> { try { const dbData = await this.databaseService.queryFirst( StorageConstants.TABLE_GREETINGS, 'id = ?', [greetingId] ); if (!dbData) { return null; } return this.dbDataToGreeting(thi...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/greeting/GreetingService.ets#L258-L275
43d7c459eb60c2ee047309aa011c9ef48e78c152
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets
arkts
getPicture
Picture ArrayBuffer Download picture resources from the Internet through the http request method
async getPicture(): Promise<void> { http.createHttp() .request('https://www.example1.com/POST?e=f&g=h', (error: BusinessError, data: http.HttpResponse) => { if (error) { return; } // Determine whether the resources obtained by the network are of the ArrayBuffe...
AST#method_declaration#Left async getPicture 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 getPicture(): Promise<void> { http.createHttp() .request('https://www.example1.com/POST?e=f&g=h', (error: BusinessError, data: http.HttpResponse) => { if (error) { return; } if (data.result instanceof ArrayBuffer) { this.imageBuffe...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets#L40-L54
3e6a30dce983f2395a7c04c1f8b070b763b181d9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/calendar/BirthdayListPage.ets
arkts
loadBirthdays
加载生日数据
private async loadBirthdays(): Promise<void> { try { this.loading = true; await this.loadBirthdaysByFilter(this.selectedFilter); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load birthdays: ${error}`); } finally { this.loading = false; }...
AST#method_declaration#Left private async loadBirthdays 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...
private async loadBirthdays(): Promise<void> { try { this.loading = true; await this.loadBirthdaysByFilter(this.selectedFilter); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load birthdays: ${error}`); } finally { this.loading = false; }...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/calendar/BirthdayListPage.ets#L44-L53
7439f9160e932c187483108de2f83d19df34461d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
testConnection
测试API连接
private async testConnection(): Promise<void> { if (!this.apiKey.trim()) { this.testResult = '请输入API密钥'; this.testSuccess = false; return; } try { this.testing = true; this.testResult = '正在测试连接...'; const config: LLMConfig = { provider: this.selectedProvider, ...
AST#method_declaration#Left private async testConnection 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 > AS...
private async testConnection(): Promise<void> { if (!this.apiKey.trim()) { this.testResult = '请输入API密钥'; this.testSuccess = false; return; } try { this.testing = true; this.testResult = '正在测试连接...'; const config: LLMConfig = { provider: this.selectedProvider, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L100-L135
268db41603a8ccf58842c568a8809250332a5c0d
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets
arkts
bmiSuggestion
根据当前数值值 从DxinConstants.bmiTableArr中查找匹配的对象的suggestion字段
bmiSuggestion(currentVal: number): string { return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max)?.suggestion as string }
AST#method_declaration#Left bmiSuggestion AST#parameter_list#Left ( AST#parameter#Left currentVal : 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_ty...
bmiSuggestion(currentVal: number): string { return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max)?.suggestion as string }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets#L17-L19
730d4f5d166b85b6effcbdd7798b519e7170e08c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/memoryShared/Index.ets
arkts
MemorySharedHome
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { MemorySharedHome } from './src/main/ets/pages/MemorySharedHome';
AST#export_declaration#Left export { MemorySharedHome } from './src/main/ets/pages/MemorySharedHome' ; AST#export_declaration#Right
export { MemorySharedHome } from './src/main/ets/pages/MemorySharedHome';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/Index.ets#L16-L16
8ccd32b8b38542219d17cebd2afc13970fd2ee9c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
register
注册网络监听 @param netHandler 网络监听事件
static register(netHandler: netEventHandler) { if (!NetUtil.conn) { //创建NetConnection对象 NetUtil.conn = NetUtil.createConnection(); } //注册 NetUtil.conn.register((error: BusinessError) => { if (error) { Logger.error(`网络注册异常,编码: ${error.code} , 原因: ${error.message}`); } ...
AST#method_declaration#Left static register AST#parameter_list#Left ( AST#parameter#Left netHandler : AST#type_annotation#Left AST#primary_type#Left netEventHandler AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left A...
static register(netHandler: netEventHandler) { if (!NetUtil.conn) { NetUtil.conn = NetUtil.createConnection(); } NetUtil.conn.register((error: BusinessError) => { if (error) { Logger.error(`网络注册异常,编码: ${error.code} , 原因: ${error.message}`); } }); if (netHan...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L97-L132
23382125272cadf00107cd864452736eb4f93e26
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getBeforeDay
获取前一天日期
static getBeforeDay(date: number | string | Date): Date { return DateUtil.getAmountDay(date, -1); }
AST#method_declaration#Left static getBeforeDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri...
static getBeforeDay(date: number | string | Date): Date { return DateUtil.getAmountDay(date, -1); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L290-L292
9ea3b8bbb03c18e37b4b4e9e4cbdd326a4c064c1
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/ConnectionUtils.ets
arkts
closeRegister
The method of closing register.
closeRegister() { this.netConnection.unregister((error: BusinessError) => { hilog.info(0x0000, TAG, JSON.stringify(error)); }); }
AST#method_declaration#Left closeRegister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left thi...
closeRegister() { this.netConnection.unregister((error: BusinessError) => { hilog.info(0x0000, TAG, JSON.stringify(error)); }); }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/ConnectionUtils.ets#L87-L91
ae808175c7c3b02cfe39b4ff5f91ffe287c60e9e
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
encodeSegments
Returns a QR Code representing the given segments with the given encoding parameters. The smallest possible QR Code version within the given range is automatically chosen for the output. Iff boostEcl is true, then the ECC level of the result may be higher than the ecl argument if it can be done without increasing the v...
public static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion: int = 1, maxVersion: int = 40, mask: int = -1, boostEcl: boolean = true): QrCode { if (!(QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode.MAX_VERSION) || mask < -1 |...
AST#method_declaration#Left public static encodeSegments AST#parameter_list#Left ( AST#parameter#Left segs : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Readonly AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#ty...
public static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion: int = 1, maxVersion: int = 40, mask: int = -1, boostEcl: boolean = true): QrCode { if (!(QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode.MAX_VERSION) || mask < -1 |...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets#L88-L110
2b3070022c59ce9545cf2052567545b94a8b1543
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
checkFileSystem
检查文件系统
static async checkFileSystem(): Promise<CheckResult> { try { console.info('[SystemCheckService] 开始检查文件系统'); const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_FS); console.info('[SystemCheckService] 文件系统检查响应:', JSON.stringify(response)); return { success: response.code...
AST#method_declaration#Left static async checkFileSystem 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 CheckResult AST#primary_type#Right AST#type_annotation#Rig...
static async checkFileSystem(): Promise<CheckResult> { try { console.info('[SystemCheckService] 开始检查文件系统'); const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_FS); console.info('[SystemCheckService] 文件系统检查响应:', JSON.stringify(response)); return { success: response.code...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L26-L44
fca90991ca296e209d8e02b3e17a530ac97acade
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/RequstDownload/entry/src/main/ets/pages/Index.ets
arkts
showFileContent
显示指定文件的内容
showFileContent(filePath: string) { let content = fs.readTextSync(filePath) this.msgHistory += "文件内容:" + content + "\r\n" }
AST#method_declaration#Left showFileContent AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
showFileContent(filePath: string) { let content = fs.readTextSync(filePath) this.msgHistory += "文件内容:" + content + "\r\n" }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/RequstDownload/entry/src/main/ets/pages/Index.ets#L197-L200
d06d738cab4282abdf1ad9ad7e42fcabb64b05b2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleContinueParam
处理流转中目标端的数据 @param want 发起方传入的want参数 @param launchParam
handleContinueParam(want: Want, launchParam: AbilityConstant.LaunchParam) { // 迁移应用启动时(onCreate)&应用热启动时(onNewWant):恢复保存的迁移数据 if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) { // 从want中恢复迁移数据 let isContinuation = want?.parameters?.isContinuation; // 是否迁移的标志 let isSele...
AST#method_declaration#Left handleContinueParam 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#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ...
handleContinueParam(want: Want, launchParam: AbilityConstant.LaunchParam) { if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) { let isContinuation = want?.parameters?.isContinuation; let isSelectImg = want?.parameters?.isSelectImg; let swiperIndex = want?.par...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets#L110-L142
dff6837ad6cafcac9b41a10674e6e98971b30755
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CombinedData.ets
arkts
getEntryForHighlight
Get the Entry for a corresponding highlight object @param highlight @return the entry that is highlighted
public getEntryForHighlight(highlight: Highlight): EntryOhos | null { if (highlight.getDataIndex() >= this.getAllData().size()) return null; let data: ChartData<IDataSet<EntryOhos>> = this.getDataByIndex(highlight.getDataIndex()); if (!data || highlight.getDataSetIndex() >= data.getDataSetCount()) {...
AST#method_declaration#Left public getEntryForHighlight AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#pri...
public getEntryForHighlight(highlight: Highlight): EntryOhos | null { if (highlight.getDataIndex() >= this.getAllData().size()) return null; let data: ChartData<IDataSet<EntryOhos>> = this.getDataByIndex(highlight.getDataIndex()); if (!data || highlight.getDataSetIndex() >= data.getDataSetCount()) {...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CombinedData.ets#L204-L232
2aad9f8d05ec7baded04cc645711e6fed2c3a1d7
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/pages/SampleCodePage.ets
arkts
copyCode
复制代码到剪贴板
async copyCode(code: string) { try { const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, code); const systemPasteboard = pasteboard.getSystemPasteboard(); await systemPasteboard.setData(pasteData); // 显示成功提示 promptAction.showToast({ message: '代码已复制到剪贴板', ...
AST#method_declaration#Left async copyCode AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AS...
async copyCode(code: string) { try { const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, code); const systemPasteboard = pasteboard.getSystemPasteboard(); await systemPasteboard.setData(pasteData); promptAction.showToast({ message: '代码已复制到剪贴板', dura...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/SampleCodePage.ets#L2258-L2273
d2118e5427eea2161f08d0e0cf059b41aca52b55
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/StartFacialFecognition.ets
arkts
getDetectionResultInfo
获取活体检测结果 @returns
public static getDetectionResultInfo() { // getInteractiveLivenessResult接口调用完会释放资源 let resultInfo = interactiveLiveness.getInteractiveLivenessResult(); const promise: Promise<interactiveLiveness.InteractiveLivenessResult> = new Promise((resolve, reject) => { resultInfo.then(async (data) => { i...
AST#method_declaration#Left public static getDetectionResultInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // getInteractiveLivenessResult接口调用完会释放资源 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left resultInfo = AST#expression#Left AST#call_expressio...
public static getDetectionResultInfo() { let resultInfo = interactiveLiveness.getInteractiveLivenessResult(); const promise: Promise<interactiveLiveness.InteractiveLivenessResult> = new Promise((resolve, reject) => { resultInfo.then(async (data) => { if (data.mPixelMap !== undefined) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/StartFacialFecognition.ets#L48-L77
bca7ab227c0267a49a7240774436d607f6f2c1ee
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
getCurrentProviderInfo
获取当前提供商信息
private getCurrentProviderInfo(): LLMInfo | null { return this.providers.find(p => p.provider === this.selectedProvider) || null; }
AST#method_declaration#Left private getCurrentProviderInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LLMInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block...
private getCurrentProviderInfo(): LLMInfo | null { return this.providers.find(p => p.provider === this.selectedProvider) || null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L65-L67
7958f84933ed2c11c2a3a60956dbe16884ae8dc5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
createBirthdayNotificationConfig
创建生日通知配置
private async createBirthdayNotificationConfig(contact: Contact, daysUntil: number): Promise<NotificationConfig> { let type: NotificationType; let title: string; let content: string; if (daysUntil === 0) { type = NotificationType.BIRTHDAY_TODAY; title = '🎉 今天是生日!'; content = `今天是 ${c...
AST#method_declaration#Left private async createBirthdayNotificationConfig AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left daysUntil : AST#type_annotation#Left AST#prim...
private async createBirthdayNotificationConfig(contact: Contact, daysUntil: number): Promise<NotificationConfig> { let type: NotificationType; let title: string; let content: string; if (daysUntil === 0) { type = NotificationType.BIRTHDAY_TODAY; title = '🎉 今天是生日!'; content = `今天是 ${c...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L172-L207
f95accd3545e9c6a327510ed760b1342fba7abac
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/feedback/FeedbackNavigator.ets
arkts
toList
跳转到反馈列表 @returns {void} 无返回值
static toList(): void { navigateTo(FeedbackRoutes.List); }
AST#method_declaration#Left static toList 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_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expres...
static toList(): void { navigateTo(FeedbackRoutes.List); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/feedback/FeedbackNavigator.ets#L13-L15
7b2abdfb22fc493d264b11e5538400b140db3f7a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Async.ets
arkts
encryptMessagePromise
加密消息
async function encryptMessagePromise(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null); let encryptData = await cipher.doFinal(plainText); return encryp...
AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left publicKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#...
async function encryptMessagePromise(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null); let encryptData = await cipher.doFinal(plainText); return encryp...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Async.ets#L20-L25
46e287372d02976fd7ec7b6a0f080890b676e5f8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets
arkts
sectionStyle
section的样式
@Styles sectionStyle() { .width($r('app.string.limited_height_bottom_dialog_full_width')) .backgroundColor(Color.White) .borderRadius($r('app.integer.limited_height_bottom_dialog_section_border_radius')) .padding({ left: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding...
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right sectionStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_...
@Styles sectionStyle() { .width($r('app.string.limited_height_bottom_dialog_full_width')) .backgroundColor(Color.White) .borderRadius($r('app.integer.limited_height_bottom_dialog_section_border_radius')) .padding({ left: $r('app.integer.limited_height_bottom_dialog_section_left_and_right_padding...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets#L94-L103
ae255b57cb6a088889b7cef9310fbac726d962da
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/CardBuilder.ets
arkts
CardInformationHttp
推屏卡片详细信息
CardInformationHttp(webinarId: string, Id: string) { VHSaaSDK.getInstance().getCardInfo(webinarId, Id, { onSucceed: (data: VHCardInfo) => { this.card = data console.log('卡片信息', data) }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); ...
AST#method_declaration#Left CardInformationHttp AST#parameter_list#Left ( AST#parameter#Left webinarId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left Id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
CardInformationHttp(webinarId: string, Id: string) { VHSaaSDK.getInstance().getCardInfo(webinarId, Id, { onSucceed: (data: VHCardInfo) => { this.card = data console.log('卡片信息', data) }, onFailure: (errorCode: number, errorMsg: string) => { ToastUtil.showToast(errorMsg); ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/CardBuilder.ets#L24-L34
df3f3be5228d0ffd4444a7d1611230ddf22fdf76
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/menu/VHInviteDialog.ets
arkts
resetState
重置状态
private resetState() { this.selectedCardId = '-1'; this.selectedImage = ''; this.showPreview = false; this.showActionMenu = false; }
AST#method_declaration#Left private resetState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCardId AST#member_expre...
private resetState() { this.selectedCardId = '-1'; this.selectedImage = ''; this.showPreview = false; this.showActionMenu = false; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDialog.ets#L69-L74
8413a0d401606aac69fb35113cae3c1c5d5765bd
gitee
toly1994328/HarmonyUnit
318c99f475e5457350405fc905343d9b3e81812c
entry/src/main/ets/pages/painter/bloc/PainterBloc.ets
arkts
newLine
开始平移时,添加新线
newLine(x: number, y: number) { let currentColor = this.supportColors[this.colorIndex]; let currentStorkWidths = this.supportStorkWidths[this.storkWidthIndex]; this.lines.push(new Line([new Point(x, y)], currentColor, currentStorkWidths)); this.lineCount++; }
AST#method_declaration#Left newLine AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a...
newLine(x: number, y: number) { let currentColor = this.supportColors[this.colorIndex]; let currentStorkWidths = this.supportStorkWidths[this.storkWidthIndex]; this.lines.push(new Line([new Point(x, y)], currentColor, currentStorkWidths)); this.lineCount++; }
https://github.com/toly1994328/HarmonyUnit/blob/318c99f475e5457350405fc905343d9b3e81812c/entry/src/main/ets/pages/painter/bloc/PainterBloc.ets#L68-L73
d30b343ddc1b629495948d71d9537ef49b6c1071
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomLoadingProgressDlg.ets
arkts
CustomLoadingProgressDlg
加载进展对话框。
@CustomDialog export struct CustomLoadingProgressDlg { controller: CustomDialogController build() { Stack() { Column() { LoadingProgress() .color(Color.Blue) .width($r("app.integer.video_trimmer_progress_size")) } } .width($r("app.integer.video_trimmer_loading_pr...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomLoadingProgressDlg AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ...
@CustomDialog export struct CustomLoadingProgressDlg { controller: CustomDialogController build() { Stack() { Column() { LoadingProgress() .color(Color.Blue) .width($r("app.integer.video_trimmer_progress_size")) } } .width($r("app.integer.video_trimmer_loading_pr...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomLoadingProgressDlg.ets#L19-L34
aa6c717d045869a86f4c27a32a92761030262ed0
gitee
Delsin-Yu/JustPDF.git
d53f566e02820dac46e1752151750144acbed50a
entry/src/main/ets/components/PageInfo.ets
arkts
recalculateGlobalIndices
Recalculates global page indices for all pages after a move operation.
private recalculateGlobalIndices(): void { let pageCounter = 0; for (const group of this.pageGroups) { for (const pageInfo of group.pages) { pageInfo.globalPageIndex = pageCounter; pageCounter++; } } }
AST#method_declaration#Left private recalculateGlobalIndices AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator...
private recalculateGlobalIndices(): void { let pageCounter = 0; for (const group of this.pageGroups) { for (const pageInfo of group.pages) { pageInfo.globalPageIndex = pageCounter; pageCounter++; } } }
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L864-L872
16b55683d6d260c8ad2ba66926a6c610c3fa7205
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
getGridDashPathEffect
returns the DashPathEffect that is set for grid line @return
public getGridDashPathEffect(): DashPathEffect { return this.mGridDashPathEffect; }
AST#method_declaration#Left public getGridDashPathEffect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Lef...
public getGridDashPathEffect(): DashPathEffect { return this.mGridDashPathEffect; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L600-L602
64f1eb6b6b2de4373112399e0efedcb5a2530432
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets
arkts
The constant of CommentsComponent.
export class CommentList { /** * The space of List. */ static readonly SPACE: number = 5; /** * The image size of head portrait. */ static readonly IMAGE_SIZE_HEAD_PORTRAIT: number = 45; /** * The margin of head portrait. */ static readonly MARGIN_HEAD_PORTRAIT: number = 16; /** *...
AST#export_declaration#Left export AST#class_declaration#Left class CommentList AST#class_body#Left { /** * The space of List. */ AST#property_declaration#Left static readonly SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST...
export class CommentList { static readonly SPACE: number = 5; static readonly IMAGE_SIZE_HEAD_PORTRAIT: number = 45; static readonly MARGIN_HEAD_PORTRAIT: number = 16; static readonly LINE_HEIGHT_PHONE: number = 32; static readonly BLANK_HEIGHT_PHONE: number = 6; static readonly MARK...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L90-L146
93b254390703b16aa900208090be87cddfb306a5
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/view/HomeComponent.ets
arkts
editAccountingAction
添加收支记录
editAccountingAction() { let item: AccountingInfo = new AccountingInfo(-1, dateToStr(new Date()), 0, '', '', '', ''); // 跳转添加记录界面 router.pushUrl({ url: 'pages/AddAccountingPage', params: {params: JSON.stringify(item)} }); }
AST#method_declaration#Left editAccountingAction AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left item : AST#type_annotation#Left AST#primary_type#Left AccountingInfo AST#primary_type#Right AST#type_annotati...
editAccountingAction() { let item: AccountingInfo = new AccountingInfo(-1, dateToStr(new Date()), 0, '', '', '', ''); router.pushUrl({ url: 'pages/AddAccountingPage', params: {params: JSON.stringify(item)} }); }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L153-L161
723938efae243fe57f22749479a078fad412094a
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
fadeOut
淡出动画
static fadeOut(duration: number = 300): object { return { duration: duration, curve: curve.EaseIn }; }
AST#method_declaration#Left static fadeOut AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le...
static fadeOut(duration: number = 300): object { return { duration: duration, curve: curve.EaseIn }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L21-L26
9b055ebc3236b93ad01c7640c9f5d26dfa5b0ff7
github
openharmony/bundlemanager_bundle_framework
89882654172b6bfba2a4a1ebfacdd6c9296f6f21
interfaces/kits/ani/freeInstall/ets/bundleManager/BundlePackInfo.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 BundlePackInfo { readonly packages: Array<PackageConfig>; readonly summary: PackageSummary; }
AST#export_declaration#Left export AST#interface_declaration#Left interface BundlePackInfo AST#object_type#Left { AST#type_member#Left readonly AST#ERROR#Left packages AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#prim...
export interface BundlePackInfo { readonly packages: Array<PackageConfig>; readonly summary: PackageSummary; }
https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/freeInstall/ets/bundleManager/BundlePackInfo.ets#L16-L19
87314d36cb440a3255b293574c7ec26a09fc151f
gitee
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
arkts
sendDeviceCommand
发送设备控制命令 @param phone 手机号
static async sendDeviceCommand(deviceId:string, postData:DeviceCommandModel) { let command = { commandName: postData.commandName, serviceId: postData.serviceId, value: postData.value, } let httpRequest = http.createHttp(); LogUtil.info(TAG,"sendDeviceCommand:" + JSON.stringify(command...
AST#method_declaration#Left static async sendDeviceCommand AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left postData : AST#type_annotation#Left AST#primary_type#Left Dev...
static async sendDeviceCommand(deviceId:string, postData:DeviceCommandModel) { let command = { commandName: postData.commandName, serviceId: postData.serviceId, value: postData.value, } let httpRequest = http.createHttp(); LogUtil.info(TAG,"sendDeviceCommand:" + JSON.stringify(command...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L392-L421
25e8945a0698d2925d197aaef2bfdf209e320c3e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets
arkts
评论内容
constructor(userName: string, reviewContent: string) { this.userName = userName; this.reviewContent = reviewContent; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left userName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reviewContent : AST#type_annotation#Left AST#primary_type#Left string AST#p...
constructor(userName: string, reviewContent: string) { this.userName = userName; this.reviewContent = reviewContent; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets#L25-L28
bc2302f5c275c519734d1614ce16fbfe5bfbf679
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getAllMoodEntries
获取所有情绪记录
async getAllMoodEntries(): Promise<MoodEntry[]> { try { return await this.rdbHelper.getAllMoodEntries(); } catch (error) { console.error(`[MainViewModel] Failed to get all mood entries: ${JSON.stringify(error)}`); return []; } }
AST#method_declaration#Left async getAllMoodEntries AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MoodEntry [ ] AST#array_type#Right AST#prim...
async getAllMoodEntries(): Promise<MoodEntry[]> { try { return await this.rdbHelper.getAllMoodEntries(); } catch (error) { console.error(`[MainViewModel] Failed to get all mood entries: ${JSON.stringify(error)}`); return []; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L631-L638
c3027414d3d2bdd4d3d9b1b630a64d8f7d04a589
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/drag/DefaultDrag.ets
arkts
pixelMapBuilder
[Start generate_pix_map]
@Builder pixelMapBuilder() { Column() { Image($r('app.media.startIcon')) .width(120) .height(120) .backgroundColor(Color.Yellow) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right pixelMapBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_...
@Builder pixelMapBuilder() { Column() { Image($r('app.media.startIcon')) .width(120) .height(120) .backgroundColor(Color.Yellow) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/drag/DefaultDrag.ets#L32-L40
f6d2500f872b5cac40f257620b38b4d82e3a3595
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
existFolder
判断文件夹是否存在 @param path 文件夹绝对路径
static existFolder(path: string): boolean { if (fs.accessSync(path)) { let stat = fs.statSync(path); return stat.isDirectory(); } else { return false; } }
AST#method_declaration#Left static existFolder AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
static existFolder(path: string): boolean { if (fs.accessSync(path)) { let stat = fs.statSync(path); return stat.isDirectory(); } else { return false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L105-L112
fb6c4c00e64d2d114c8b603f419bff06c1cd5293
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/GridSegmentedPicker.ets
arkts
updateColumnsAndHeight
根据当前容器实际宽度和设定的单元格参数,动态计算列数和网格总高度
private updateColumnsAndHeight(): void { if (this.actualContainerWidth <= 0) { return; } // 计算单个网格项占据的水平空间(宽度 + 一个列间隙的份额,因为最后一列右侧没有间隙) // 更简单直接的方法:计算最大可容纳列数 const singleCellWidthWithGap = this.CELL_SIZE.width + this.SPACING; // 最大列数 = (容器总宽度 + 一个间隙) / (单元格宽度 + 一个间隙) 后取整 ...
AST#method_declaration#Left private updateColumnsAndHeight 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#if_statement#Left if ( AST#expression#Left AST#binary_e...
private updateColumnsAndHeight(): void { if (this.actualContainerWidth <= 0) { return; } const singleCellWidthWithGap = this.CELL_SIZE.width + this.SPACING; let maxCols = Math.floor((this.actualContainerWidth + this.SPACING) / singleCellWidthWithGap); maxCols ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/GridSegmentedPicker.ets#L102-L121
e60908a3d58e6cb2c302433adae616fabd6dc1d6
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getPartById
根据分类ID获取分类
getPartById(partId: number): Part | undefined { return this.parts.find(part => part.partId === partId); }
AST#method_declaration#Left getPartById AST#parameter_list#Left ( AST#parameter#Left partId : 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#union_type#Left AST#primary_type#Left Part AS...
getPartById(partId: number): Part | undefined { return this.parts.find(part => part.partId === partId); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L404-L406
625b1ddd974d908c8cf32555ff537e9465ffc5ff
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/ActionsManager.ets
arkts
应用约束60:使用ES6 export代替module.exports
export default ActionsManager;
AST#export_declaration#Left export default AST#expression#Left ActionsManager AST#expression#Right ; AST#export_declaration#Right
export default ActionsManager;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/ActionsManager.ets#L49-L49
7a7ff88299478a16e64e3efc7d0b777c97801307
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
@file @kit ArkUI Defines the option of router. @interface RouterOptions @syscap SystemCapability.ArkUI.ArkUI.Lite @since 3 @deprecated since 8 @useinstead ohos.router#RouterOptions
export interface RouterOptions { /** * URI of the destination page, which supports the following formats: * 1. Absolute path of the page, which is provided by the pages list in the config.json file. * Example: * pages/index/index * pages/detail/detail * 2. Particular path. If the URI is...
AST#export_declaration#Left export AST#interface_declaration#Left interface RouterOptions AST#object_type#Left { /** * URI of the destination page, which supports the following formats: * 1. Absolute path of the page, which is provided by the pages list in the config.json file. * Example: * pages/in...
export interface RouterOptions { uri: string; params?: Object; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L30-L57
5299da84c43351ff3feac30d768143099e1cbb36
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/panels/meowHomepageManager.ets
arkts
select_set_background_image_storage
Selects an image from storage.
select_set_background_image_storage() { image_document_pick_to_ArrayBuffer().then(result => { if (result !== undefined) { let buf = result as ArrayBuffer; // Set image for homepage this.homepage_background = arrayBuffer_2_pixelMap_sync(buf); // Save this to sandbox sand...
AST#method_declaration#Left select_set_background_image_storage 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 image_document_pick_to_ArrayBuffer ( ) AST#ui_component#Right AST#modifier_chain_expres...
select_set_background_image_storage() { image_document_pick_to_ArrayBuffer().then(result => { if (result !== undefined) { let buf = result as ArrayBuffer; this.homepage_background = arrayBuffer_2_pixelMap_sync(buf); sandbox_save('homepage_background_arrayBuffer', buf)...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/panels/meowHomepageManager.ets#L56-L69
8de119fe02f44bbe7924c276e96376e501c634d6
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
createPhotoOutputFn
[Start create_photo_outputFn] Creates a photoOutPut output object
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn success: ${photoOutput}`); ...
AST#method_declaration#Left createPhotoOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ph...
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn success: ${photoOutput}`); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L366-L378
ea1c52ea42c276bf7f903cb446dacb0a46d533c3
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceTabs.d.ets
arkts
AtomicServiceTabs
@file Provides an advanced struct of tabs for atomic services @kit ArkUI Defines AtomicServiceTabs. @struct { AtomicServiceTabs } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
@Component export declare struct AtomicServiceTabs { /** * The TabContent array of tabs. * * @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?] }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceTabs AST#component_body#Left { /** * The TabContent array of tabs. * * @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuild...
@Component export declare struct AtomicServiceTabs { @BuilderParam tabContents?: [ TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder? ]; @Prop tabBarOptionsArray: [ TabBarOptions, TabBarOptions, TabBarOptions?, TabBarOp...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L29-L149
ce0eda32107aeccae0ddc6e5bdf16912aea6cf60
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
goContactDetail
跳转到联系人详情页面 @param contactId 联系人ID
async goContactDetail(contactId: string): Promise<void> { await this.push(RoutePaths.CONTACT_DETAIL, { params: { contactId } }); }
AST#method_declaration#Left async goContactDetail AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
async goContactDetail(contactId: string): Promise<void> { await this.push(RoutePaths.CONTACT_DETAIL, { params: { contactId } }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L267-L271
7de5dd6327b5bbe62f1d6135c3252ea6961f5c17
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
getSettingsGroups
获取设置分组
private getSettingsGroups(): SettingsGroup[] { if (!this.settings) return []; return [ // 外观设置 { title: '外观', items: [ { title: '深色模式', description: this.getThemeModeDescription(this.settings.theme.mode), icon: $r('app.media.ic_theme'), ...
AST#method_declaration#Left private getSettingsGroups AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SettingsGroup [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_sta...
private getSettingsGroups(): SettingsGroup[] { if (!this.settings) return []; return [ { title: '外观', items: [ { title: '深色模式', description: this.getThemeModeDescription(this.settings.theme.mode), icon: $r('app.media.ic_theme'), ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L164-L353
f9aab4d3ed1810a7385355ac521aa2f6d9bab091
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCrlObject.ets
arkts
crlSample
CRL示例
function crlSample(): void { let textEncoder = new util.TextEncoder(); let encodingBlob: cert.EncodingBlob = { // 将CRL数据从string转为Unit8Array data: textEncoder.encodeInto(crlData), // CRL格式,仅支持PEM和DER格式。在这个例子中,CRL用的是PEM格式 encodingFormat: cert.EncodingFormat.FORMAT_PEM }; // 创建X509CRL实例 cert.cre...
AST#function_declaration#Left function crlSample AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textEn...
function crlSample(): void { let textEncoder = new util.TextEncoder(); let encodingBlob: cert.EncodingBlob = { data: textEncoder.encodeInto(crlData), encodingFormat: cert.EncodingFormat.FORMAT_PEM }; cert.createX509CRL(encodingBlob, (err, x509Crl) => { if (err != null) { 失败 ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCrlObject.ets#L83-L176
1690ac238df45910c24298f3fee6c84b3e10e2d8
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildDelete.ets
arkts
try
应用约束44:catch参数不标注类型
try { if (response.guild) { client.emit(Constants.Events.GUILD_DELETE, response.guild); }
AST#method_declaration#Left try AST#ERROR#Left { if AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left response AST#parameter#Right AST#ERROR#Left . guild AST#ERROR#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#...
try { if (response.guild) { client.emit(Constants.Events.GUILD_DELETE, response.guild); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildDelete.ets#L19-L22
2fca272ca689ea67bf3849b3238177bbce9ba460
github