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
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets
arkts
setMainWindowOrientation
[Start set_main] Select the corresponding parameters according to the rotation strategy of the application itself.
setMainWindowOrientation(orientation: window.Orientation, callback?: Function): void { // [StartExclude set_main] if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } // Setting orientation. // [EndExclude set_main] this.mainWindowClass.se...
AST#method_declaration#Left setMainWindowOrientation AST#parameter_list#Left ( AST#parameter#Left orientation : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Orientation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c...
setMainWindowOrientation(orientation: window.Orientation, callback?: Function): void { if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } this.mainWindowClass.setPreferredOrientation(orientation).then(() => { callback?.(); }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets#L85-L98
ddfd182a68289efc128056ab7771286aa2051f1b
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets
arkts
dismiss
关闭弹窗 @param dialogId @param delay
static dismiss(dialogId: string = '', delay: number = -1) { if (delay > 0) { setTimeout(() => { PromptActionUtils.getInstance().closeCustomDialog(dialogId) }, delay) } else { PromptActionUtils.getInstance().closeCustomDialog(dialogId) } }
AST#method_declaration#Left static dismiss AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left delay : AST#type_annotation#Lef...
static dismiss(dialogId: string = '', delay: number = -1) { if (delay > 0) { setTimeout(() => { PromptActionUtils.getInstance().closeCustomDialog(dialogId) }, delay) } else { PromptActionUtils.getInstance().closeCustomDialog(dialogId) } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets#L50-L58
114e858cb0f7fcb61f67339b261da1d4dd8b2a22
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
formatTime
格式化时间为 HH:mm
static formatTime(date: Date): string { const hours = String(date.getHours()).padStart(2, '0') const minutes = String(date.getMinutes()).padStart(2, '0') return `${hours}:${minutes}` }
AST#method_declaration#Left static formatTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
static formatTime(date: Date): string { const hours = String(date.getHours()).padStart(2, '0') const minutes = String(date.getMinutes()).padStart(2, '0') return `${hours}:${minutes}` }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L19-L23
40208338ecdd9b4f1d9ae5de8209235460b8efd8
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/lifecycle/Lifecycle4View.ets
arkts
Lifecycle4View
@author: HZWei @date: 2024/11/7 @desc:
@Route({ name: RouterConstants.LIFECYCLE4_VIEW }) @Component export struct Lifecycle4View { @State viewModel : LifecycleModel = new LifecycleModel() @State viewModel2 : Lifecycle2Model = new Lifecycle2Model() @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); aboutToAppear(): void { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . LIFECYCLE4_VIEW AS...
@Route({ name: RouterConstants.LIFECYCLE4_VIEW }) @Component export struct Lifecycle4View { @State viewModel : LifecycleModel = new LifecycleModel() @State viewModel2 : Lifecycle2Model = new Lifecycle2Model() @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); aboutToAppear(): void { ...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/Lifecycle4View.ets#L13-L45
b77c172bed1c0cce672798a5263671305eb624ad
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets
arkts
实现BasicDataSource接口的类,用于进行Memo数据懒加载迭代的数据源
export class MemoDataSource extends BasicDataSource { // 懒加载数据 private memoData: Array<MemoInfo> = MEMO_DATA; totalCount(): number { return this.memoData.length; } // 获取指定数据项 getData(index: number): MemoInfo { return this.memoData[index]; } // 存储数据到懒加载数据源中 pushData(data: MemoInfo): void { ...
AST#export_declaration#Left export AST#class_declaration#Left class MemoDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 懒加载数据 AST#property_declaration#Left private memoData : AST#type_annotation#Left AST#primary_...
export class MemoDataSource extends BasicDataSource { private memoData: Array<MemoInfo> = MEMO_DATA; totalCount(): number { return this.memoData.length; } getData(index: number): MemoInfo { return this.memoData[index]; } pushData(data: MemoInfo): void { this.memoData.push(data); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L85-L104
b9c05fa072c4a7ecef7153e51d0171ce1acd2da7
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/view/TargetListItem.ets
arkts
opacityTextStyle
Custom transparent text styles.
@Extend(Text) function opacityTextStyle() { .fontSize($r('app.float.text_font')) .fontColor($r('app.color.title_black_color')) .opacity(CommonConstants.OPACITY) .fontWeight(CommonConstants.FONT_WEIGHT) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function opacityTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST...
@Extend(Text) function opacityTextStyle() { .fontSize($r('app.float.text_font')) .fontColor($r('app.color.title_black_color')) .opacity(CommonConstants.OPACITY) .fontWeight(CommonConstants.FONT_WEIGHT) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetListItem.ets#L156-L161
4547d2177ffb56f6d44f4168cc8dcd6f0816b970
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/arkts/@arkts.collections.d.ets
arkts
getBitCountByRange
Counts the number of times a certain bit element occurs within a range of bits in a bit vector. @param { number } element - Element to be counted (0 means 0, else means 1). @param { number } fromIndex - The starting position of the index, containing the value at that index position. @param { number } toIndex - The end...
getBitCountByRange(element: number, fromIndex: number, toIndex: number): number;
AST#method_declaration#Left getBitCountByRange AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
getBitCountByRange(element: number, fromIndex: number, toIndex: number): number;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.collections.d.ets#L5577-L5577
13e841740b0817c6fbbc4aab799675045cb2b907
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
sortIconWithNameView
用于展示应用类别1和应用类别2 @param data app标题和appInfo所在数组
@Builder sortIconWithNameView(data: SortIconWithNameView) { Column() { Text($r(data.title)) .textAlign(TextAlign.Start) .width($r('app.string.grid_exchange_container_size')) .height($r('app.string.grid_exchange_title_height')) .padding({ left: $r('app.string.ohos_id...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right sortIconWithNameView AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left SortIconWithNameView AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bu...
@Builder sortIconWithNameView(data: SortIconWithNameView) { Column() { Text($r(data.title)) .textAlign(TextAlign.Start) .width($r('app.string.grid_exchange_container_size')) .height($r('app.string.grid_exchange_title_height')) .padding({ left: $r('app.string.ohos_id...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L149-L210
e77980f7a347069c352a1a517a8d76b0acc19031
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
getPaintRender
Returns the Paint object used for rendering. @return
public getPaintRender(): Paint { return this.mRenderPaint; }
AST#method_declaration#Left public getPaintRender AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Paint AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp...
public getPaintRender(): Paint { return this.mRenderPaint; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/DataRenderer.ets#L112-L114
d2620a590e469840d4c33130389323281b6e41ac
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
[StartExclude power_entry_ability]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets#L54-L57
d19d6300891710176da5263cee5dcf50ac314679
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey SM2公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns 验签结果OutDTO对象,其中Msg为验签结果
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false); }
AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L85-L89
463eef04ef5c81bf8b8d5600190ecc30123e09c3
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
readMessage
标记消息为已读 @param params 标记消息为已读请求参数 @returns 操作结果
async readMessage(params: ReadMessageRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.readMessage(params); }
AST#method_declaration#Left async readMessage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ReadMessageRequest 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 readMessage(params: ReadMessageRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.readMessage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L43-L45
11c8c909b1a7ac5c77769b70becfa3f073de1449
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
修改为当前开发环境
export const BASE_URL = apiConfig.getUrl(CURRENT_ENV);
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BASE_URL = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left apiConfig AST#expression#Right . getUrl AST#member_expression#Right AST#expression#Right AST#argu...
export const BASE_URL = apiConfig.getUrl(CURRENT_ENV);
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L69-L69
e85740b23b9b2d3a21ca1a602e353f54e992ea63
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets
arkts
buildHeader
构建标题栏
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets#L148-L214
6be0d3322e088a81ed81c6301e0842a533d74530
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/Index.ets
arkts
clickMenuButton
菜单栏按钮逻辑
clickMenuButton() { animateTo( { duration: 300, // 动画持续时间(毫秒) curve: Curve.EaseInOut, // 动画曲线 }, () => { this.sideBarWidth = this.sideBarWidth === 58 ? 200 : 58; // 切换宽度值 } ) }
AST#method_declaration#Left clickMenuButton 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 animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expr...
clickMenuButton() { animateTo( { duration: 300, curve: Curve.EaseInOut, }, () => { this.sideBarWidth = this.sideBarWidth === 58 ? 200 : 58; } ) }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/Index.ets#L57-L67
083ccdba85079c5c13dbdd07eda641e04430dca7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
getAllNetworks
[Start query_the_capability_information_and_connection_information] [Start get_all_registered_networks] 获取所有注册的网络
getAllNetworks() { // 调用getAllNets,获取所有处于连接状态的网络列表(Array<NetHandle>) connection.getAllNets().then((data: connection.NetHandle[]) => { Logger.info('getAllNets get data: ' + JSON.stringify(data)); if (data) { this.allNetworksStatus = 'Retrieved successfully'; GlobalContext.getContext()...
AST#method_declaration#Left getAllNetworks AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 调用getAllNets,获取所有处于连接状态的网络列表(Array<NetHandle>) AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left...
getAllNetworks() { connection.getAllNets().then((data: connection.NetHandle[]) => { Logger.info('getAllNets get data: ' + JSON.stringify(data)); if (data) { this.allNetworksStatus = 'Retrieved successfully'; GlobalContext.getContext().netList = data; let itemNumber: Set<con...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets#L335-L358
81a34c56e386800f667b53c40ece2faf82d95965
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinL.ets
arkts
SpinL
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinL { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.16 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinL AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinL { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.16 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinL.ets#L25-L285
67dfa78c0045d01885caa7cd8cc80c341b3e516f
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets
arkts
set
设置链路监听器,用户接收链路断开事件 @param connectLostListener
set connectionListener(value: ConnectListener | null);
AST#method_declaration#Left set AST#ERROR#Left connection List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ConnectListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#...
set connectionListener(value: ConnectListener | null);
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets#L72-L72
8f539bbddc4005805b069e072f90d3b988e2e8e6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/model/VolumeData.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface VolumeData { totalSize: number freeSize: number description: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface VolumeData AST#object_type#Left { AST#type_member#Left totalSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left freeSize : AST#type_annotation#...
export interface VolumeData { totalSize: number freeSize: number description: string }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/model/VolumeData.ets#L16-L20
c2f49a394fec7a341145b9b51f6ef35b125f7424
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/TaskModel.ets
arkts
loadTasks
加载待办任务
static async loadTasks(): Promise<TaskItem[]> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return []; } try { const tasksStr = await DataStorage.prefsInstance.get(DataStorage.KEY_TASKS, '[]') as string; const tasks = JSON.parse(tasksStr) as TaskIt...
AST#method_declaration#Left static async loadTasks 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 TaskItem [ ] AST#array_type#Right AST#primar...
static async loadTasks(): Promise<TaskItem[]> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return []; } try { const tasksStr = await DataStorage.prefsInstance.get(DataStorage.KEY_TASKS, '[]') as string; const tasks = JSON.parse(tasksStr) as TaskIt...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L53-L67
be474b3d3e8cb10c9e54f1c45164cb7f792508a6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
应用路由管理器
export class AppRouter { private static instance: AppRouter; private navigationStack: string[] = []; private constructor() {} /** * 获取单例实例 */ static getInstance(): AppRouter { if (!AppRouter.instance) { AppRouter.instance = new AppRouter(); } return AppRouter.instance; } /...
AST#export_declaration#Left export AST#class_declaration#Left class AppRouter AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left AppRouter AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#...
export class AppRouter { private static instance: AppRouter; private navigationStack: string[] = []; private constructor() {} static getInstance(): AppRouter { if (!AppRouter.instance) { AppRouter.instance = new AppRouter(); } return AppRouter.instance; } async push(path: st...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L65-L331
8ba00022a7ff9a37f35b54f74906c3032e575c41
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
extractPersonalityTraits
从备注中提取性格特点
private extractPersonalityTraits(notes?: string): string[] { if (!notes) return []; const traits = ['开朗', '幽默', '认真', '细心', '热情', '温柔', '坚强', '乐观']; return traits.filter(trait => notes.includes(trait)); }
AST#method_declaration#Left private extractPersonalityTraits AST#parameter_list#Left ( AST#parameter#Left notes ? : 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#a...
private extractPersonalityTraits(notes?: string): string[] { if (!notes) return []; const traits = ['开朗', '幽默', '认真', '细心', '热情', '温柔', '坚强', '乐观']; return traits.filter(trait => notes.includes(trait)); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L575-L580
25e3df0a3051878a6dafa1842b17a6619e33b9e5
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
getSBMainItem
刷新侧边栏对应的显示列表
private getSBMainItem(): void { this.showList = []; if (this.sideBarMainIndex === 0) { this.showList = [...this.showListVM]; this.surveys.forEach((survey: Survey) => { if (!survey.deleted) { this.showList.push(new ShowListModel(survey.id!, survey.title, survey.createdTime.toString(...
AST#method_declaration#Left private getSBMainItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ...
private getSBMainItem(): void { this.showList = []; if (this.sideBarMainIndex === 0) { this.showList = [...this.showListVM]; this.surveys.forEach((survey: Survey) => { if (!survey.deleted) { this.showList.push(new ShowListModel(survey.id!, survey.title, survey.createdTime.toString(...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L523-L561
824a198565916e05b9ae88aa3d19fd6e85a0428a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/model/Util.ets
arkts
尺寸信息
export class Size { height: number; width: number; constructor(height: number, width: number) { this.height = height; this.width = width; } }
AST#export_declaration#Left export AST#class_declaration#Left class Size AST#class_body#Left { AST#property_declaration#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left width : AST#type_ann...
export class Size { height: number; width: number; constructor(height: number, width: number) { this.height = height; this.width = width; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/model/Util.ets#L28-L36
348b09a25b328d971fc8a4a651a615d654232478
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReusePage.ets
arkts
ReusePage
通过组件复用,加载每个月份的数据,当数据量较多时,快速滑动到底部,会出现掉帧的情况。
@Component export struct ReusePage { @State contentData: MonthDataSource = new MonthDataSource(); // 列表数据 nowDate = new Date(); currentMonth: number = this.nowDate.getMonth() + 1; // 当前月份 currentDay: number = this.nowDate.getDate(); // 当前日 currentYear: number = this.nowDate.getFullYear(); // 当前年份 currentWee...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ReusePage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right contentData : AST#type_annotation#Left AST#primary_type#Left MonthDataSource AST#primary_type#Right AST#...
@Component export struct ReusePage { @State contentData: MonthDataSource = new MonthDataSource(); nowDate = new Date(); currentMonth: number = this.nowDate.getMonth() + 1; currentDay: number = this.nowDate.getDate(); currentYear: number = this.nowDate.getFullYear(); currentWeekDay: number = new Date(thi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReusePage.ets#L35-L120
1172b8534410734abbc7305a3c33d570d7650d98
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
concatDate
年月日格式修饰 @param year @param month @param date
concatDate(year: number, month: number, date: number): string { return `${year}${this.fill(month)}${this.fill(date)}`; }
AST#method_declaration#Left concatDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ...
concatDate(year: number, month: number, date: number): string { return `${year}${this.fill(month)}${this.fill(date)}`; }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L62-L64
32c7e832e0837a5ccdd4342916094ae764c6c796
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/set_lib_func_003_T.ets
arkts
Introduction 库函数-set_values
export function set_lib_func_003_T(taint_src : string) { let s = new Set<string>(); s.add(taint_src); taint.Sink(s.values()); }
AST#export_declaration#Left export AST#function_declaration#Left function set_lib_func_003_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#...
export function set_lib_func_003_T(taint_src : string) { let s = new Set<string>(); s.add(taint_src); taint.Sink(s.values()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/set_lib_func_003_T.ets#L6-L10
8d03eb13778e58303470e31e01015f2684e350f7
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbUtils.ets
arkts
del
删除数据
del(rdbPredicates: dataRdb.RdbPredicates): Promise<number> { return this.getDb().then(dbHelper => { return dbHelper.delete(rdbPredicates); }) }
AST#method_declaration#Left del AST#parameter_list#Left ( AST#parameter#Left rdbPredicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataRdb . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_...
del(rdbPredicates: dataRdb.RdbPredicates): Promise<number> { return this.getDb().then(dbHelper => { return dbHelper.delete(rdbPredicates); }) }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L120-L124
9040f4818230863644bf553257040309f15c3c60
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/LegendRenderer.ets
arkts
computeLegend
Prepares the legend and calculates all needed forms, labels and colors. @param data
public computeLegend(data ?: ChartData<IDataSet<EntryOhos>>): void { if (this.mLegend && !this.mLegend.isLegendCustom() && data) { this.computedEntries.clear(); // loop for building up the colors and labels used in the legend for (let i: number = 0; i < data.getDataSetCount(); i++) { l...
AST#method_declaration#Left public computeLegend AST#parameter_list#Left ( AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ChartData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type...
public computeLegend(data ?: ChartData<IDataSet<EntryOhos>>): void { if (this.mLegend && !this.mLegend.isLegendCustom() && data) { this.computedEntries.clear(); for (let i: number = 0; i < data.getDataSetCount(); i++) { let dataSet: IDataSet<EntryOhos> | null = data.getDataSetByIndex(...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/LegendRenderer.ets#L100-L265
1b8c2a633fcd4e5bf6ad90f8f0087d7d883925e3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
tabBarBuilder
自定义TabBar
@Builder tabBarBuilder(index: number) { Column() { Image(this.getTabBarImage(index)) .width($r('app.float.mini_player_animation_image_size')) .height($r('app.float.mini_player_animation_image_size')) .objectFit(ImageFit.Contain) Text(TAB_BAR_DATA[index].name) .fontSize(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBarBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#...
@Builder tabBarBuilder(index: number) { Column() { Image(this.getTabBarImage(index)) .width($r('app.float.mini_player_animation_image_size')) .height($r('app.float.mini_player_animation_image_size')) .objectFit(ImageFit.Contain) Text(TAB_BAR_DATA[index].name) .fontSize(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L138-L155
b4348fada441d01d6df6d33f2469ae2724b07b2a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment9.ets
arkts
Segment09Builder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function Segment09Builder() { NavDestination() { DiscoverView() } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment09Builder 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 NavDestination ( ) AST#containe...
@Builder export function Segment09Builder() { NavDestination() { DiscoverView() } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment9.ets#L15-L20
8fc349de7d53ce850b774a959234030c83daae4f
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/PieChartRenderer.ets
arkts
drawExtras
@Override
public drawExtras(c: CanvasRenderingContext2D): void { this.drawHole(c); // c.drawBitmap(this.mDrawBitmap.get([]), 0, 0, null); // c.drawImage(this.mDrawBitmap.get([]), 0, 0) this.drawCenterText(c); }
AST#method_declaration#Left public drawExtras AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D 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...
public drawExtras(c: CanvasRenderingContext2D): void { this.drawHole(c); this.drawCenterText(c); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/PieChartRenderer.ets#L713-L718
ce2935e84d0e3af025d974205d775a50833d122b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/FeedbackService.ets
arkts
showInfo
显示信息提示
async showInfo(message: string, duration: number = 1500): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Info: ${message}`); await promptAction.showToast({ message: `ℹ️ ${message}`, duration }); }
AST#method_declaration#Left async showInfo AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
async showInfo(message: string, duration: number = 1500): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Info: ${message}`); await promptAction.showToast({ message: `ℹ️ ${message}`, duration }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/FeedbackService.ets#L71-L78
c83859ba6d695f503d1d2b844ad3dfe9e18709e6
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoProcessBaseWeb/entry/src/main/ets/view/CustomPopupMenu.ets
arkts
[End menu]
export function getOffset( webWidth: number, webHeight: number, pressPosX: number, pressPosY: number): Position { const defaultX = (webWidth - popupWidth) / 2; const defaultY = (webHeight - popupHeight) / 2; let offsetX = pressPosX - defaultX; if (pressPosX + popupWidth > webWidth) { offsetX = webW...
AST#export_declaration#Left export AST#function_declaration#Left function getOffset AST#parameter_list#Left ( AST#parameter#Left webWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left webHeight : AST#type_annotation#Left...
export function getOffset( webWidth: number, webHeight: number, pressPosX: number, pressPosY: number): Position { const defaultX = (webWidth - popupWidth) / 2; const defaultY = (webHeight - popupHeight) / 2; let offsetX = pressPosX - defaultX; if (pressPosX + popupWidth > webWidth) { offsetX = webW...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/view/CustomPopupMenu.ets#L93-L115
b2d30c018a2bc7157690e159cc00f26c59004b9d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
showDeleteDialog
显示删除确认弹窗,并记录待删除的地址 ID @param {number} addressId - 待删除的地址 ID @returns {void} 无返回值
showDeleteDialog(addressId: number): void { this.deleteId = addressId; this.isDeleteDialogVisible = true; }
AST#method_declaration#Left showDeleteDialog AST#parameter_list#Left ( AST#parameter#Left addressId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
showDeleteDialog(addressId: number): void { this.deleteId = addressId; this.isDeleteDialogVisible = true; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressListViewModel.ets#L110-L113
db7bfdc5b0544cdb387a6a2dcfb449b7f5380af6
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.EditableTitleBar.d.ets
arkts
Declaration of the image item . @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export type EditableTitleBarItem = EditableTitleBarMenuItem;
AST#export_declaration#Left export AST#type_declaration#Left type EditableTitleBarItem = AST#type_annotation#Left AST#primary_type#Left EditableTitleBarMenuItem AST#primary_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type EditableTitleBarItem = EditableTitleBarMenuItem;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.EditableTitleBar.d.ets#L146-L146
881acc11b6eee9071d157b9fa6ae97853b018d0f
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets
arkts
connect2Server
连接服务端
connect2Server() { //本地地址 let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 } tcpSocket.connect({ address: serverAddress }) .then(() => { this.msgHistory = 'connect success ' + "\r\n"; this.canSend = true }) .catch((e) => { this.msgHist...
AST#method_declaration#Left connect2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left serverAddress = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left ...
connect2Server() { let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 } tcpSocket.connect({ address: serverAddress }) .then(() => { this.msgHistory = 'connect success ' + "\r\n"; this.canSend = true }) .catch((e) => { this.msgHistory = ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets#L190-L202
9904a37096f51842cc971f1b3ef23835cfea1678
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/model/CommonModel.ets
arkts
{ "articleList": [], "author": "", "children": [], "courseId": 13, "cover": "", "desc": "", "id": 434, "lisense": "", "lisenseLink": "", "name": "Gityuan", "order": 190013, "parentChapterId": 407, "type": 0, "userControlSetTop": false, "visible": 1 }
export class CommonModel { id:number; name:string; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left name : AST#type_a...
export class CommonModel { id:number; name:string; }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/model/CommonModel.ets#L20-L23
c15faad190c67f0039bfdbcd15a9515a4b24d5ab
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/model/TaskTimeRange.ets
arkts
getTimeDisplay
格式化时间显示
getTimeDisplay(): string { return `${this.startTime.getHours().toString().padStart(2, '0')}:${this.startTime.getMinutes().toString().padStart(2, '0')} - ${this.endTime.getHours().toString().padStart(2, '0')}:${this.endTime.getMinutes().toString().padStart(2, '0')}`; }
AST#method_declaration#Left getTimeDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal...
getTimeDisplay(): string { return `${this.startTime.getHours().toString().padStart(2, '0')}:${this.startTime.getMinutes().toString().padStart(2, '0')} - ${this.endTime.getHours().toString().padStart(2, '0')}:${this.endTime.getMinutes().toString().padStart(2, '0')}`; }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/model/TaskTimeRange.ets#L45-L47
cd22aa6754bd795d2c2ef340decf294289079d86
github
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/common/utils/FileManager.ets
arkts
formatFileSize
确保 formatFileSize 和 formatDate 方法正确实现
private formatFileSize(bytes: number): string { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`; }
AST#method_declaration#Left private formatFileSize AST#parameter_list#Left ( AST#parameter#Left bytes : 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#primar...
private formatFileSize(bytes: number): string { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`; }
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L218-L226
ac3fb8c4126ca177fd439830d36c03ae02872781
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/model/Podcast.ets
arkts
needsRefresh
判断是否需要刷新 规则:新订阅1分钟内每5秒刷新,之后每2小时刷新一次 如果已标记为获取失败,则不再刷新
needsRefresh(): boolean { if (this.isFetchFailed) { return false; } const now = Date.now(); const subscribeAge = now - this.subscribeDate; // 订阅了多久 const lastFetchAge = now - this.lastSuccessfulFetch; // 距离上次刷新多久 const ONE_MINUTE = 60 * 1000; const FIVE_SECONDS = 5 * 1000; const ...
AST#method_declaration#Left needsRefresh 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left ...
needsRefresh(): boolean { if (this.isFetchFailed) { return false; } const now = Date.now(); const subscribeAge = now - this.subscribeDate; const lastFetchAge = now - this.lastSuccessfulFetch; const ONE_MINUTE = 60 * 1000; const FIVE_SECONDS = 5 * 1000; const TWO_HOURS = 2 * 60 ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/model/Podcast.ets#L36-L56
8ee6abddc64898b3192c4ee12b7fb5a3721256cc
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/UIAbilityLifeCycle/entry/src/main/ets/common/util/Logger.ets
arkts
constructor. @param Prefix Identifies the log tag. @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'MyApp' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotati...
constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/UIAbilityLifeCycle/entry/src/main/ets/common/util/Logger.ets#L29-L32
3532df5900869cd5f438a7b3abeb164e4cb91105
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhDialog.ets
arkts
show
中间弹框 @param options
public static show(options: JhDialogOptions) { DialogHelper.showAlertDialog({ title: options.title ?? _title, content: options.message ?? '', autoCancel: false, // 点击遮障层时,是否关闭弹窗,true表示关闭弹窗。 backCancel: false, // 点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。 actionCancel: options.click...
AST#method_declaration#Left public static show AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#L...
public static show(options: JhDialogOptions) { DialogHelper.showAlertDialog({ title: options.title ?? _title, content: options.message ?? '', autoCancel: false, backCancel: false, actionCancel: options.clickBtnClose ?? true, primaryButton: options.hiddenCancel ? null : { ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhDialog.ets#L137-L162
6a090734713b0f240bdfabf6a441581ffb23a577
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets
arkts
totalCount
获取数据列表长度
public totalCount(): number { return this.momentList.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.momentList.length; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L75-L77
9d8fad433ad2f730bdf082247479e5be38eeb225
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/Index.ets
arkts
CitySearch
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { CitySearch } from './src/main/ets/view/CitySearch';
AST#export_declaration#Left export { CitySearch } from './src/main/ets/view/CitySearch' ; AST#export_declaration#Right
export { CitySearch } from './src/main/ets/view/CitySearch';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/Index.ets#L16-L16
d30b426bbed4211811399d081424658425468f16
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/todo/TodoEditPage.ets
arkts
buildBasicInfoSection
构建基本信息区域
@Builder buildBasicInfoSection() { Column({ space: 16 }) { Text('基本信息') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) // 标题 Column({ space: 8 }) { Text('标题') .fontSize(14) .fontWeight(Fo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBasicInfoSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compone...
@Builder buildBasicInfoSection() { Column({ space: 16 }) { Text('基本信息') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 8 }) { Text('标题') .fontSize(14) .fontWeight(FontWei...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L223-L302
2c7132cea270e59efce6298164f234d1c12787aa
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
delete2ndItem
Delete the second element
public delete2ndItem(): void { this.dataArray.splice(1, 1); this.notifyDataDelete(1); }
AST#method_declaration#Left public delete2ndItem 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#exp...
public delete2ndItem(): void { this.dataArray.splice(1, 1); this.notifyDataDelete(1); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L118-L121
66fbe137149b6d8830f822835a4047b2d9c8b838
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets
arkts
flashBlackAnim
闪黑动效,拍照触发
private flashBlackAnim() { Logger.info(TAG, 'flashBlackAnim E'); this.flashBlackOpacity = 1; this.isShowBlack = true; animateToImmediately({ curve: curves.interpolatingSpring(1, 1, 410, 38), delay: 50, onFinish: () => { this.isShowBlack = false; this.flashBlackOpacity =...
AST#method_declaration#Left private flashBlackAnim AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right ...
private flashBlackAnim() { Logger.info(TAG, 'flashBlackAnim E'); this.flashBlackOpacity = 1; this.isShowBlack = true; animateToImmediately({ curve: curves.interpolatingSpring(1, 1, 410, 38), delay: 50, onFinish: () => { this.isShowBlack = false; this.flashBlackOpacity =...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets#L285-L300
921aa4c5a27ea184b8d8b4c5ed540d97bcd037bf
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AES.ets
arkts
decodeGCM
解密-GCM模式 @param str 加密的字符串 @param aesKey AES密钥
static async decodeGCM(str: string, aesKey: string): Promise<string> { //转换密钥 let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); // 初始化加解密操作环境:开始解密 let mode = crypto.CryptoMode.DECRYPT_MODE; //创建解密器 let cipher = crypto.createCipher('AES256|GCM|PKCS7'); //初始化加密 await ...
AST#method_declaration#Left static async decodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async decodeGCM(str: string, aesKey: string): Promise<string> { let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); let mode = crypto.CryptoMode.DECRYPT_MODE; let cipher = crypto.createCipher('AES256|GCM|PKCS7'); await cipher.init(mode, symKey, AES.gcmParam...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L156-L171
51c7577977e3b429474364bfd964c9a8c5d7bd55
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onForeground
前台
onForeground(): void { }
AST#method_declaration#Left onForeground 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#builder_function_body#Right AST#method_declaration#Right
onForeground(): void { }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets#L31-L32
d80416cf5f05fcb7674afd23f73fc3cd08ca6517
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets
arkts
//刷新动画 @State rotateAngle:number=0 @State timeoutID:number = 1 startRotate() { this.timeoutID = setInterval(() => { this.rotateAngle = 0 animateTo({ duration: 800 }, () => { this.rotateAngle = 360 }) }, 800); } clearAnimation(){ clearTimeout(this.timeoutID); }
build() { Column() { this.BufComponent()//留给电池显示 this.TopComponent() Flex({direction:FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center}) { Image(this.BookIcon).BookIconSize() Flex({direction:FlexDirection.Column, justifyContent: FlexAlig...
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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L...
build() { Column() { this.BufComponent() this.TopComponent() Flex({direction:FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center}) { Image(this.BookIcon).BookIconSize() Flex({direction:FlexDirection.Column, justifyContent: FlexAlign.SpaceB...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets#L234-L382
bb4e9dcd62c5d8ac54de513bae3a71339ca78173
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
setFitBars
Adds half of the bar width to each side of the x-axis range in order to allow the bars of the barchart to be fully displayed. Default: false @param enabled
public setFitBars(enabled: boolean): void { this.mFitBars = enabled; }
AST#method_declaration#Left public setFitBars AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
public setFitBars(enabled: boolean): void { this.mFitBars = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L279-L281
33e218ea5efc84cccb8c0ea82ab2b495da667cc7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowCenter
横向居中 + 垂直居中
@ComponentV2 export struct RowCenter { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param sizeVal...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowCenter AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left R...
@ComponentV2 export struct RowCenter { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | Length | ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L145-L220
112e1527ab2ebe2c8acef4b07fb36a8e86059339
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
initiatingUserAuthentication4
[EndExclude authentication_example4] [End authentication_example3] start-authentication.md 示例4: 以模应用方式进行用户身份认证
initiatingUserAuthentication4() { // 设置认证参数 try { const rand = cryptoFramework.createRandom(); const len: number = 16; const randData: Uint8Array = rand?.generateRandomSync(len)?.data; const authParam: userAuth.AuthParam = { challenge: randData, authType: [userAuth.UserAu...
AST#method_declaration#Left initiatingUserAuthentication4 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置认证参数 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rand = AST#expr...
initiatingUserAuthentication4() { try { const rand = cryptoFramework.createRandom(); const len: number = 16; const randData: Uint8Array = rand?.generateRandomSync(len)?.data; const authParam: userAuth.AuthParam = { challenge: randData, authType: [userAuth.UserAuthType.PI...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L289-L314
60626242ebed0fecee17a3d2c35fffb0dc23fc9c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getDaysByYear
获取指定年份的天数
static getDaysByYear(year: number): number { if (DateUtil.isLeapYear(year)) { return 366; } else { return 365; } }
AST#method_declaration#Left static getDaysByYear AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
static getDaysByYear(year: number): number { if (DateUtil.isLeapYear(year)) { return 366; } else { return 365; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L152-L158
e44596f070535714f1fd9f5343b49d1ab1094ba2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSA.ets
arkts
generateECDSAKey
生成ECDSA的非对称密钥 @returns ECDSA密钥{publicKey:公钥,privateKey:私钥}
static async generateECDSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('ECC256'); }
AST#method_declaration#Left static async generateECDSAKey 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 CryptoKey AST#primary_type#Right AST#type_annotation#Righ...
static async generateECDSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('ECC256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSA.ets#L31-L33
48ded33939cf943fae36a8b370429bc9b12e9b76
gitee
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
queryShopCart
Query shop cart data. @returns Product[]
queryShopCart() { return this.shopCartData; }
AST#method_declaration#Left queryShopCart AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shopCartData AST#member_expression#Right AST#expres...
queryShopCart() { return this.shopCartData; }
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L60-L62
615956b3e46e6eb56d1568c1ae44b0378163ca72
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/ifOrVisibility/Index.ets
arkts
BetterUseIf
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 { BetterUseIf } from './src/main/ets/view/IfForStartUp/BetterUseIf'
AST#export_declaration#Left export { BetterUseIf } from './src/main/ets/view/IfForStartUp/BetterUseIf' AST#export_declaration#Right
export { BetterUseIf } from './src/main/ets/view/IfForStartUp/BetterUseIf'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ifOrVisibility/Index.ets#L16-L16
303061e132f681206b75bf05d0d72643c9451fc1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/skeletondiagram/Index.ets
arkts
SkeletonDiagramComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { SkeletonDiagramComponent } from './src/main/ets/view/SkeletonDiagram';
AST#export_declaration#Left export { SkeletonDiagramComponent } from './src/main/ets/view/SkeletonDiagram' ; AST#export_declaration#Right
export { SkeletonDiagramComponent } from './src/main/ets/view/SkeletonDiagram';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/Index.ets#L17-L17
911f956a5c3212ae17761ad1460bc181bb907d9e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
setFlip
Set flip. @param isFlipHorizontal @param isFlipVertically
setFlip(isFlipHorizontal: boolean, isFlipVertically: boolean) { this.isFlipHorizontal = isFlipHorizontal; this.isFlipVertically = isFlipVertically; }
AST#method_declaration#Left setFlip AST#parameter_list#Left ( AST#parameter#Left isFlipHorizontal : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isFlipVertically : AST#type_annotation#Left AST#primary_type#Left boolean A...
setFlip(isFlipHorizontal: boolean, isFlipVertically: boolean) { this.isFlipHorizontal = isFlipHorizontal; this.isFlipVertically = isFlipVertically; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L149-L152
1868bc2bc0abb5a354928e2a931241e5881f87b7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/util/RouterLoader.ets
arkts
加载路由
export namespace RouterLoader { // 加载所有路由表文件 export function load(dir: string, routerMap: Map<string, AppRouterInfo>, context: Context) { const rm: resourceManager.ResourceManager = context.resourceManager; try { rm.getRawFileList(dir).then((value: Array<string>) => { let decoder: util.TextDec...
AST#export_declaration#Left export AST#ERROR#Left namespace RouterLoader { // 加载所有路由表文件 export AST#ERROR#Right AST#function_declaration#Left function load AST#parameter_list#Left ( AST#parameter#Left dir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramet...
export namespace RouterLoader { export function load(dir: string, routerMap: Map<string, AppRouterInfo>, context: Context) { const rm: resourceManager.ResourceManager = context.resourceManager; try { rm.getRawFileList(dir).then((value: Array<string>) => { let decoder: util.TextDecoder = util....
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/util/RouterLoader.ets#L23-L48
91c840db75595c444f5bb58220433f0e93098df6
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/pages/music/ProfilePage.ets
arkts
formatDate
格式化时间
formatDate(timestamp: number): string { const date = new Date(timestamp); return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`; }
AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
formatDate(timestamp: number): string { const date = new Date(timestamp); return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/music/ProfilePage.ets#L48-L51
89efd5cc7d8f4125879e2050e38e53923c1e16ee
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceTabs.d.ets
arkts
the class for TabBarOption @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare class TabBarOptions { /** * constructor to init the tabbar including icon, text, unselectedColor and selectedColor. * * @param { (ResourceStr | TabBarSymbol) } - icon - cannot be empty * @param { ResourceStr } text - cannot be empty * @param { ?ResourceColor } - unselectedColor - the col...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TabBarOptions AST#class_body#Left { /** * constructor to init the tabbar including icon, text, unselectedColor and selectedColor. * * @param { (ResourceStr | TabBarSymbol) } - icon - cannot be empty * ...
export declare class TabBarOptions { constructor(icon: ResourceStr | TabBarSymbol, text: ResourceStr, unselectedColor?: ResourceColor, selectedColor?: ResourceColor); }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L158-L172
1aa3b229a05141fc8bd566e74975b12653a84f65
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets
arkts
defaultFocus
是否默认聚焦输入框并弹出输入法 @description 设置为 `true` 时,弹窗打开后自动聚焦输入框并弹出输入法 @param placeholder @returns
defaultFocus(defaultFocus: boolean) { this.builderOptions.defaultFocus = defaultFocus; return this }
AST#method_declaration#Left defaultFocus AST#parameter_list#Left ( AST#parameter#Left defaultFocus : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme...
defaultFocus(defaultFocus: boolean) { this.builderOptions.defaultFocus = defaultFocus; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets#L38-L41
96556618332ca1e8561e625ff7551ef345f7a8c4
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
arkts
getDeviceListByUserId
根据用户id,获取设备列表 @param phone 手机号
static async getDeviceListByUserId(userId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/device/userId/${userId}`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' ...
AST#method_declaration#Left static async getDeviceListByUserId AST#parameter_list#Left ( AST#parameter#Left userId : 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#var...
static async getDeviceListByUserId(userId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/device/userId/${userId}`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L75-L97
74fca7f5913a0aa8c68a480b4f1b020e71650a11
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/CommentInputDialog.ets
arkts
CommentInputDialog
输入评论弹窗,用于展示输入文字与被回复的用户昵称 实现步骤: 1.添加发布按钮 2.点击发布按钮,将评论添加到列表中
@CustomDialog export struct CommentInputDialog { // 选择的照片列表 @State selectedImages: string[] = []; // 输入的文字 @State text: string = ""; @Link textInComment: string; @State placeholder: string = ""; controller?: CustomDialogController; // 发布接口,用于主页面更新评论数据 publish: () => void = (): void => {}; @Link comm...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommentInputDialog AST#component_body#Left { // 选择的照片列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Le...
@CustomDialog export struct CommentInputDialog { @State selectedImages: string[] = []; @State text: string = ""; @Link textInComment: string; @State placeholder: string = ""; controller?: CustomDialogController; publish: () => void = (): void => {}; @Link commentState: boolean; build() { C...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/CommentInputDialog.ets#L28-L99
4df83480dbea47fbe35171e77be4bde978ebb633
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/common/src/main/ets/model/BlockTag.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class BlockTag { public time: string = ''; public description: string = ''; constructor(nowTime: string, tagDes: string) { this.time = nowTime; this.description = tagDes; } }
AST#export_declaration#Left export AST#class_declaration#Left class BlockTag AST#class_body#Left { AST#property_declaration#Left public time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#R...
export class BlockTag { public time: string = ''; public description: string = ''; constructor(nowTime: string, tagDes: string) { this.time = nowTime; this.description = tagDes; } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/src/main/ets/model/BlockTag.ets#L16-L24
66add167c0719b31af26c072ab3288fe566b7e69
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowScratchingBoard.ets
arkts
open_url
Calls the webViews to open a new tab @param link the link of new tab
open_url(url: string) { this.new_tab_gateway = [url, false]; this.showing_scratching_board = false; }
AST#method_declaration#Left open_url AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left...
open_url(url: string) { this.new_tab_gateway = [url, false]; this.showing_scratching_board = false; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowScratchingBoard.ets#L393-L396
c29132244205f3d308ed549393e804a2d7b2f87c
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getShow
获取剧集信息 @param id 剧集id @returns
public getShow(id: string): Promise<FinItem> { return this.requireApi().getShow(id) }
AST#method_declaration#Left public getShow AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promis...
public getShow(id: string): Promise<FinItem> { return this.requireApi().getShow(id) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L88-L90
40e2ca3c0cd75d681fa27bc5582938eda6b97c2a
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/PreferenceManager.ets
arkts
Preference读写管理类。 @author huawei
export default class PreferenceManager { private preferences?: preferences.Preferences; private context = getContext(this) as common.UIAbilityContext; private static instance: PreferenceManager; private constructor() { this.initPreference(PREFERENCES_NAME); } public static getInstance(): PreferenceMan...
AST#export_declaration#Left export default AST#class_declaration#Left class PreferenceManager AST#class_body#Left { AST#property_declaration#Left private preferences ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#t...
export default class PreferenceManager { private preferences?: preferences.Preferences; private context = getContext(this) as common.UIAbilityContext; private static instance: PreferenceManager; private constructor() { this.initPreference(PREFERENCES_NAME); } public static getInstance(): PreferenceMan...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/PreferenceManager.ets#L21-L97
2e4e54398793e5ed7cd95be7e7ea53b7d3edaa00
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/ChatBubble.ets
arkts
copyToClipboard
复制消息到剪贴板
private copyToClipboard(): void { try { const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.message.content); const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); // 显示提示 promptAction.showToast({ mes...
AST#method_declaration#Left private copyToClipboard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statemen...
private copyToClipboard(): void { try { const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.message.content); const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); promptAction.showToast({ message: '...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ChatBubble.ets#L224-L243
7a4cb107a49eedf05e4fcf022908465a81fc59a7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets
arkts
TitleExpansion
功能描述: 1. 标题栏跟随手势产生移动、放缩以及显隐动效 2. 菜单栏跟随手势产生移动动效 3. 手势松开后,标题栏、菜单栏可以跳转或回弹至对应位置 实现原理: 1. 标题高度变化,通过状态变量heightValue控制,通过onScrollFrameBegin获取list偏移,并将其分配给标题高度变化和实际list偏移 2. 标题展开继续下拉偏移,通过状态变量curOffset控制,通过onDidScroll获取标题展开后,标题继续下拉的偏移 3. 滚动停止动画,通过onScrollStop获取滚动停止时的标题高度。当标题高度大于阈值时,产生展开标题动画;相反,则产生收缩标题动画 @param {TitleAttribute...
@Component export struct TitleExpansion { // 主标题属性 titleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_TITLE, new TitleAttributeModifier()); // 子标题属性 subTitleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_SUB_TITLE, new SubTitleAttributeModifier()); // 主标题及子标题位置 titlePosition: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleExpansion AST#component_body#Left { // 主标题属性 AST#property_declaration#Left titleAttribute : AST#type_annotation#Left AST#primary_type#Left TitleAttribute AST#primary_type#Right AST#type_annotation#Right = AST#exp...
@Component export struct TitleExpansion { titleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_TITLE, new TitleAttributeModifier()); subTitleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_SUB_TITLE, new SubTitleAttributeModifier()); titlePosition: HorizontalAlign = Horizontal...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets#L39-L254
c6fa5a185ed3c6995b58495b727dcff64d012c8e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/AccountStoreRepository.ets
arkts
loadAccount
读取账号 @returns {Promise<string>} 用户账号,默认空字符串
loadAccount(): Promise<string> { return this.dataSource.getAccount(); }
AST#method_declaration#Left loadAccount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_argument...
loadAccount(): Promise<string> { return this.dataSource.getAccount(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/AccountStoreRepository.ets#L36-L38
78d449e757547f2d55b3fd8b2043153bf4acd5d2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/index.ets
arkts
WorkSpace
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { WorkSpace } from './src/main/ets/default/layout/WorkSpace'
AST#export_declaration#Left export { WorkSpace } from './src/main/ets/default/layout/WorkSpace' AST#export_declaration#Right
export { WorkSpace } from './src/main/ets/default/layout/WorkSpace'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/index.ets#L16-L16
99156ea26b49b4fd1b6448e64e626b603fed1cb2
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets
arkts
updateTaskStatus
更新任务状态 @param status 新状态
async updateTaskStatus(status: number) { if (!this.task) return; try { this.isUpdating = true; // 更新任务状态 const updatedTask = await updateTaskStatus(this.task.id, status); if (updatedTask) { this.task = updatedTask; prompt.showToast({ message: '状态更新成功', ...
AST#method_declaration#Left async updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Le...
async updateTaskStatus(status: number) { if (!this.task) return; try { this.isUpdating = true; const updatedTask = await updateTaskStatus(this.task.id, status); if (updatedTask) { this.task = updatedTask; prompt.showToast({ message: '状态更新成功', dur...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets#L93-L116
51455f438c174ae6b5154d5bd1ac258c986fec81
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
addSystemMessage
添加一条系统消息(显示在聊天列表中)。 @param content 消息内容
addSystemMessage(content: string): void { let m: Message = Message.createChatMsgEntity_INCOME_SYSTEAMINFO('0', content, 0); this.putMessage(m); }
AST#method_declaration#Left addSystemMessage AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type...
addSystemMessage(content: string): void { let m: Message = Message.createChatMsgEntity_INCOME_SYSTEAMINFO('0', content, 0); this.putMessage(m); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L69-L72
09eddd88e9a10ff085fd6f510ab1bc2e1362b1a0
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Full percent. */ static readonly FULL_PERCENT: string = '100%'; /** * Ninety percent. */ static readonly NINETY_PERCENT: string = '90%'; /** * Fifty percent. */ static readonly FIFTY_PERCENT: string = '50%'; /** * Playback page path. */ static...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full percent. */ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export class CommonConstants { static readonly FULL_PERCENT: string = '100%'; static readonly NINETY_PERCENT: string = '90%'; static readonly FIFTY_PERCENT: string = '50%'; static readonly PAGE: string = 'pages/PlayPage'; static readonly TYPE_LOCAL: number = 0; static readonly TYPE_INTERNE...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L23-L106
5eb635693f59bc5e9399097520422344e537a937
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets
arkts
FrameNodeFactory
自定义DSL解析逻辑,将UI描述数据解析为组件 @param vm @param context @returns
function FrameNodeFactory(vm: VM, context: UIContext): FrameNode | null { if (vm.type === "Column") { let node = typeNode.createNode(context, "Column"); setColumnNodeAttr(node, vm.css); vm.children?.forEach(kid => { let child = FrameNodeFactory(kid, context); node.appendChild(child); }); ...
AST#function_declaration#Left function FrameNodeFactory AST#parameter_list#Left ( AST#parameter#Left vm : AST#type_annotation#Left AST#primary_type#Left VM AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#pri...
function FrameNodeFactory(vm: VM, context: UIContext): FrameNode | null { if (vm.type === "Column") { let node = typeNode.createNode(context, "Column"); setColumnNodeAttr(node, vm.css); vm.children?.forEach(kid => { let child = FrameNodeFactory(kid, context); node.appendChild(child); }); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets#L40-L111
0ec531746f1f3ee7666f5b3bc7314bd246c1f954
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
getSync
获取缓存值 @param key @param defValue @returns
static getSync(key: string, defValue: preferences.ValueType, preferenceName: string = PreferencesUtil.defaultPreferenceName): preferences.ValueType { const preferences = PreferencesUtil.getPreferencesSync(preferenceName); //获取实例 return preferences.getSync(key, defValue); }
AST#method_declaration#Left static getSync AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ...
static getSync(key: string, defValue: preferences.ValueType, preferenceName: string = PreferencesUtil.defaultPreferenceName): preferences.ValueType { const preferences = PreferencesUtil.getPreferencesSync(preferenceName); return preferences.getSync(key, defValue); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L105-L109
062059810a85d18beeaed31274dcf3d6cfca32b0
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/configs/ProjectConfig.ets
arkts
/ ProjectConfig.ets / / Created by iotjin on 2024/08/14. / description: 保存本地的用户model
export const kUserDefault_UserInfo = 'UserInfo';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left kUserDefault_UserInfo = AST#expression#Left 'UserInfo' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const kUserDefault_UserInfo = 'UserInfo';
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/configs/ProjectConfig.ets#L8-L8
d17e0ad40004a26b6235bb35496328b952ab6c9b
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
getAfterDay
获取后一天日期
static getAfterDay(date: number | string | Date): Date { return DateUtils.getAmountDay(date, 1); }
AST#method_declaration#Left static getAfterDay 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#Rig...
static getAfterDay(date: number | string | Date): Date { return DateUtils.getAmountDay(date, 1); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L291-L293
1ad94edee19362cb3d65c17639678ff71fd6cb27
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/Action.ets
arkts
handle
应用约束1:参数和返回值使用具体类型Object代替any
handle(data: Object): Object { return data; }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#...
handle(data: Object): Object { return data; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/Action.ets#L11-L13
f2c8d16d0fa12126ab66883c124aa70ad85c29c6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
testConnection
测试连接
async testConnection(config: LLMConfig): Promise<boolean> { try { const testRequest: ChatRequest = { messages: [ { role: 'user', content: 'Hello, this is a test message.' } ], maxTokens: 10 }; const response = await this.chat(testRequest, config); const suc...
AST#method_declaration#Left async testConnection AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left LLMConfig 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_typ...
async testConnection(config: LLMConfig): Promise<boolean> { try { const testRequest: ChatRequest = { messages: [ { role: 'user', content: 'Hello, this is a test message.' } ], maxTokens: 10 }; const response = await this.chat(testRequest, config); const suc...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L325-L349
0e83b39127cd3963f3d15b2e86bd58632136069e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/navigation/AuthGraph.ets
arkts
@file 认证模块导航图 @author Joker.X
export class AuthGraph implements RouteGraph { /** * 注册认证模块导航路由 */ register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); RouteBuild.register(AuthRoutes.AccountLogin, wrapBuilder(AccountLoginNav)); RouteBuild.register(AuthRoutes.SmsLogin, wrapBuilder(SmsLoginNav)); Ro...
AST#export_declaration#Left export AST#class_declaration#Left class AuthGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /** * 注册认证模块导航路由 */ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left ...
export class AuthGraph implements RouteGraph { register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); RouteBuild.register(AuthRoutes.AccountLogin, wrapBuilder(AccountLoginNav)); RouteBuild.register(AuthRoutes.SmsLogin, wrapBuilder(SmsLoginNav)); RouteBuild.register(AuthRou...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/navigation/AuthGraph.ets#L13-L24
043ea6923cdf8002515554c2203fe51c0f725209
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
setDefaultFocusState
set state of button focus
private setDefaultFocusState(buttonList?: AdvancedDialogV2Button[]): void { if (!buttonList) { return; } let falseNum: number = 0; buttonList.forEach((button: AdvancedDialogV2Button) => { // 遍历查询按钮中存在是否存在默认按钮 if (button.defaultFocus) { this.isHasDefaultFocus = true; } ...
AST#method_declaration#Left private setDefaultFocusState AST#parameter_list#Left ( AST#parameter#Left buttonList ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AdvancedDialogV2Button [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis...
private setDefaultFocusState(buttonList?: AdvancedDialogV2Button[]): void { if (!buttonList) { return; } let falseNum: number = 0; buttonList.forEach((button: AdvancedDialogV2Button) => { if (button.defaultFocus) { this.isHasDefaultFocus = true; } if (button.defaul...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1196-L1214
c308f3c4100e6c72198a9fc42932507d4b612c97
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/PrivateChatComponent.ets
arkts
drawAllIcons
绘制所有图标
drawAllIcons() { // 清除画布 this.context.clearRect(0, 0, this.context.width, this.context.height) // 绘制所有图标 for (let icon of this.likeIcons) { this.context.save() // 设置透明度 this.context.globalAlpha = icon.opacity // 设置缩放(从中心点缩放) this.context.translate(icon.x, icon.y) t...
AST#method_declaration#Left drawAllIcons AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 清除画布 AST#statement#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...
drawAllIcons() { this.context.clearRect(0, 0, this.context.width, this.context.height) for (let icon of this.likeIcons) { this.context.save() this.context.globalAlpha = icon.opacity this.context.translate(icon.x, icon.y) this.context.scale(icon.scale, icon.scal...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L326-L350
e28d6eda7623dc519dfc2a1c425664a71dbb1c9a
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets
arkts
getPriorityText
获取优先级文本 @param priority 优先级 @returns 优先级文本
getPriorityText(priority: number): string { switch (priority) { case 1: return '最高'; case 2: return '高'; case 3: return '中'; case 4: return '低'; case 5: return '最低'; default: return '中'; } }
AST#method_declaration#Left getPriorityText AST#parameter_list#Left ( AST#parameter#Left priority : 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...
getPriorityText(priority: number): string { switch (priority) { case 1: return '最高'; case 2: return '高'; case 3: return '中'; case 4: return '低'; case 5: return '最低'; default: return '中'; } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets#L156-L165
1400963a0929a9e2073ffa705e86ef1423ea6f13
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroup.ets
arkts
CheckboxGroupBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function CheckboxGroupBuilder(name: string, param: Object) { CheckboxGroupExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxGroupBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ...
@Builder export function CheckboxGroupBuilder(name: string, param: Object) { CheckboxGroupExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroup.ets#L16-L19
c90edb8039030f7cfc3594cd36c02f1e05c0410c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/DialogOptions.ets
arkts
ActionSheet,confirm按钮参数类
export class SheetConfirm { value: ResourceStr = ''; //Button的文本内容,若值为null,则该按钮不显示。 action: () => void = () => {}; //Button选中时的回调。 enabled?: boolean; //点击Button是否响应,默认值true。 defaultFocus?: boolean; //设置Button是否是默认焦点,默认值false。 style?: DialogButtonStyle; //设置Button的风格样式,默认值DialogButtonStyle.DEFAULT。 }
AST#export_declaration#Left export AST#class_declaration#Left class SheetConfirm AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaratio...
export class SheetConfirm { value: ResourceStr = ''; action: () => void = () => {}; enabled?: boolean; defaultFocus?: boolean; style?: DialogButtonStyle; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L101-L107
a4e35bdddd0f381e1772c0467a5c6eafa0179e88
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets
arkts
initBasicNotificationRequest
init basic NotificationRequest @param notificationContent @return return the created NotificationRequest
initBasicNotificationRequest(notificationContent: notification.NotificationContent): notification.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, // 通知id,默认为1 content: notificationContent }; }
AST#method_declaration#Left initBasicNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
initBasicNotificationRequest(notificationContent: notification.NotificationContent): notification.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, content: notificationContent }; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets#L26-L32
b349c6eaeb994d0825847ccd48f83720e5769775
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets
arkts
clearSelectedOption
清空已选项
clearSelectedOption() { for (let item of this.examDetails) { item.selected = []; } }
AST#method_declaration#Left clearSelectedOption AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( let item of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . examDetails AST#member_expression#Rig...
clearSelectedOption() { for (let item of this.examDetails) { item.selected = []; } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets#L99-L103
dcd16e76c764b3bf1ed8610a9db3119e5fe72f7a
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
DealStrideSolution/entry/src/main/ets/common/CommonConstants.ets
arkts
Common constants for common component.
export class CommonConstants { // percent static readonly FULL_PERCENT: string = '100%'; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // percent AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expres...
export class CommonConstants { static readonly FULL_PERCENT: string = '100%'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/common/CommonConstants.ets#L19-L22
d7ebf7a7c457f3b61c71a089fd32c9975fc97563
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets
arkts
readSync第三参数类型
export class Options { offset: number; length: number; constructor(offset: number, length: number) { this.offset = offset; this.length = length; } }
AST#export_declaration#Left export AST#class_declaration#Left class Options AST#class_body#Left { AST#property_declaration#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left length : AST#type...
export class Options { offset: number; length: number; constructor(offset: number, length: number) { this.offset = offset; this.length = length; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets#L66-L74
20a4aa6ff81d9c0a3f6c832ef3d4ceddeadbb8c9
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/path_sensitive/conditional_stmt/conditional_if_002_F.ets
arkts
Introduction 路径敏感-区分if else分支
export function conditional_if_002_F(taint_src : string) { let res = "" if (true) { res = "_" } else { res = taint_src } taint.Sink(res) }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen...
export function conditional_if_002_F(taint_src : string) { let res = "" if (true) { res = "_" } else { res = taint_src } taint.Sink(res) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/conditional_stmt/conditional_if_002_F.ets#L6-L14
ffaa6167bed382561a0b09e083f586bf9e6f9bc9
github
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/src/main/ets/RouterManagerForNavigation.ets
arkts
Navigation页面自动注册装饰器参数。 因为Navigation页面需要使用builder响应,所以入参中包含builder。
export interface RouterClassProviderOptions { routeName: string builder: WrappedBuilder<[params?: ESObject]> }
AST#export_declaration#Left export AST#interface_declaration#Left interface RouterClassProviderOptions AST#object_type#Left { AST#type_member#Left routeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left builder AST#ERR...
export interface RouterClassProviderOptions { routeName: string builder: WrappedBuilder<[params?: ESObject]> }
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterManagerForNavigation.ets#L30-L33
59144bdb418857c9481cdaa1cad31d0c3e9e044f
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleCreate.ets
arkts
应用约束61:使用export default代替module.exports
export default GuildRoleCreateHandler;
AST#export_declaration#Left export default AST#expression#Left GuildRoleCreateHandler AST#expression#Right ; AST#export_declaration#Right
export default GuildRoleCreateHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleCreate.ets#L16-L16
34cbb0a8c86c018977f9e1e680457d9ca8413afc
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/analytics/DashboardPage.ets
arkts
buildHeader
构建标题栏
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/analytics/DashboardPage.ets#L110-L197
5be34ece495cfff6d18a12959d87fa81bca63a97
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
requestLogin
用户登录
static async requestLogin(user: LoginInfo): Promise<ResponseDao<IUserDao>> { try { const response: AxiosResponse<ResponseDao<IUserDao>> = await axios.post( `${BASE_URL}/ddchat/index/login`, user, { headers: NetworkUtil.mergeHeaders("application/json") } ); ...
AST#method_declaration#Left static async requestLogin AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left LoginInfo 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_...
static async requestLogin(user: LoginInfo): Promise<ResponseDao<IUserDao>> { try { const response: AxiosResponse<ResponseDao<IUserDao>> = await axios.post( `${BASE_URL}/ddchat/index/login`, user, { headers: NetworkUtil.mergeHeaders("application/json") } ); ...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L267-L285
8ed5ae269ff4d2e368e1bf7d6a646ecc412c0a44
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/favorites/FavoriteTabContent.ets
arkts
onFavoriteIdsChange
监听 favoriteIds 变化,自动重新加载收藏列表
onFavoriteIdsChange(): void { hilog.info(DOMAIN, TAG, 'Favorite IDs changed, reloading merchants...'); this.loadFavoriteMerchants(); }
AST#method_declaration#Left onFavoriteIdsChange 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#expr...
onFavoriteIdsChange(): void { hilog.info(DOMAIN, TAG, 'Favorite IDs changed, reloading merchants...'); this.loadFavoriteMerchants(); }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/favorites/FavoriteTabContent.ets#L41-L44
70bcf43c0bbb8d2514dd47d9b99f0afa338afa77
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/user/ServiceSection.ets
arkts
ServiceSectionComponent
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct ServiceSectionComponent { @Builder serverSection(img: Resource, label: Resource) { Column() { Image(img) .width(40) .aspectRatio(1) .objectFit(ImageFit.Contain) Text(label) .fontSize(12) .margin({ top: 12 }) } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ServiceSectionComponent AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right serverSection AST#parameter_list#Left ( AST#parameter#Left img : AST#type_annotation#Left ...
@Component export struct ServiceSectionComponent { @Builder serverSection(img: Resource, label: Resource) { Column() { Image(img) .width(40) .aspectRatio(1) .objectFit(ImageFit.Contain) Text(label) .fontSize(12) .margin({ top: 12 }) } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/user/ServiceSection.ets#L16-L53
7e1096ad058610d4d87c721ba52ad5c2f3f75be2
gitee