nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreviewCustomBuilder.ets
arkts
BindContextMenuPreviewCustomBuilder
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 BindContextMenuPreviewCustomBuilder(name: string, param: Object) { BindContextMenuPreviewCustomBuilderExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuPreviewCustomBuilder 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#...
@Builder export function BindContextMenuPreviewCustomBuilder(name: string, param: Object) { BindContextMenuPreviewCustomBuilderExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreviewCustomBuilder.ets#L16-L19
b7b20cb300ddd2ad86135ce2292e981425c96091
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/components/common/LoadingView.ets
arkts
PageLoadingView
页面级加载视图
@Component export struct PageLoadingView { @Prop message: string = '页面加载中...'; build() { Column() { LoadingView({ message: this.message, size: 48, showBackground: true, backgroundColor: '#f5f5f5' }) } .width('100%') .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageLoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
@Component export struct PageLoadingView { @Prop message: string = '页面加载中...'; build() { Column() { LoadingView({ message: this.message, size: 48, showBackground: true, backgroundColor: '#f5f5f5' }) } .width('100%') .height('100%') } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/components/common/LoadingView.ets#L39-L55
b7f174a5d30e007e0ba4d425fdc1949e07463a62
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
clearSessionCookie
异步promise方式清除所有会话cookie。 @returns
static async clearSessionCookie(): Promise<void> { return await webview.WebCookieManager.clearSessionCookie(); }
AST#method_declaration#Left static async clearSessionCookie AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >...
static async clearSessionCookie(): Promise<void> { return await webview.WebCookieManager.clearSessionCookie(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L215-L217
9d1f5e4693c11546cefdebeca96d6650e69b2ac7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets
arkts
startPackUp
收起方法,与startPackUp绑定
private startPackUp(): void { if (this.startPackUpFloor) { this.packUpFloor(); this.startPackUpFloor = false; } }
AST#method_declaration#Left private startPackUp AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#memb...
private startPackUp(): void { if (this.startPackUpFloor) { this.packUpFloor(); this.startPackUpFloor = false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets#L64-L69
6d0a700fb5fde9e70ee84a29bacd0b7787e8e7a4
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/set_lib_func_004_F.ets
arkts
Introduction 库函数-set_values
export function set_lib_func_004_F(taint_src : string) { let s = new Set<string>(); s.add("_"); taint.Sink(s.values()); }
AST#export_declaration#Left export AST#function_declaration#Left function set_lib_func_004_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_statement#...
export function set_lib_func_004_F(taint_src : string) { let s = new Set<string>(); s.add("_"); taint.Sink(s.values()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/set_lib_func_004_F.ets#L6-L10
da1ef3fdd1e3cc9255299197a4ffe9c46012e209
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
decodeECB192
解密-ECB模式-192位 @param str 加密的字符串 @param aesKey AES密钥-192位 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns
static decodeECB192(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES192', 'AES192|ECB|PKCS7', 192, keyCoding, dataCoding); }
AST#method_declaration#Left static decodeECB192 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static decodeECB192(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES192', 'AES192|ECB|PKCS7', 192, keyCoding, dataCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L297-L300
8ed49b818ecbf1e21595e2efcb73d24ad362e4a4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/PasswordInputField.ets
arkts
构建密码输入组件 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.password, type: this.isPasswordHidden ? "password" : "normal", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.password, type: this.isPasswordHidden ? "password" : "normal", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/PasswordInputField.ets#L42-L76
07bf39a5150e886f472c6ee61cf7990c9df47c73
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.prompt.d.ets
arkts
@file @kit ArkUI Defines the options of ShowToast. @interface ShowToastOptions @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 @deprecated since 8 @useinstead ohos.prompt
export interface ShowToastOptions { /** * Text to display. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ message: string; /** * Duration of toast dialog box. The default value is 1500. * The recommended value ranges from 1500 ms to...
AST#export_declaration#Left export AST#interface_declaration#Left interface ShowToastOptions AST#object_type#Left { /** * Text to display. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left message : AST#type_annotation#Left AST...
export interface ShowToastOptions { message: string; duration?: number; bottom?: string | number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L30-L62
64fe204b41b6514af97e407ea521cd576af9a6ab
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
check
底部复选框配置 @param isChecked 是否默认选中 @param onCheckedChange 选中状态改变回调 @param tips 复选右侧提示文案 @returns
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, tips?: ResourceStr) { this.builderOptions.checkTips = tips this.builderOptions.isChecked = isChecked this.builderOptions.onCheckedChange = onCheckedChange return this; }
AST#method_declaration#Left check AST#parameter_list#Left ( AST#parameter#Left isChecked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onCheckedChange ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, tips?: ResourceStr) { this.builderOptions.checkTips = tips this.builderOptions.isChecked = isChecked this.builderOptions.onCheckedChange = onCheckedChange return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L63-L68
cc357c9a8c53a7341a4699732f9f6d62ef5129c1
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/dust/DustMonitorCard.ets
arkts
getIconText
辅助函数:根据状态返回图标中的文字
private getIconText(status: DustStatus): string { if (status === DustStatus.WARNING) return '!'; return '✔'; // 表示"空气" }
AST#method_declaration#Left private getIconText AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left DustStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
private getIconText(status: DustStatus): string { if (status === DustStatus.WARNING) return '!'; return '✔'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L129-L132
a7bfa53620885211c68bd8305bf2478c6de42c92
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
提醒频率枚举
export enum ReminderFrequency { ONCE = 'once', DAILY = 'daily', WEEKLY = 'weekly', MONTHLY = 'monthly' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ReminderFrequency AST#enum_body#Left { AST#enum_member#Left ONCE = AST#expression#Left 'once' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DAILY = AST#expression#Left 'daily' AST#expression#Right AST#enum_member#Right , AST#enum_memb...
export enum ReminderFrequency { ONCE = 'once', DAILY = 'daily', WEEKLY = 'weekly', MONTHLY = 'monthly' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L275-L280
b8a32e4b239148676389529db78b2c65f4275fd1
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
buttons
弹窗按钮 @param primaryButton 左侧按钮 @param secondaryButton 右侧按钮 @returns
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
AST#method_declaration#Left buttons AST#parameter_list#Left ( AST#parameter#Left primaryButton : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secondaryButton ? : AST#type_annotation#Left AST#primary_type#Left Butto...
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L50-L54
f3350d06951f51471a42d9c415a2643674babc4b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets
arkts
imageAnimation
扫描线动画参数
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, cen...
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function imageAnimation AST#parameter_list#Left ( AST#parameter#Left speed : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right A...
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, cen...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets#L23-L39
f90c881ba631a12684580e620cd8b7c3d366d812
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets
arkts
getDictData
获取字典数据 @param {DictDataRequest} request - 字典查询参数 @returns {Promise<NetworkResponse<DictDataResponse>>} 字典数据
async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> { const resp: AxiosResponse<NetworkResponse<DictDataResponse>> = await NetworkClient.http.post("dict/info/data", request); return resp.data; }
AST#method_declaration#Left async getDictData AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left DictDataRequest 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...
async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> { const resp: AxiosResponse<NetworkResponse<DictDataResponse>> = await NetworkClient.http.post("dict/info/data", request); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets#L37-L41
3f349186c662c08a9ad031b672ced085287e7c3d
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/ImageEditComponent.ets
arkts
ImageEditComponent
图片编辑组件 提供画板、马赛克、裁剪、文字功能 支持独立组件引用
@ComponentV2 export struct ImageEditComponent { @Param @Require option: ImageEditOption; @Provider() imageMatrixOpt: matrix4.Matrix4Transit = matrix4.identity().scale({ x: 1, y: 1 }); @Local contentSize: EditRect = { x: 0, y: 0, width: 0, height: 0 }; @Local angle: number = 0; @Local viewDat...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ImageEditComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right option : AST#type_annotation#Left AST#primar...
@ComponentV2 export struct ImageEditComponent { @Param @Require option: ImageEditOption; @Provider() imageMatrixOpt: matrix4.Matrix4Transit = matrix4.identity().scale({ x: 1, y: 1 }); @Local contentSize: EditRect = { x: 0, y: 0, width: 0, height: 0 }; @Local angle: number = 0; @Local viewDat...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditComponent.ets#L89-L549
3b0eb275c38628f817db89e32e8a80f7e3d99e6f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets
arkts
str2TimeStamp
处理日期格式
function str2TimeStamp(time: string): number { let dateString = time.slice(0, 10); let timeString = time.slice(11, 19); let dateParts = dateString.split('/'); let year = Number(dateParts[0]); let month = Number(dateParts[1]); let day = Number(dateParts[2]); let timeParts = timeString.split(':'); let h...
AST#function_declaration#Left function str2TimeStamp AST#parameter_list#Left ( AST#parameter#Left time : 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 number AST#prima...
function str2TimeStamp(time: string): number { let dateString = time.slice(0, 10); let timeString = time.slice(11, 19); let dateParts = dateString.split('/'); let year = Number(dateParts[0]); let month = Number(dateParts[1]); let day = Number(dateParts[2]); let timeParts = timeString.split(':'); let h...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets#L51-L69
1ade74bf351bdd589f5de917a180526b65db2058
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isWindowSupportWideGamut
判断当前窗口是否支持广色域模式,使用Promise异步回调。 @param windowClass 不传该值,默认主窗口。 @returns
static async isWindowSupportWideGamut(windowClass: window.Window = AppUtil.getMainWindow()): Promise<boolean> { return windowClass.isWindowSupportWideGamut(); }
AST#method_declaration#Left static async isWindowSupportWideGamut AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_exp...
static async isWindowSupportWideGamut(windowClass: window.Window = AppUtil.getMainWindow()): Promise<boolean> { return windowClass.isWindowSupportWideGamut(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L375-L377
5d72f8c7246502b35205535c24cd364ecae6a7fc
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/lifecycle/Lifecycle3View.ets
arkts
Lifecycle3View
@author: HZWei @date: 2024/11/7 @desc:
@Route({ name: RouterConstants.LIFECYCLE3_VIEW }) @Component export struct Lifecycle3View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE3_VIEW} ${this.hash}: ` // 1、初始化生命周期注册对象,用@Lifecycle修饰 @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistr...
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 . LIFECYCLE3_VIEW AS...
@Route({ name: RouterConstants.LIFECYCLE3_VIEW }) @Component export struct Lifecycle3View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE3_VIEW} ${this.hash}: ` @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); @State count...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/Lifecycle3View.ets#L11-L33
910f0266da725c77a4646873c17fc3df4f63f5ef
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
checkAll
执行所有系统检查
static async checkAll(): Promise<SystemCheckAllResult> { const fsResult = await SystemCheckService.checkFileSystem(); const dbResult = await SystemCheckService.checkDatabase(); const agvResult = await SystemCheckService.checkAgv(); const camResult = await SystemCheckService.checkCamera(); const all...
AST#method_declaration#Left static async checkAll 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 SystemCheckAllResult AST#primary_type#Right AST#type_annotation#R...
static async checkAll(): Promise<SystemCheckAllResult> { const fsResult = await SystemCheckService.checkFileSystem(); const dbResult = await SystemCheckService.checkDatabase(); const agvResult = await SystemCheckService.checkAgv(); const camResult = await SystemCheckService.checkCamera(); const all...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L118-L135
1d1ee6372072846d38a9c091ffdf746b091a3e9d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
create
创建session对象 @returns
create(): EfRcp { if (this.efRcp) { this.efRcp.close(); this.efRcp = undefined; } this.efRcp = rcp.createSession(this.cfg); return this; }
AST#method_declaration#Left create AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expressio...
create(): EfRcp { if (this.efRcp) { this.efRcp.close(); this.efRcp = undefined; } this.efRcp = rcp.createSession(this.cfg); return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L100-L107
ef32853b42a5aba15f29368bfc1499ec84368b09
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets
arkts
时间处理工具类
export class TimeUtils { // 毫秒转换为“HH:mm:ss”字符串格式 static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; // 显示两位数判断 let hours = Math.floor(timeMs / (SECONDS_ONE_HOU...
AST#export_declaration#Left export AST#class_declaration#Left class TimeUtils AST#class_body#Left { // 毫秒转换为“HH:mm:ss”字符串格式 AST#method_declaration#Left static msToHHMMSS AST#parameter_list#Left ( AST#parameter#Left timeMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation...
export class TimeUtils { static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND)); let hour...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L19-L103
096d95a739ee88bf13dd2aa9f164a3d460d5f753
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/view/HomeComponent.ets
arkts
onConfirm
confirm clockL
onConfirm(task: TaskInfo) { this.homeStore.taskClock(task).then((res: AchievementInfo) => { if (res.showAchievement) { let achievementLevel = res.achievementLevel; if (achievementLevel) { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel); } else { ...
AST#method_declaration#Left onConfirm AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskInfo 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#...
onConfirm(task: TaskInfo) { this.homeStore.taskClock(task).then((res: AchievementInfo) => { if (res.showAchievement) { let achievementLevel = res.achievementLevel; if (achievementLevel) { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel); } else { ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/view/HomeComponent.ets#L91-L102
ad3df6e9d430792bfddaf9bdaa2ab783f8ab6a02
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets
arkts
获取能力文件
export async function getLocalCapabilities(): Promise<void> { try { let fileData = await backup.getLocalCapabilities(); Logger.info('getLocalCapabilities success'); let fpath = filesDir + '/localCapabilities.json'; fs.copyFileSync(fileData.fd, fpath); // [StartExclude get_local_cap_ability] le...
AST#export_declaration#Left export AST#function_declaration#Left async function getLocalCapabilities AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#prima...
export async function getLocalCapabilities(): Promise<void> { try { let fileData = await backup.getLocalCapabilities(); Logger.info('getLocalCapabilities success'); let fpath = filesDir + '/localCapabilities.json'; fs.copyFileSync(fileData.fd, fpath); let file = fs.openSync(fpath, fs.OpenMode...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets#L39-L62
8768b5b60b652ff553ab8af71838cf770f0ee071
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets
arkts
handle
应用约束7: 使用private关键字代替#私有字段 应用约束10: 显式指定类型参数
handle(packet: any): void { // 需替换any为具体类型,这里保留any用于示例演示 const client = this.packetManager.client; const data = packet.d; // 应用约束21: 使用Map的get方法代替属性访问 const guild = client.guilds.get(data.guild_id); const user = client.users.get(data.user.id); // 应用约束30: 使用as进行类型断言 if (guild && user) client....
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#typ...
handle(packet: any): void { const client = this.packetManager.client; const data = packet.d; const guild = client.guilds.get(data.guild_id); const user = client.users.get(data.user.id); if (guild && user) client.emit(Constants.Events.GUILD_BAN_ADD as string, guild, user); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets#L9-L17
3d69865327fab75dd33b26dfb3303e9996671e26
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildHeader
构建头部统计信息
@Builder buildHeader() { Row() { Column() { Text('周任务时间安排') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`总任务数: ${this.weeklyTaskTimeRangeList.length} | 已完成: ${this.getCompletedCount()} | 进行中: ${this.getInProgressCount()}`) ...
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() { Column() { Text('周任务时间安排') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`总任务数: ${this.weeklyTaskTimeRangeList.length} | 已完成: ${this.getCompletedCount()} | 进行中: ${this.getInProgressCount()}`) ...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L33-L58
feafa8617b19362fd5e04a5509d220826a9cdc7f
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/container/queue_field_sensitive_002_F.ets
arkts
Introduction Queue域敏感
export function queue_field_sensitive_002_F(taint_src : string) { let s = new Queue<string>(); s.add("clean"); s.add(taint_src); taint.Sink(s.getFirst()); }
AST#export_declaration#Left export AST#function_declaration#Left function queue_field_sensitive_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_s...
export function queue_field_sensitive_002_F(taint_src : string) { let s = new Queue<string>(); s.add("clean"); s.add(taint_src); taint.Sink(s.getFirst()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/queue_field_sensitive_002_F.ets#L7-L12
fa6564f859387f40a99a78389235cc0724b330ca
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets
arkts
device info util @since 2024-5-11
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; /** * whether the device type is phone * * @returns true if is phone */ static isPhone(): bool...
AST#export_declaration#Left export AST#class_declaration#Left class DeviceHelper AST#class_body#Left { AST#property_declaration#Left static readonly TYPE_DEFAULT = AST#expression#Left 'default' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TYPE_PHONE = AST#expressio...
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || DeviceHel...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets#L27-L105
e631e46b43345567e49e1ca2b7c436f3fc330263
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets
arkts
getSwiperImages
获取swiper组件图像数据。 @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.ic_swiper1'), $r('app.media.ic_swiper2'), $r('app.media.ic_swiper3'), $r('app.media.ic_swiper4') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.ic_swiper1'), $r('app.media.ic_swiper2'), $r('app.media.ic_swiper3'), $r('app.media.ic_swiper4') ]; return swiperImages; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L26-L34
384a1522357a36c3bd3ed22f2cd3b5afef6f8c9d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets
arkts
updatePersonInfo
更新个人信息 @param {Record<string, unknown>} params - 更新参数 @returns {Promise<NetworkResponse<Unknown>>} 更新结果
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePerson", params); return resp.data; }
AST#method_declaration#Left async updatePersonInfo AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type...
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePerson", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L16-L20
df0e59a4e7805bad891d9e22e5145f17dc455550
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
container type enum
export const enum CONTAINER { FLEX = 'Flex', ROW = 'Row', COLUMN = 'Column', STACK = 'Stack', };
AST#export_declaration#Left export AST#enum_declaration#Left const enum CONTAINER AST#enum_body#Left { AST#enum_member#Left FLEX = AST#expression#Left 'Flex' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ROW = AST#expression#Left 'Row' AST#expression#Right AST#enum_member#Right , AST#enum_member#Lef...
export const enum CONTAINER { FLEX = 'Flex', ROW = 'Row', COLUMN = 'Column', STACK = 'Stack', };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L74-L79
c6a2de3435e416d31e836fb59b6074a25a10b6d6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
窗口管理模型
export default class WindowModel { // 默认的顶部导航栏高度 public static readonly STATUS_BAR_HEIGHT = 38.8; // 默认的底部导航条高度 public static readonly BOTTOM_AVOID_HEIGHT = 10; private constructor() { } // WindowModel 单例 private static instance?: WindowModel; // 键值对 private objects = new Map<string, Object>(); ...
AST#export_declaration#Left export default AST#ERROR#Left class WindowModel { // 默认的顶部导航栏高度 AST#property_declaration#Left public static readonly STATUS_BAR_HEIGHT = AST#expression#Left 38.8 AST#expression#Right ; AST#property_declaration#Right // 默认的底部导航条高度 AST#property_declaration#Left public static readonly BOTTOM_AV...
export default class WindowModel { public static readonly STATUS_BAR_HEIGHT = 38.8; public static readonly BOTTOM_AVOID_HEIGHT = 10; private constructor() { } private static instance?: WindowModel; private objects = new Map<string, Object>(); static getInstance(): WindowModel { if (!...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets#L27-L154
1c647a71f04bf867159a5e0a2a5c01e542f6cbe4
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setEnableCustomYAxisLabels
Set whether to fully use custom labels @param numbers labels
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
AST#method_declaration#Left public setEnableCustomYAxisLabels AST#parameter_list#Left ( AST#parameter#Left enableCustomYAxisLabels : 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#prima...
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L175-L177
ccb6f9fc1030a76059736f834e7664e224d5dcc5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getWeekDay
获取给定的日期是星期几 @returns 周几
static getWeekDay(date: number | string | Date): number { return DateUtil.getFormatDate(date).getDay(); }
AST#method_declaration#Left static getWeekDay 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#Righ...
static getWeekDay(date: number | string | Date): number { return DateUtil.getFormatDate(date).getDay(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L333-L335
627deb4558a014423d9ee4ccb48751d7284228b5
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
generateTransformedValuesCandle
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the CANDLESTICKCHART. @param data @return
public generateTransformedValuesCandle(data: ICandleDataSet, phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] { const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesCand...
AST#method_declaration#Left public generateTransformedValuesCandle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ICandleDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_typ...
public generateTransformedValuesCandle(data: ICandleDataSet, phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] { const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesCand...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L218-L244
6c09c469ee8ca442b4849dd714dba64882c02a82
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
isSM
是否为小断点 @returns {boolean} 是否小断点
isSM(): boolean { return this.current === BreakpointType.SM; }
AST#method_declaration#Left isSM AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AS...
isSM(): boolean { return this.current === BreakpointType.SM; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L97-L99
992f6cb7e3e119457118dafc021f3343ed7e029f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
TODO 正则工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class RegexUtil { /** * 英文字母 、数字和下划线 */ static readonly REG_GENERAL: string = "^\\w+$"; /** * 数字 */ static readonly REG_NUMBERS: string = "^\\d+$"; /** * 字母 */ static readonly REG_WORD: string = "^[a-zA-Z]+$"; /** * 单个中文汉字 * 参照维基百科汉字Unicode范围(https://zh.wikipedia.org/wiki/%...
AST#export_declaration#Left export AST#class_declaration#Left class RegexUtil AST#class_body#Left { /** * 英文字母 、数字和下划线 */ AST#property_declaration#Left static readonly REG_GENERAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\w+$...
export class RegexUtil { static readonly REG_GENERAL: string = "^\\w+$"; static readonly REG_NUMBERS: string = "^\\d+$"; static readonly REG_WORD: string = "^[a-zA-Z]+$"; static readonly REG_CHINESE: string = "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uD...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L25-L278
fb704dfce8aee2fbb3409c23f4ef7d530891bd7a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/Index.ets
arkts
UserState
@file state 模块统一导出 @author Joker.X
export { UserState, getUserState } from "./src/main/ets/UserState";
AST#export_declaration#Left export { UserState , getUserState } from "./src/main/ets/UserState" ; AST#export_declaration#Right
export { UserState, getUserState } from "./src/main/ets/UserState";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/Index.ets#L6-L8
e67ac408b61ef5797dd5edf9e99987a0b8f9c00f
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/EditSchedule.ets
arkts
RepeatIntervalMenu
更改重复周期相关组件绑定的菜单栏。
@Builder private RepeatIntervalMenu(): void { List() { ListItem() { Row() { Image($r('app.media.repeat_daily')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每天') .fontSize(16) .fontWeight(FontWeight...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RepeatIntervalMenu AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left A...
@Builder private RepeatIntervalMenu(): void { List() { ListItem() { Row() { Image($r('app.media.repeat_daily')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每天') .fontSize(16) .fontWeight(FontWeight...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L765-L864
08be5aa63a7f1b9991afee85093ee84af3c3b0ae
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
stop
结束播放 @returns {void}
stop(): void { this.avplayerModel.stop(); }
AST#method_declaration#Left stop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST...
stop(): void { this.avplayerModel.stop(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L237-L239
7492938c64a6524a1ac7782dbebf71c916757ca5
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
Visitor
Visitor 接口 用于实现 Visitor 模式,遍历消息字段
export { Visitor } from './Visitor'
AST#export_declaration#Left export { Visitor } from './Visitor' AST#export_declaration#Right
export { Visitor } from './Visitor'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L37-L37
93b31a84017963a93e18a4d019dbcee470db62e6
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/FileUtil.ets
arkts
getFileExtention
根据文件名获取文件后缀 @param fileName 例如: test.txt test.doc @returns
static getFileExtention(fileName: string) { if (StringUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement...
static getFileExtention(fileName: string) { if (StringUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L177-L182
6b46a623cf1b2f5e94d8f5c66a992c12eb3da4c8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets
arkts
toValuesBucket
Get inserted account data. @return Return account data.
toValuesBucket(): DataRdb.ValuesBucket { return { distributedAccountName: this.distributedAccountName, distributedAccountID: this.distributedAccountID, localId: this.localId }; }
AST#method_declaration#Left toValuesBucket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#retu...
toValuesBucket(): DataRdb.ValuesBucket { return { distributedAccountName: this.distributedAccountName, distributedAccountID: this.distributedAccountID, localId: this.localId }; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets#L42-L48
f2c8e5320922244321d67c38959e910ff6a48421
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
resolveBreakpoint
根据窗口宽度计算断点 @param {number} windowWidthVp - 窗口宽度(vp) @returns {BreakpointType} 断点名称
resolveBreakpoint(windowWidthVp: number): BreakpointType { for (const rule of BREAKPOINT_RULES) { if (windowWidthVp < rule.maxWidthVp) { return rule.name; } } return BreakpointType.LG; }
AST#method_declaration#Left resolveBreakpoint AST#parameter_list#Left ( AST#parameter#Left windowWidthVp : 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 BreakpointType...
resolveBreakpoint(windowWidthVp: number): BreakpointType { for (const rule of BREAKPOINT_RULES) { if (windowWidthVp < rule.maxWidthVp) { return rule.name; } } return BreakpointType.LG; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L76-L83
32235dd6d3dd02ba7e8f07e685eba099aa94f0d1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets
arkts
跑马灯滚动动画属性 @param {number} [iterations] - 动画播放次数。默认播放一次,设置为-1时表示无限次播放。设置为0时表示无动画效果 @param {number} [duration] - 动画持续时间,单位为毫秒 @param {number} [tempo] - 动画播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果 @param {PlayMode} [playMode] - 控制跑马灯向左还是向右滚动。方向向右的时候,文本需要取反,如牌匾 -> 匾牌,这样可以给用户良好的阅读体验 @param {number} [delayTime] - 动画延迟播放时间,单位为ms(毫秒),默认...
export class MarqueeAnimationModifier { iterations: number; duration: number; tempo: number; playMode: PlayMode; delayTime: number; constructor(iterations: number = -1, duration: number = Constants.ANIMATION_DURATION, tempo: number = 1, playMode: PlayMode = PlayMode.Normal, delayTime: number = Constant...
AST#export_declaration#Left export AST#class_declaration#Left class MarqueeAnimationModifier AST#class_body#Left { AST#property_declaration#Left iterations : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#L...
export class MarqueeAnimationModifier { iterations: number; duration: number; tempo: number; playMode: PlayMode; delayTime: number; constructor(iterations: number = -1, duration: number = Constants.ANIMATION_DURATION, tempo: number = 1, playMode: PlayMode = PlayMode.Normal, delayTime: number = Constant...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets#L53-L68
bb99e3c3bd712b359539ed456c5635f47b289159
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets
arkts
VideoThumbListView
时间轴小图展示
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; build() { Column() { List() { // 需要展示全部的视频每秒的小图,不需要使用LazyForEach ForEach(this.mVideoThumbOption.videoThumbs, (item:ThumbContent) => { ListItem() { Image(item.pixelMap ? item.pixe...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoThumbListView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_...
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; build() { Column() { List() { ForEach(this.mVideoThumbOption.videoThumbs, (item:ThumbContent) => { ListItem() { Image(item.pixelMap ? item.pixelMap : item.framePlaceholder) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets#L29-L57
49c171ed5d921ea4a72636008e1066aca78310fa
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets
arkts
jumpToAdvertisingPage
Jump to advertising page.
jumpToAdvertisingPage(): void { this.timerId = setTimeout(() => { this.isJumpToAdvertising = true; router.pushUrl({ url: CommonConstants.ADVERTISING_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(...
AST#method_declaration#Left jumpToAdvertisingPage 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 ...
jumpToAdvertisingPage(): void { this.timerId = setTimeout(() => { this.isJumpToAdvertising = true; router.pushUrl({ url: CommonConstants.ADVERTISING_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets#L74-L83
dfdd8779d9cb8f3fa43127391e4bb24d879ffcce
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets
arkts
CardSwiperComponent
功能描述: 1. 卡片组件滚动切换,展示缩略图缩略图,两侧展示偏移量为 swiperMargin 的上一页和下一页的缩略图(缩放为原始缩略图的80%) 2. 卡片滑动时组件跟手对应的图片缩放,滑入的图片放大至缩略图的原始大小,滑出的图片缩小至原始大小的80% 3. 卡片滑动手指释放时根据 index 变化,展示对应 index 的子组件(图片) 4. 边缘渐变开启时,滑动边缘为渐变白色 5. 背景渐变开启时,背景色为图片主题渐变色 实现原理: 1. 卡片基于Swiper组件实现容器视图居中完全展示,两边等长露出,并且跟手滑动缩放效果 2. 通过onGestureSwiper、onAnimationStart、onChange回调实...
@Component export struct CardSwiperComponent { // 初始化数据列表 (可以传入本地图片资源或者网络图片地址) initCardsList: CardInfo[] = []; // 是否开启边缘渐变 isEdgeFading: boolean = true; // 是否开启背景跟随主题色转换 isBackgroundColorChange: boolean = true; // 是否开启预览大图 isShowPreviewImage: boolean = true; // 边缘渐变起始和终止颜色 @State private linearGrad...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CardSwiperComponent AST#component_body#Left { // 初始化数据列表 (可以传入本地图片资源或者网络图片地址) AST#property_declaration#Left initCardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] AST#array_typ...
@Component export struct CardSwiperComponent { initCardsList: CardInfo[] = []; isEdgeFading: boolean = true; isBackgroundColorChange: boolean = true; isShowPreviewImage: boolean = true; @State private linearGradientBeginColor: string = Constants.BEGIN_COLOR; @State private linearGradientEndC...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets#L47-L307
bd2e4fe5cdce7d8c5df745f721db82ef49641bc3
gitee
magongshou/harmony-cordova
4b26bb5eeb3a9fd8ceb40165e6ac98b244474ee6
oh_modules/.ohpm/@magongshou+harmony-cordova@1.3.1/oh_modules/@magongshou/harmony-cordova/src/main/ets/components/PluginResult.d.ets
arkts
将Cordova消息状态枚举值转换为文字描述 @param status 状态枚举 @returns 状态描述
export declare function convertMessageStatusDesc(status: MessageStatus): string; export declare class PluginResult { private readonly status; private readonly messageType; private keepCallback; private readonly message; private readonly multipartMessages; constructor(status: MessageStatus, type:...
AST#export_declaration#Left export AST#ERROR#Left declare function convertMessageStatusDesc AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota...
export declare function convertMessageStatusDesc(status: MessageStatus): string; export declare class PluginResult { private readonly status; private readonly messageType; private keepCallback; private readonly message; private readonly multipartMessages; constructor(status: MessageStatus, type:...
https://github.com/magongshou/harmony-cordova/blob/4b26bb5eeb3a9fd8ceb40165e6ac98b244474ee6/oh_modules/.ohpm/@magongshou+harmony-cordova@1.3.1/oh_modules/@magongshou/harmony-cordova/src/main/ets/components/PluginResult.d.ets#L65-L88
8ce9541c55f3041e7eeeed2743e160022f4c635b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets
arkts
finishPlayCallback
设置播放完成监听。
async finishPlayCallback() { this.soundPool!.on('playFinished', () => { console.info('receive play finished message'); // 可进行下次播放。 }) }
AST#method_declaration#Left async finishPlayCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left ...
async finishPlayCallback() { this.soundPool!.on('playFinished', () => { console.info('receive play finished message'); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets#L91-L96
690ccee6c314fb19479a135075033bd36fa46dc3
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--升级中 @since 2022-06-10
export class Upgrading extends Installing { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.UPGRADING; this.percent = 100; this.isButtonClickable = false; this.downloadStateText = $r(...
AST#export_declaration#Left export AST#class_declaration#Left class Upgrading extends AST#type_annotation#Left AST#primary_type#Left Installing AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#blo...
export class Upgrading extends Installing { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.UPGRADING; this.percent = 100; this.isButtonClickable = false; this.downloadStateText = $r(...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L592-L606
d2a419aabe73ba299a858769e83b2a4ab0f0b712
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MainPage.ets
arkts
tabBarItem
Tabs 的底部导航项 @param {number} index - 索引 @returns {void} 无返回值
@Builder private tabBarItem(index: number) { ColumnCenter() { Lottie({ loop: false, autoPlay: this.vm.currentPageIndex === index, controller: this.vm.lottieControllers[index], animationData: this.vm.tabItems[index].animationData }) .attributeModifier(size(bp({ ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private tabBarItem 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_...
@Builder private tabBarItem(index: number) { ColumnCenter() { Lottie({ loop: false, autoPlay: this.vm.currentPageIndex === index, controller: this.vm.lottieControllers[index], animationData: this.vm.tabItems[index].animationData }) .attributeModifier(size(bp({ ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MainPage.ets#L96-L125
b7a5405fb02c3f214c6013181c44a2ddc6805a79
github
Leeson-Wong/ark-layer.git
9efa3553414a6b1eee890e3858c8cdcb308535d7
core/PhaseConfig.ets
arkts
阶段比较器 用于排序阶段列表
export function comparePhases(a: Phase, b: Phase): number { return a.priority - b.priority }
AST#export_declaration#Left export AST#function_declaration#Left function comparePhases AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left Phase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary...
export function comparePhases(a: Phase, b: Phase): number { return a.priority - b.priority }
https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseConfig.ets#L48-L50
13e1f61aed935f5502c365d2c121471aa3848c08
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
arkts
initCompressFile
将待压缩文件写入到应用沙箱目录 @param compressZipName 待压缩文件所处路径 @returns
initCompressFile(beCompressFileDir: string): void { //获取rawfile下的所有待压缩文件名 this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`, ...
AST#method_declaration#Left initCompressFile AST#parameter_list#Left ( AST#parameter#Left beCompressFileDir : 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#pr...
initCompressFile(beCompressFileDir: string): void { this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`, (error: Busine...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L108-L139
3cbf2ac68d383c44bd1f0e6113a3850770565a54
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets
arkts
CourseItem
每个分类的内容主体
@Builder CourseItem(item: BookSourcePart, i: number, j: number) { Column() { Row() { Text(item.bookSourceName) .fontSize(16) .lineHeight(24) .fontWeight(FontWeight.Medium) .textOverflow({ overflow: TextOverflow.Ellipsis, }) .max...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CourseItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left BookSourcePart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left i : AST#type_annotation#Left...
@Builder CourseItem(item: BookSourcePart, i: number, j: number) { Column() { Row() { Text(item.bookSourceName) .fontSize(16) .lineHeight(24) .fontWeight(FontWeight.Medium) .textOverflow({ overflow: TextOverflow.Ellipsis, }) .max...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets#L801-L955
7d869ad62964de483e9e2eb5874418cd3bea1a29
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/pages/WatchVodPage.ets
arkts
onStartAnnouncement
@description 获取公告
onStartAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('获取公告:', msgModel) }
AST#method_declaration#Left onStartAnnouncement AST#parameter_list#Left ( AST#parameter#Left msgModel ? : AST#type_annotation#Left AST#primary_type#Left VHAnnouncementMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_s...
onStartAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('获取公告:', msgModel) }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/WatchVodPage.ets#L155-L157
e81a22832b7a88e095d53633e3d2e8c704e28c68
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/objects/ExtWebNode.ets
arkts
update
Update?
update(ext: extension) { if (this.builderNode) { try { this.builderNode.update(ext); console.log(`[WebNode][update] ext.storage.get('my_window_id')=${ext.storage?.get('my_window_id') as string}`); } catch (e) { console.error(`[WebNode][update] Failed: ${e}!`); } } }
AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left ext : AST#type_annotation#Left AST#primary_type#Left extension 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#Left if ( AST#expr...
update(ext: extension) { if (this.builderNode) { try { this.builderNode.update(ext); console.log(`[WebNode][update] ext.storage.get('my_window_id')=${ext.storage?.get('my_window_id') as string}`); } catch (e) { console.error(`[WebNode][update] Failed: ${e}!`); } } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/ExtWebNode.ets#L96-L105
c74b278e469c32774b7cca0b1838a191a6957da2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/utils/FunctionDescription.ets
arkts
FunctionDescription
模块功能描述组件 @param title 标题 @param context 内容
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.secondarylinkage_text_size_headline')) .fontWeight(FontWeight.Medium) .textOver...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FunctionDescription AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#...
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.secondarylinkage_text_size_headline')) .fontWeight(FontWeight.Medium) .textOver...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/utils/FunctionDescription.ets#L21-L47
b13ed137856c393c8fd1049846e505a3ccc2675b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
resetTracking
RESET PERFORMANCE TRACKING FIELDS
public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; }
AST#method_declaration#Left public resetTracking 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 A...
public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L432-L435
bbc037bd5f297182419d674911ae3412eae79968
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/DashboardPage.ets
arkts
buildTabContent
构建标签内容
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildOverviewTab(); break; case 1: this.buildReportsTab();
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#L...
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildOverviewTab(); break; case 1: this.buildReportsTab();
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/DashboardPage.ets#L324-L331
263bc9977c37cdc624bf2680815f8da850199f30
github
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/pages/LoginPage.ets
arkts
imageButton
图片按钮 @param src 图片url
@Builder imageButton(src: Resource) { Button({ type: ButtonType.Circle, stateEffect: true }) { Image(src) } .width($r('app.float.other_login_image_size')) .height($r('app.float.other_login_image_size')) .backgroundColor($r('app.color.background')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right imageButton AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Le...
@Builder imageButton(src: Resource) { Button({ type: ButtonType.Circle, stateEffect: true }) { Image(src) } .width($r('app.float.other_login_image_size')) .height($r('app.float.other_login_image_size')) .backgroundColor($r('app.color.background')) }
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/pages/LoginPage.ets#L52-L62
a4a19f2a1d6e3edc08b6e154b4b6d3a229b20e94
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppDefines.ets
arkts
export const dWrongFlag = "\u274c";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dWrongFlag = AST#expression#Left "\u274c" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const dWrongFlag = "\u274c";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppDefines.ets#L64-L64
09380700a76edcbd3c9a1ef3088ee7b272f5ebc0
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class TimeTableDataSource implements IDataSource { private list: TimeTable[] = []; private listeners: DataChangeListener[] = []; constructor(list: TimeTable[]) { this.list = list; } totalCount(): number { return this.list.length; } getData(index: number): TimeTable { return this.list...
AST#export_declaration#Left export AST#class_declaration#Left class TimeTableDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TimeTable [ ] AST#ar...
export class TimeTableDataSource implements IDataSource { private list: TimeTable[] = []; private listeners: DataChangeListener[] = []; constructor(list: TimeTable[]) { this.list = list; } totalCount(): number { return this.list.length; } getData(index: number): TimeTable { return this.list...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets#L15-L75
ad4622eaf563b13227ccf667ede8a0ca4a2de81a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
convertPemPubKeyFromStr
将非对称加密pem格式字符串pubKey转换为symKey对象 @param publicKey字符串key-pem格式 @param symAlgName 秘钥规格 @returns
static convertPemPubKeyFromStr(publicKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(publicKey, null); return symKey; }
AST#method_declaration#Left static convertPemPubKeyFromStr AST#parameter_list#Left ( AST#parameter#Left publicKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left ...
static convertPemPubKeyFromStr(publicKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(publicKey, null); return symKey; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L50-L54
c86bb363ede401b8390673dc06d4b451f37542dc
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/select/selectOnSelect.ets
arkts
SelectOnSelectBuilder
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 SelectOnSelectBuilder(name: string, param: Object) { OnSelectExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectOnSelectBuilder 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 SelectOnSelectBuilder(name: string, param: Object) { OnSelectExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectOnSelect.ets#L16-L19
271b7ebddaea80bfe3dfb61e931fc371b170b786
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
concatDate
Modify the format of the year, month, and day @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/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L62-L64
6f9932f9fcb12473b346e27d703cb6583e4917a3
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setSpaceMax
Sets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
public setSpaceMax(mSpaceMax: number): void { this.mSpaceMax = mSpaceMax; }
AST#method_declaration#Left public setSpaceMax AST#parameter_list#Left ( AST#parameter#Left mSpaceMax : 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_...
public setSpaceMax(mSpaceMax: number): void { this.mSpaceMax = mSpaceMax; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L823-L825
45b5c9f7e72560d78c86a7a17071ab182972f819
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
用户ID接口
export interface UserIdParam { id: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserIdParam AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right ...
export interface UserIdParam { id: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L73-L75
7b88003d2cf65c419bd2a34f97744ba1e3b45fc7
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets
arkts
CommonItemInput
TextInput of change panel @param inputValue change inputValue
@Component export struct CommonItemInput { @Link inputValue: string; private name: Resource = $r('app.string.divider_color_blue'); private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.place...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
@Component export struct CommonItemInput { @Link inputValue: string; private name: Resource = $r('app.string.divider_color_blue'); private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.place...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L235-L259
9dff7951e5da42fcff2d97c4f71645555498399b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
openSync
打开文件,支持使用URI打开文件。以同步方法。 @param path string 文件的应用沙箱路径或URI。 @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 @returns
static openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); }
AST#method_declaration#Left static openSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
static openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L115-L117
e08a4af64cd2e3a6dee5ffe3ed0904d5227c8e00
gitee
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectDevice.ets
arkts
toControlPage
跳转的设备页面
private toControlPage(deviceId: string) { getControlPage.getDeviceControlPage(deviceId,true) }
AST#method_declaration#Left private toControlPage AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left A...
private toControlPage(deviceId: string) { getControlPage.getDeviceControlPage(deviceId,true) }
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectDevice.ets#L127-L129
581aa595103f90e6139a99fa7aa17e4f399a603a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets
arkts
calcImageDefaultSize
根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 @param imageWHRatio:图片原始宽高比 @param size:窗口大小{with:number,height:number} @returns image.Size
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width = 0 let height = 0; if (imageWHRatio > windowSize.width / windowSize.height) { // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 width = windowSize.width; height = windowSize.width / imageWHRatio; } else { he...
AST#method_declaration#Left calcImageDefaultSize AST#parameter_list#Left ( AST#parameter#Left imageWHRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowSize : AST#type_annotation#Left AST#primary_type#Left AST#qua...
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width = 0 let height = 0; if (imageWHRatio > windowSize.width / windowSize.height) { width = windowSize.width; height = windowSize.width / imageWHRatio; } else { height = windowSize.height; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L113-L125
128ea1c984c389cb8edc4dbd4bbbc5da5aa893b7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isSet
检查是否为Set类型。 @param value @returns
static isSet(value: Object): boolean { return new util.types().isSet(value); }
AST#method_declaration#Left static isSet AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri...
static isSet(value: Object): boolean { return new util.types().isSet(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L116-L118
672c0d85740618ac66989d8159528bca6e24a64c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
release
释放朗读控件的所有资源。 @returns
static async release(): Promise<void> { return TextReader.release(); }
AST#method_declaration#Left static async release AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
static async release(): Promise<void> { return TextReader.release(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L85-L87
572459a1b6be7d9919b1e961e963659478f77874
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AddBill.ets
arkts
NumberButton
数字按钮组件
@Builder NumberButton(text: string) { Column() { Text(text) .fontSize(20) .fontColor('#333333') .fontWeight(FontWeight.Medium) } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1, right: 1 }, colo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NumberButton AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Le...
@Builder NumberButton(text: string) { Column() { Text(text) .fontSize(20) .fontColor('#333333') .fontWeight(FontWeight.Medium) } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1, right: 1 }, colo...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L307-L330
31970bf7b3b16ad90430b883625216b67dd4ab4d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.DialogV2.d.ets
arkts
Declare the options of AdvancedDialogV2Button @interface AdvancedDialogV2ButtonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare interface AdvancedDialogV2ButtonOptions { /** * Sets the Display Content of a Button. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ content: ResourceStr; /** * Sets the Button Callback. * * @t...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface AdvancedDialogV2ButtonOptions AST#object_type#Left { /** * Sets the Display Content of a Button. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * ...
export declare interface AdvancedDialogV2ButtonOptions { content: ResourceStr; action?: AdvancedDialogV2ButtonAction; background?: ColorMetrics; fontColor?: ColorMetrics; buttonStyle?: ButtonStyleMode; role?: ButtonRole; defaultFocus?: boolean; enabled?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L156-L241
e059237587704703b47e9167ddbbd51076aa3f91
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Infers the id of window. @param idx The window index (number).
export function window_id_at_index(idx: number) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[idx]; return window_id; }
AST#export_declaration#Left export AST#function_declaration#Left function window_id_at_index AST#parameter_list#Left ( AST#parameter#Left idx : 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 {...
export function window_id_at_index(idx: number) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[idx]; return window_id; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L522-L526
ace3a743e42db85c74887fc2ed2398f40e9725b5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
saveTrustedPhotoAssets
Save the photo assets of uris. @param { Array<string> } trustedUris - Uris need to be saved @param { AsyncCallback<Array<string>> } callback - Returns the uri list @param { Array<PhotoCreationConfig> } [configs] - Photo asset creation configs @param { SaveMode } [saveMode] - Mode of save @syscap SystemCapability.FileM...
saveTrustedPhotoAssets(trustedUris: Array<string>, callback: AsyncCallback<Array<string>>, configs?: Array<photoAccessHelper.PhotoCreationConfig>, saveMode?: SaveMode): void;
AST#method_declaration#Left saveTrustedPhotoAssets AST#parameter_list#Left ( AST#parameter#Left trustedUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#...
saveTrustedPhotoAssets(trustedUris: Array<string>, callback: AsyncCallback<Array<string>>, configs?: Array<photoAccessHelper.PhotoCreationConfig>, saveMode?: SaveMode): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L324-L325
182ec9ca7ac24bf2caaaedd430679e3ecddd53ce
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/common/utils/AudioService.ets
arkts
getPlayMode
@returns
public getPlayMode() { return this._shareData.playMode; }
AST#method_declaration#Left public getPlayMode 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right ....
public getPlayMode() { return this._shareData.playMode; }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/utils/AudioService.ets#L49-L51
291edf73b8c029245bc0b64d5922e70b30684b9a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
createDefaultSettings
创建默认设置 @returns 默认设置
private createDefaultSettings(): AppSettings { const now: string = new Date().toISOString(); const defaultThemeSettings: ThemeSettings = { mode: ThemeMode.AUTO, primaryColor: '#007AFF', accentColor: '#FF9500', customColors: {}, animationEnabled: true, animationDuration: 300,...
AST#method_declaration#Left private createDefaultSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_decl...
private createDefaultSettings(): AppSettings { const now: string = new Date().toISOString(); const defaultThemeSettings: ThemeSettings = { mode: ThemeMode.AUTO, primaryColor: '#007AFF', accentColor: '#FF9500', customColors: {}, animationEnabled: true, animationDuration: 300,...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L632-L752
b4b354e1beb948516bef8308057b627f188f3451
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
窗口呈现
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent( "pages/Index", (err) => { if (err.code) { return; } }); }
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent( "pages/Index", (err) => { if (err.code) { return; } }); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets#L17-L24
aefd938924f379ee340901359ba49f211d841ede
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
convertSM2PriKey
将服务器端生成的16进制的长度为64位的C1C3C2格式的SM2私钥转换为前端所需的ASN.1格式SM2私钥字符串 @param priKey 16进制的64位的私钥字符串 @returns 转换后的私钥字符串
static async convertSM2PriKey(priKey: string): Promise<string> { if (priKey.length != 64) { return '服务器端SM2私钥长度不正确~'; } //构建SM2私钥参数对象 let keyPair: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), algName: 'SM2', sk: BigInt('0...
AST#method_declaration#Left static async convertSM2PriKey AST#parameter_list#Left ( AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
static async convertSM2PriKey(priKey: string): Promise<string> { if (priKey.length != 64) { return '服务器端SM2私钥长度不正确~'; } let keyPair: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), algName: 'SM2', sk: BigInt('0x' + priKey),...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L113-L130
f7230796b1483b2291291a2f05ca27cf48564db0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
transform
V1新老版本字段转换逻辑 @param resultSet 查询结果集 @param targetVersion 目标版本 @returns 目标版本格式数据
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: return this.transformV1ToV2(resultSet); case Constants.V3: return this.transformV1ToV3(resultSet); default: { throw new Error('The database ver...
AST#method_declaration#Left transform AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetVersi...
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: return this.transformV1ToV2(resultSet); case Constants.V3: return this.transformV1ToV3(resultSet); default: { throw new Error('The database ver...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L96-L104
76cc690d1f1d0358e72fd0c3c2666b122c7bed22
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/DateHelper.ets
arkts
hasMinute
是否含有分
static hasMinute(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.Hms || type == DateType.Hm || type == DateType.Ms; }
AST#method_declaration#Left static hasMinute AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
static hasMinute(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.Hms || type == DateType.Hm || type == DateType.Ms; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L78-L81
b21ede6f2c060f471fee19d54d24ac23a8788303
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets
arkts
常量
export default class Constants { // 月份数组 public static readonly MONTHS: string[] = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']; // 星期 public static readonly WEEKS: string[] = ['日', '一', '二', '三', '四', '五', '六']; // 农历月份的中文表示 public static readonly CHINESE_MONTH: string[] ...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 月份数组 AST#property_declaration#Left public static readonly MONTHS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#...
export default class Constants { public static readonly MONTHS: string[] = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']; public static readonly WEEKS: string[] = ['日', '一', '二', '三', '四', '五', '六']; public static readonly CHINESE_MONTH: string[] = ['正', '二', '三', '四...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets#L19-L108
b48592aff358a41f85525d98c77df788a73873f2
gitee
qwerguai/ArkTSComponents.git
58ac77d9686670d79ba7421d71e68f31870aacd5
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSettingListData
Get data of the setting list. @return {Array<PageResource>} settingListData.
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r('app.media.news'), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_menu'), $r('app.media.menu')), new ItemData($r('app.string.setting_list_stor...
AST#method_declaration#Left getSettingListData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r('app.media.news'), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_menu'), $r('app.media.menu')), new ItemData($r('app.string.setting_list_stor...
https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/viewmodel/MainViewModel.ets#L79-L87
b9164848c609bb63f77b6430b714d68d2c8d02a5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/social/SearchPage.ets
arkts
buildSearchTypes
构建搜索类型选择
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width('16vp') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTypes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressio...
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width('16vp') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L168-L217
511f3a203e1918e40c57d26c08c1026045b5b44d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/TextOverflowPage.ets
arkts
publishComment
发布评论
publishComment(): void { // 生成评论id const uuid: string = util.generateRandomUUID(); // 添加一条评论,包含评论id、头像、昵称、回复id、回复昵称、回复文本 const comment: CommentModel = new CommentModel(uuid, $r('app.media.user_select'), this.curUser, this.replyId, this.replyUser, this.textInComment, new Date(), new Comment...
AST#method_declaration#Left publishComment 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 { // 生成评论id AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ...
publishComment(): void { const uuid: string = util.generateRandomUUID(); const comment: CommentModel = new CommentModel(uuid, $r('app.media.user_select'), this.curUser, this.replyId, this.replyUser, this.textInComment, new Date(), new CommentData()); const parentComment = this.c...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/TextOverflowPage.ets#L80-L113
e19e9519174e842a43cc8fea11d8d54c10d81e82
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/crypto/huksUtils.ets
arkts
Key Storage Policy
export const PARAMS_IN_HUKS: PurposeParams = [{ tag: huks.HuksTag.HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG, value: huks.HuksKeyStorageType.HUKS_STORAGE_ONLY_USED_IN_HUKS, }];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PARAMS_IN_HUKS : AST#type_annotation#Left AST#primary_type#Left PurposeParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { ...
export const PARAMS_IN_HUKS: PurposeParams = [{ tag: huks.HuksTag.HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG, value: huks.HuksKeyStorageType.HUKS_STORAGE_ONLY_USED_IN_HUKS, }];
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/crypto/huksUtils.ets#L53-L56
57d01b5a0a6601861793d34a319fd7fea46d2937
github
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
queryCommodityListById
Query commodity list by id of commodity. @param id id of commodity @returns Commodity
queryCommodityListById(id: string) { const result = commodityData.filter(item => item.id === id)[0]; return result; }
AST#method_declaration#Left queryCommodityListById 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#block_statement#Left { AST#statement#Left AST#variable_declaratio...
queryCommodityListById(id: string) { const result = commodityData.filter(item => item.id === id)[0]; return result; }
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L43-L46
0d6119dfcd25646322951f2ed00baa16b07c55b8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment2.ets
arkts
[StartExclude Case2]
build() { Column() { } }
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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#...
build() { Column() { } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment2.ets#L46-L49
9dc4ee315a85e76cee36541ccb671790d5fc3ac2
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
TabBarBuilder
构建头部
@Builder TabBarBuilder(title: string, index: number) { Column() { Text(title) .fontSize(16) .fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.currentTabIndex === index ? $r('app.color.primary') : $r('app.color.text_secondary')) } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBarBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left...
@Builder TabBarBuilder(title: string, index: number) { Column() { Text(title) .fontSize(16) .fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.currentTabIndex === index ? $r('app.color.primary') : $r('app.color.text_secondary')) } ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L471-L482
8e390bc47e5ba64baec7b95449af17a96de62b92
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
/ AssetStore 操作结果
export interface AssetStoreResult { isSuccess: boolean; error?: BusinessError; data?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AssetStoreResult AST#object_type#Left { AST#type_member#Left isSuccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left error ? : AST#type_ann...
export interface AssetStoreResult { isSuccess: boolean; error?: BusinessError; data?: string; }
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L7-L11
e8888b8c8fb0bf7c110db8bb8dc3f560f913fa94
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件。 @param {number} index - 索引值。
notifyDataAdd(index: double): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
notifyDataAdd(index: double): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L108-L112
ee3f080556387616c48688777614066e25bbc9e3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
notifyDataDelete
Notify the LazyForEach component to remove the child component at the index corresponding to the specified index.
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L67-L71
3a286d103bfef6dcc0233fdf30ed585bf2f180a8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets
arkts
constrainOffset
约束图片偏移,确保不超出视口边界 @param offset -- 当前偏移量 @param winSize -- 视口大小 @param imageSize -- 图片大小 @param scale -- 缩放
function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset); }
AST#function_declaration#Left function constrainOffset AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left winSize : AST#type_annotation#Left AST#primary_type#Left number AST...
function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets#L77-L80
0b6a322c545add9df5df852b75873128d5d303ca
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
getResourceItemAndState
get resource information according to resource id @param index - array position @param count - array length @param data - data
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.g...
AST#method_declaration#Left async getResourceItemAndState AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST...
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.g...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L165-L202
ae3a2ff9e63a36f58bcf4c90d17f916a49981b3d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets
arkts
onPlayingChange
媒体最大音量
onPlayingChange() { this.player.isPlaying ? this.player.getPlay() : this.player.getPause(); if (this.player.isPlaying === false) { PipManager.getInstance().setAutoStart(false); } else { PipManager.getInstance().setAutoStart(true); PipManager.getInstance().updatePiPControlStatus(); } ...
AST#method_declaration#Left onPlayingChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left A...
onPlayingChange() { this.player.isPlaying ? this.player.getPlay() : this.player.getPause(); if (this.player.isPlaying === false) { PipManager.getInstance().setAutoStart(false); } else { PipManager.getInstance().setAutoStart(true); PipManager.getInstance().updatePiPControlStatus(); } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets#L74-L82
48648b1cbe4de9adea7aa8e8c3abe0e94f8c6d33
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildTaskList
构建任务列表
@Builder buildTaskList() { if (this.weeklyTaskTimeRangeList.length === 0) { this.buildEmptyState() } else { Scroll() { Column() { ForEach(this.weeklyTaskTimeRangeList, (item: TaskTimeRange, index: number) => { TaskTimeRangeItem({ taskItem: item, index: index }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTaskList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression...
@Builder buildTaskList() { if (this.weeklyTaskTimeRangeList.length === 0) { this.buildEmptyState() } else { Scroll() { Column() { ForEach(this.weeklyTaskTimeRangeList, (item: TaskTimeRange, index: number) => { TaskTimeRangeItem({ taskItem: item, index: index }) ...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L84-L98
26fe972a793a41ab1fd66f067d135acc7ce7955f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
putAcceptCookieEnabled
设置WebCookieManager实例是否拥有发送和接收cookie的权限。 @param accept 设置是否拥有发送和接收cookie的权限,默认为true。
static putAcceptCookieEnabled(accept: boolean): void { webview.WebCookieManager.putAcceptCookieEnabled(accept); }
AST#method_declaration#Left static putAcceptCookieEnabled AST#parameter_list#Left ( AST#parameter#Left accept : 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...
static putAcceptCookieEnabled(accept: boolean): void { webview.WebCookieManager.putAcceptCookieEnabled(accept); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L154-L156
a5d73da85ccab38fd3240a2fffa92b480c510ec9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/ListSceneView.ets
arkts
ListSceneView
列表默认间隔 实现List场景,拖拽交换子组件位置: 通过ListItem的onDragStart()方法指定拖拽开始时的行为,通过List的onTouch()指定拖拽释放时的行为。
@Component export struct ListSceneView { @State dataSource: DataSource = new DataSource(); @State dragIndex: number = 0; aboutToAppear() { for (let index = 0; index < ICON_NUM_IN_LIST; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`), ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left DataSource AST#primary_type#Right AST#ty...
@Component export struct ListSceneView { @State dataSource: DataSource = new DataSource(); @State dragIndex: number = 0; aboutToAppear() { for (let index = 0; index < ICON_NUM_IN_LIST; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`), ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/ListSceneView.ets#L25-L99
e4c346f910c3c26efb9d78bfe9389272c4bd7528
gitee