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
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdCardUtil.ets
arkts
getCityCodeByIdCard
根据身份编号获取地市级编码,只支持15或18位身份证号码 @param idCard 身份编码 @return 省份编码
static getCityCodeByIdCard(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } let len = idCard.length; if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) { let city = IdCardUtil.CITY_CODES.get(idCard.substring(0,...
AST#method_declaration#Left static getCityCodeByIdCard AST#parameter_list#Left ( AST#parameter#Left idCard : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_...
static getCityCodeByIdCard(idCard: string): OutDTO<string> { if (IdCardUtil.PROVINCE_CODES.size == 0) { IdCardUtil.init(); } let len = idCard.length; if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) { let city = IdCardUtil.CITY_CODES.get(idCard.substring(0,...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L257-L271
43ecfccdfa4d91bb11867b1b12375f4039eeb58c
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
ImageDialogBuilder
水平布局 弹窗按钮 @param confirmBtn @param cancelBtn
@Builder export function ImageDialogBuilder(options: IImageDialogOptions) { ImageDialogView({ options: options }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ImageDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IImageDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p...
@Builder export function ImageDialogBuilder(options: IImageDialogOptions) { ImageDialogView({ options: options }) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L311-L314
b034eaaa422a0996f6d168da5c7431c42ca9c6b1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
customTabs
自定义Tabs
@Builder customTabs() { Tabs({ controller: this.controller }) { // 省列表 TabContent() { List() { ForEach(this.provinceList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Province, item) }.onClick(() => { //...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTabs 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 Tabs ( AST#component_parameters#Left { AST#component_parameter#...
@Builder customTabs() { Tabs({ controller: this.controller }) { TabContent() { List() { ForEach(this.provinceList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Province, item) }.onClick(() => { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L306-L506
6969f89d835df78d79ad6fc8033dc69a8684fbaf
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
addPaletteRecord
添加画笔记录 @param paletteData 画笔记录
addPaletteRecord(paletteData: PaletteData): void { this.addRecord({ data: paletteData, type: ImageEditFunctionType.PALETTE }); }
AST#method_declaration#Left addPaletteRecord AST#parameter_list#Left ( AST#parameter#Left paletteData : AST#type_annotation#Left AST#primary_type#Left PaletteData 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#pri...
addPaletteRecord(paletteData: PaletteData): void { this.addRecord({ data: paletteData, type: ImageEditFunctionType.PALETTE }); }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L90-L95
dca4cddcb23892cfaf31e99dd2cb4f37512d2e07
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/user/User.ets
arkts
/用于Http提交时的Param
export class UserCodingKeys { static readonly userId = "user_id"; static readonly userName = "user_name"; static readonly email = "email"; static readonly password = "password"; static readonly loginType = "login_type"; static readonly loginIdentifier = "login_identifi...
AST#export_declaration#Left export AST#class_declaration#Left class UserCodingKeys AST#class_body#Left { AST#property_declaration#Left static readonly userId = AST#expression#Left "user_id" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly userName = AST#expression#Left...
export class UserCodingKeys { static readonly userId = "user_id"; static readonly userName = "user_name"; static readonly email = "email"; static readonly password = "password"; static readonly loginType = "login_type"; static readonly loginIdentifier = "login_identifi...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/User.ets#L32-L48
23320e5804853be3508529f28c504e4f722f20f2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets
arkts
createAudioFile
创建音频文件 @returns FileAsset
async createAudioFile(): Promise<userFileManager.FileAsset> { let suffix = '.m4a'; let dateTimeUtil = new DateTimeUtil(); let name = `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}`; let displayName = `${name}${suffix}`; Logger.info(TAG, `createAudioFile displayName=${displayName}`); let fi...
AST#method_declaration#Left async createAudioFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userFileManager . FileAsset AST#qualified...
async createAudioFile(): Promise<userFileManager.FileAsset> { let suffix = '.m4a'; let dateTimeUtil = new DateTimeUtil(); let name = `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}`; let displayName = `${name}${suffix}`; Logger.info(TAG, `createAudioFile displayName=${displayName}`); let fi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets#L53-L62
a7beeb644dd5f310511f332f6c59df6eaf04dff6
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_tabs_count
Data Syncing Returns the number of currently opened tabs @returns A number.
get_tabs_count() { return this.Tabs.length; }
AST#method_declaration#Left get_tabs_count 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 . Tab...
get_tabs_count() { return this.Tabs.length; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L498-L500
178a471ca0d72bd924f8a7220d206c9306c4aa62
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/MultiDeviceMusic/features/content/src/main/ets/viewmodel/SongDataSource.ets
arkts
id
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export type SongItem = { id: number, title: string, singer: string, label: Resource }
AST#export_declaration#Left export AST#ERROR#Left type SongItem = AST#ERROR#Right { id AST#ERROR#Left : number AST#ERROR#Right , title AST#ERROR#Left : string AST#ERROR#Right , singer AST#ERROR#Left : string AST#ERROR#Right , label AST#ERROR#Left : Resource AST#ERROR#Right } AST#export_declaration#Right
export type SongItem = { id: number, title: string, singer: string, label: Resource }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/features/content/src/main/ets/viewmodel/SongDataSource.ets#L16-L21
a0f7af87e3c427ba6d78c083f9e77c15077457d1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets
arkts
AddressExchangeViewComponent
使用交换元素组件样例 核心组件: 实现步骤: 1. 创建左右两边Text组件显示地址。设置初始偏移量以及文本对齐方式 2. 点击中间的图标时,修改是否切换的状态变量值和通过animateTo修改偏移量的值,来实现动态更新左右两边地址的显示,完成动画效果 功能描述:左右两侧图标可以进行交换,图标也会旋转,伴随着动画效果 推荐场景: 购票软件选择地址时使用 核心组件: 1. AddressExchangeComponent: 地址交换组件 实现步骤: 1. 自定义左侧地址模块样式 @example @Builder leftAddressBuilder() { Text($r('app.string.address_exc...
@Component export struct AddressExchangeViewComponent { // 旋转角度 @State rotateAngle: number = 0; // 整体内容区宽度 private rowWidth: number = 300; // 内容相隔距离 private columnSpace: number = 16; // toast弹窗时长 private toastDuration: number = 2000; // 地址交换动画的配置,可由开发者自定义 private translateAnimationParam: AnimatePara...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AddressExchangeViewComponent AST#component_body#Left { // 旋转角度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right rotateAngle : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
@Component export struct AddressExchangeViewComponent { @State rotateAngle: number = 0; private rowWidth: number = 300; private columnSpace: number = 16; private toastDuration: number = 2000; private translateAnimationParam: AnimateParam = { curve: curves.springMotion() }; private flexDire...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets#L117-L257
d79cde846cdead410badef49fcbc7a42e877a216
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/ResPath.ets
arkts
getFilePath
获取文件在应用沙箱中的绝对路径 @returns string 完整文件路径
getFilePath(): string { return this.filePath; }
AST#method_declaration#Left getFilePath AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
getFilePath(): string { return this.filePath; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/ResPath.ets#L29-L31
54ed687ef2814d5aee839f7886d7befc7d7c11ed
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
带图片的通知配置项(含主图的富媒体通知)
export interface NotificationPictureOptions extends NotificationBasicOptions { /** 通知摘要文本(对图片+文本内容的总结,不可为空字符串) */ summaryText: string; /** 通知展开时显示的标题(不可为空字符串) */ expandedDisplayTitle: string; /** 通知附加图片(核心富媒体内容,像素总字节数≤2MB) */ attachedImage: image.PixelMap; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationPictureOptions AST#extends_clause#Left extends NotificationBasicOptions AST#extends_clause#Right AST#object_type#Left { /** 通知摘要文本(对图片+文本内容的总结,不可为空字符串) */ AST#type_member#Left summaryText : AST#type_annotation#Left AST#primary_type#...
export interface NotificationPictureOptions extends NotificationBasicOptions { summaryText: string; expandedDisplayTitle: string; attachedImage: image.PixelMap; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L586-L593
98d280b1159fcab8c13953527758e46a8b0db714
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsDetailTopBar.ets
arkts
getBackgroundOpacity
获取顶部导航栏背景透明度 @returns {number} 透明度(0-1)
private getBackgroundOpacity(): number { const alpha = Math.min(Math.max(this.topBarAlpha, 0), 255); return alpha / 255; }
AST#method_declaration#Left private getBackgroundOpacity AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator...
private getBackgroundOpacity(): number { const alpha = Math.min(Math.max(this.topBarAlpha, 0), 255); return alpha / 255; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailTopBar.ets#L135-L138
26ff7bb6af75c100647653452fd322f4f2ad3b08
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
验证结果接口
export interface ValidationResult { isValid: boolean; solarDate?: SolarDate; lunarDate?: LunarDate; message: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ValidationResult AST#object_type#Left { AST#type_member#Left isValid : 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 solarDate ? : AST#type_a...
export interface ValidationResult { isValid: boolean; solarDate?: SolarDate; lunarDate?: LunarDate; message: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L63-L68
78989c2ef6e010635cf0739e8c8776491d5bfe17
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setDrawTopYLabelEntry
set this to true to enable drawing the top y-label entry. Disabling this can be helpful when the top y-label and left x-label interfere with each other. default: true @param enabled
public setDrawTopYLabelEntry(enabled: boolean): void { this.mDrawTopYLabelEntry = enabled; }
AST#method_declaration#Left public setDrawTopYLabelEntry AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST...
public setDrawTopYLabelEntry(enabled: boolean): void { this.mDrawTopYLabelEntry = enabled; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L228-L230
eba21d3c8d7bb3117e84b936d59dae01d766aa8e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageenableanalyzer/src/main/ets/view/ImageView.ets
arkts
ImageViewComponent
功能描述:本示例介绍图片AI抠图案例的使用:通过Image.enableAnalyzer(true)实现长按图片抠图并拖拽/复制到其他应用中。 推荐场景:相册,美图软件 核心组件: 1.ImageViewComponent 实现步骤: 通过Image.enableAnalyzer(true)实现Image组件长摁拖拽元素并AI抠图: 1. 目前AI分析支持传入的图片类型为PixelMap且为RGBA_8888类型的图片,因此定义方法使图片转成PixelMap且为RGBA_8888类型。 2. 将需要AI抠图的Image组件添加.enableAnalyzer(true)方法,并传入PixelMap且为RGBA_8888类型的图片...
@Component export struct ImageViewComponent { @State swiperIndex: number = 0; @State imagePixelMapList: Array<image.PixelMap> = []; // 定义转化过类型的图片数组 scroller: Scroller = new Scroller(); aboutToAppear() { const arr = [$r("app.media.imageenableanalyzer_cat"), $r("app.media.imageenableanalyzer_cat2")]; ar...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right swiperIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#...
@Component export struct ImageViewComponent { @State swiperIndex: number = 0; @State imagePixelMapList: Array<image.PixelMap> = []; scroller: Scroller = new Scroller(); aboutToAppear() { const arr = [$r("app.media.imageenableanalyzer_cat"), $r("app.media.imageenableanalyzer_cat2")]; arr.forEach(async...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageenableanalyzer/src/main/ets/view/ImageView.ets#L34-L184
73e92b961d8ed6466d0ad3d16d2bc2788e9b76f0
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
shouldRefreshToken
是否需要刷新 token(过期前15分钟) @returns {boolean} 是否需要刷新 @example const needRefresh = getUserState().shouldRefreshToken();
shouldRefreshToken(): boolean { if (!this.auth) { return false; } return this.auth.shouldRefresh(); }
AST#method_declaration#Left shouldRefreshToken AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression...
shouldRefreshToken(): boolean { if (!this.auth) { return false; } return this.auth.shouldRefresh(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L94-L99
e4f57c042ba62d362de8d0804f76aa4864cfdf35
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
logErrorLines
输出 error 日志(支持多行与分段) @param {string[]} lines - 日志行 @returns {void} 无返回值
function logErrorLines(lines: string[]): void { logLines("error", lines); }
AST#function_declaration#Left function logErrorLines AST#parameter_list#Left ( AST#parameter#Left lines : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
function logErrorLines(lines: string[]): void { logLines("error", lines); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L184-L186
f027836281d0edf91b16ec5bf6791980b85b4aa3
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/system/IBaseConfirmOrAlertDialogOptions.ets
arkts
【系统】确认弹窗配置
export interface IBaseConfirmOrAlertDialogOptions extends IModalDialogOptions { /** * 弹窗偏移(可选) * @description 用于当弹窗alignment设置为DialogAlignment.Bottom时,设置弹窗偏移量,默认为0 */ markAnchor?: Position | LocalizedPosition /** * Sets the ConfirmDialog Controller. * @type { CustomDialogController }. * @syscap ...
AST#export_declaration#Left export AST#interface_declaration#Left interface IBaseConfirmOrAlertDialogOptions AST#extends_clause#Left extends IModalDialogOptions AST#extends_clause#Right AST#object_type#Left { /** * 弹窗偏移(可选) * @description 用于当弹窗alignment设置为DialogAlignment.Bottom时,设置弹窗偏移量,默认为0 */ AST#type_member...
export interface IBaseConfirmOrAlertDialogOptions extends IModalDialogOptions { markAnchor?: Position | LocalizedPosition controller?: CustomDialogController; content?: ResourceStr; primaryButton?: ButtonOptions; secondaryButton?: ButtonOptions; theme?: Theme | CustomThem...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/system/IBaseConfirmOrAlertDialogOptions.ets#L7-L97
1bd6cd023f123c22702ff62616b01650b63a3871
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
setIntervalSeconds
设置总时长(秒)
setIntervalSeconds(seconds: number): void { this.setTotalInterval(seconds * 1000); }
AST#method_declaration#Left setIntervalSeconds AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
setIntervalSeconds(seconds: number): void { this.setTotalInterval(seconds * 1000); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L22-L24
c4712ab10beaebfd5a0342bb65b0fba909742507
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Get all file names of EasyList rules in directory of filesDir/easylist.
export function get_EasyLists() { let result: string[][] = []; try { const files = fileIo.listFileSync(meowContext().filesDir + '/easylist', { recursion: false }); for (let index = 0; index < files.length; index++) { const filename = meowContext().filesDir + '/easylist/' + files[index]; result.p...
AST#export_declaration#Left export AST#function_declaration#Left function get_EasyLists AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type...
export function get_EasyLists() { let result: string[][] = []; try { const files = fileIo.listFileSync(meowContext().filesDir + '/easylist', { recursion: false }); for (let index = 0; index < files.length; index++) { const filename = meowContext().filesDir + '/easylist/' + files[index]; result.p...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L38-L50
393637e6e38b4b015e356f1fb89f4261832dade8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/RowAttribute.ets
arkts
获取横向起始 + 垂直居中的 Row 对齐修饰器 @returns {AttributeModifier<RowAttribute>} Row 对齐修饰器 @example Row() { Text("Hi"); }.attributeModifier(rowStartCenter());
export function rowStartCenter(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.Start); instance.alignItems(VerticalAlign.Center); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function rowStartCenter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST...
export function rowStartCenter(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.Start); instance.alignItems(VerticalAlign.Center); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L27-L34
dd5dbfb935d50e0e1ae1ce8d17750ed27b90e99e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
isNumber
判断是否是数值 @param value 需要判断的参数
static isNumber(value: Any): boolean { return (typeof value === "number") && !NumberUtil.isNaN(value); }
AST#method_declaration#Left static isNumber AST#parameter_list#Left ( AST#parameter#Left value : 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 boolean AST#primary_type#Ri...
static isNumber(value: Any): boolean { return (typeof value === "number") && !NumberUtil.isNaN(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L71-L73
35c55702c660fa82afae5b738ad067d1afcd56b2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
AR卡片类型枚举
export enum ARCardType { BIRTHDAY_CAKE = 'birthday_cake', FIREWORKS = 'fireworks', BALLOONS = 'balloons', GIFT_BOX = 'gift_box', CONFETTI = 'confetti', CUSTOM = 'custom' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ARCardType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY_CAKE = AST#expression#Left 'birthday_cake' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left FIREWORKS = AST#expression#Left 'fireworks' AST#expression#Right AST#enum_member#Ri...
export enum ARCardType { BIRTHDAY_CAKE = 'birthday_cake', FIREWORKS = 'fireworks', BALLOONS = 'balloons', GIFT_BOX = 'gift_box', CONFETTI = 'confetti', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L15-L22
53baf483c66272712eb82495cd06db2aaea1fcad
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
rgb
Converts the given hex-color-string to rgb. @param {string} hex - 要转换的十六进制颜色代码(例如,"#336699"),或者带透明度的颜色代码(例如,”#99336699“) @return {number} - 表示颜色的RGB值, 例如 0x336699 或者 0x99336699
public static rgb(hex: string): number { return Number("0x" + hex.replace("#", "")); }
AST#method_declaration#Left public static rgb AST#parameter_list#Left ( AST#parameter#Left hex : 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#primary_type#...
public static rgb(hex: string): number { return Number("0x" + hex.replace("#", "")); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L184-L186
46c40629f148aa765d8b091d77316ec1cc29e292
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisMinimum
Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data. Use resetAxisMinValue() to undo this. Do not forget to call setStartAtZero(false) if you use this method. Otherwise, the axis-minimum value will still be forced to 0. @param min
public setAxisMinimum(min: number): void { this.mCustomAxisMin = true; this.mAxisMinimum = min; this.mAxisRange = Math.abs(this.mAxisMaximum - min); }
AST#method_declaration#Left public setAxisMinimum AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
public setAxisMinimum(min: number): void { this.mCustomAxisMin = true; this.mAxisMinimum = min; this.mAxisRange = Math.abs(this.mAxisMaximum - min); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L733-L737
932bc4d6144ceca523df223b0abb031f4bb85ab9
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/WaterfallDataSet.ets
arkts
setDotsColors
设置所有高亮点的颜色。 @param color - 要设置的颜色,可以是数字或字符串。
public setDotsColors(color: number | string): void { this.mEntries?.dataSource.forEach((value: BarEntry) => { (value as WaterfallEntry).getHighlights().forEach((highlight: WaterfallHighlight) => { highlight.setColor(color); }) }) }
AST#method_declaration#Left public setDotsColors AST#parameter_list#Left ( AST#parameter#Left color : 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#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
public setDotsColors(color: number | string): void { this.mEntries?.dataSource.forEach((value: BarEntry) => { (value as WaterfallEntry).getHighlights().forEach((highlight: WaterfallHighlight) => { highlight.setColor(color); }) }) }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/WaterfallDataSet.ets#L78-L84
9ed8486d358c928a77c2a4d604ff75480c81f508
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getSpaceMin
Gets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
public getSpaceMin(): number { return this.mSpaceMin; }
AST#method_declaration#Left public getSpaceMin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre...
public getSpaceMin(): number { return this.mSpaceMin; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L802-L804
a6cdb6a85341d6dee1190da5ad5104196c14ff55
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/PixelConversion/entry/src/main/ets/common/constants/Constants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export default class Constants { /** * 100 percent */ static readonly FULL_PERCENT: string = '100%'; /** * pixel conversion */ static readonly PIXEL_CONVERSION: string = '像素转换'; /** * pixel introduction */ static readonly PIXEL_INTRODUCTION: string = '像素介绍'; /** * IntroductionPage URL...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { /** * 100 percent */ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export default class Constants { static readonly FULL_PERCENT: string = '100%'; static readonly PIXEL_CONVERSION: string = '像素转换'; static readonly PIXEL_INTRODUCTION: string = '像素介绍'; static readonly INTRODUCTION_PAGE_URL: string = 'pages/IntroductionPage'; static readonly CONVERSION_PAGE_...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/PixelConversion/entry/src/main/ets/common/constants/Constants.ets#L16-L87
c300bafea99c5ecf911fab32c12f3e276bd5387a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactEditPage.ets
arkts
copySocialMediaObject
辅助方法:复制社交媒体对象
private copySocialMediaObject(socialMedia: Map<string, string>): Map<string, string> { const copy = new Map<string, string>(); socialMedia.forEach((value, key) => { copy.set(key, value); }); return copy; }
AST#method_declaration#Left private copySocialMediaObject AST#parameter_list#Left ( AST#parameter#Left socialMedia : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ,...
private copySocialMediaObject(socialMedia: Map<string, string>): Map<string, string> { const copy = new Map<string, string>(); socialMedia.forEach((value, key) => { copy.set(key, value); }); return copy; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L82-L88
dcc3bd0788cf13ece9ef1afa6bbd7e76eed1e416
github
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/model/WeatherData.ets
arkts
API响应格式
export interface WeatherResponse { code: string; updateTime: string; now: WeatherNow; }
AST#export_declaration#Left export AST#interface_declaration#Left interface WeatherResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left updateTime : AST#type_annotat...
export interface WeatherResponse { code: string; updateTime: string; now: WeatherNow; }
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/model/WeatherData.ets#L23-L27
a01343d3657a2221168016c6608e01b6f738de21
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
unique
pluck 被移除,因为 ArkTS 不支持动态索引访问 去重(基于二进制比较) @param messages 消息数组 @returns 去重后的消息数组 使用示例: ```typescript const people = [person1, person2, person1Clone, person3] const uniquePeople = MessageUtils.unique(people) // uniquePeople: [person1, person2, person3] ```
static unique<T extends Message>(messages: T[]): T[] { const seen = new Set<string>() const result: T[] = [] for (const msg of messages) { // 使用二进制数据作为唯一标识 try { const binary = msg.toBinary(true) const key = MessageUtils.binaryToString(binary) if (!seen.has(key)) { ...
AST#method_declaration#Left static unique AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#...
static unique<T extends Message>(messages: T[]): T[] { const seen = new Set<string>() const result: T[] = [] for (const msg of messages) { try { const binary = msg.toBinary(true) const key = MessageUtils.binaryToString(binary) if (!seen.has(key)) { seen.add(k...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L385-L406
74742a5e8f412759a16406069d13da7c2957412f
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
loadBillData
加载账单数据
async loadBillData() { console.info('开始加载账单数据'); this.billList = await BillDataManager.getAllBills(); console.info('账单数量:', this.billList.length); console.info('账单数据:', JSON.stringify(this.billList)); // 过滤当前选择月份的账单 const yearMonthStr = `${this.selectedYear}-${this.selectedMonth.toString()....
AST#method_declaration#Left async loadBillData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . i...
async loadBillData() { console.info('开始加载账单数据'); this.billList = await BillDataManager.getAllBills(); console.info('账单数量:', this.billList.length); console.info('账单数据:', JSON.stringify(this.billList)); const yearMonthStr = `${this.selectedYear}-${this.selectedMonth.toString().padStart(2, '0...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L91-L148
14ee324ed1d94cd33ca94e5629c4ace3485ba492
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
getOccasionText
辅助方法 - 获取场合文本
private getOccasionText(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.NEW_YEAR: return '新年'; case GreetingOccasion.SPRING_FESTIVAL: return '春节'; default: return '生...
AST#method_declaration#Left private getOccasionText AST#parameter_list#Left ( AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left GreetingOccasion AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left str...
private getOccasionText(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.NEW_YEAR: return '新年'; case GreetingOccasion.SPRING_FESTIVAL: return '春节'; default: return '生...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L549-L557
b7e31545bb47e4d14e647cfc3abb80c767ef0f78
github
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/ArticleContentApi.type.ets
arkts
分页查询最新文章内容入参
export interface ArticleContentNewPageParam extends PageParam { /** * 标题 */ title: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface ArticleContentNewPageParam AST#extends_clause#Left extends PageParam AST#extends_clause#Right AST#object_type#Left { /** * 标题 */ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST...
export interface ArticleContentNewPageParam extends PageParam { title: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/ArticleContentApi.type.ets#L65-L71
eb5e62f4dfd65fd0e1f1117bf3bee11bb1337229
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateRegion
更新省市区 @param {string} province - 省 @param {string} city - 市 @param {string} district - 区 @returns {void} 无返回值
updateRegion(province: string, city: string, district: string): void { this.province = province; this.city = city; this.district = district; this.updateRegionValue(); this.refreshRegionDisplay(); }
AST#method_declaration#Left updateRegion AST#parameter_list#Left ( AST#parameter#Left province : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left city : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
updateRegion(province: string, city: string, district: string): void { this.province = province; this.city = city; this.district = district; this.updateRegionValue(); this.refreshRegionDisplay(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L230-L236
d9cf8925c4f1944038060be0f343379b6408a80a
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets
arkts
Transforming the Response Interceptor into a Sendable interface
export interface IResponseInterceptor extends lang.ISendable { handle(data: AxiosResponse<object, object>): AxiosResponse<object, object> | Promise<AxiosResponse<object, object>>; handleError(error: object): object; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IResponseInterceptor AST#extends_clause#Left extends AST#extends_clause#Right AST#ERROR#Left AST#qualified_type#Left lang . ISendable AST#qualified_type#Right AST#ERROR#Right AST#object_type#Left { AST#type_member#Left handle AST#parameter_list...
export interface IResponseInterceptor extends lang.ISendable { handle(data: AxiosResponse<object, object>): AxiosResponse<object, object> | Promise<AxiosResponse<object, object>>; handleError(error: object): object; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets#L28-L32
096037cc501e81059e69ab1ff1e73da0c79debd0
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
setDownloadProgress
设置进度 @param value 进度
setDownloadProgress(value): void { if (this._downloadProgress !== value && value !== undefined && value !== null) { this._downloadProgress = value; AppStorage.Set('downloadProgress', this._downloadProgress); } }
AST#method_declaration#Left setDownloadProgress AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) 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_sta...
setDownloadProgress(value): void { if (this._downloadProgress !== value && value !== undefined && value !== null) { this._downloadProgress = value; AppStorage.Set('downloadProgress', this._downloadProgress); } }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L259-L264
c9c655f38ba082f2fd68af56a07fd21f80328124
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.1.8';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.1.8' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.1.8';
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/BuildProfile.ets#L4-L4
94400972963ac1d7e9c11d7b354b02249bb096b2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
getResetDay
处理一些特殊情况下的日期
static getResetDay(yearStr: string, monthStr: string, dayStr: string): string { try { let year = parseInt(yearStr.replace('年', '')); let month = parseInt(monthStr.replace('月', '')); let day = DateHelper.getDaysByMonth(year, month); let selectDay = parseInt(dayStr.replace('日', '')); if ...
AST#method_declaration#Left static getResetDay AST#parameter_list#Left ( AST#parameter#Left yearStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left monthStr : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static getResetDay(yearStr: string, monthStr: string, dayStr: string): string { try { let year = parseInt(yearStr.replace('年', '')); let month = parseInt(monthStr.replace('月', '')); let day = DateHelper.getDaysByMonth(year, month); let selectDay = parseInt(dayStr.replace('日', '')); if ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L271-L288
37aea1eae1e79facbe9de0160fcca895c20fa058
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleBackupManager.ets
arkts
destroy
销毁实例
destroy(): void { SimpleBackupManager.instance = null; }
AST#method_declaration#Left destroy 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 AST#member_exp...
destroy(): void { SimpleBackupManager.instance = null; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L150-L152
4f3d6ca98b3877fb210530a8cf8ca9a4ad29ca0c
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
getConfigs
对应eglGetConfigs
getConfigs(count: number): EGLConfig[] | undefined;
AST#method_declaration#Left getConfigs AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array...
getConfigs(count: number): EGLConfig[] | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L181-L181
d60ee48c7d94e08b1cc227239a379b7780337f09
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIExperience/entry/src/main/ets/pages/Index.ets
arkts
showFailDialog
显示错误提示弹框
showFailDialog(title: ResourceStr, text: ResourceStr, callback?: () => void) { LogUtil.info(TAG, 'showFailDialog'); let failDialog: CustomDialogController; failDialog = new CustomDialogController({ builder: ErrorDialog({ confirm: callback, textStr: text, title: title, controlle...
AST#method_declaration#Left showFailDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#prima...
showFailDialog(title: ResourceStr, text: ResourceStr, callback?: () => void) { LogUtil.info(TAG, 'showFailDialog'); let failDialog: CustomDialogController; failDialog = new CustomDialogController({ builder: ErrorDialog({ confirm: callback, textStr: text, title: title, controlle...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/pages/Index.ets#L110-L123
fc4d9b0d1d7929ab43b30cf0b71fcfeb4a486d80
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
get_last_modified
Folder
get_last_modified() { return this.last_modified; }
AST#method_declaration#Left get_last_modified AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . last_modified AST#member_expression#Right AST#e...
get_last_modified() { return this.last_modified; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L751-L753
00b13502c5cd0a58c2df585c5016e2cd3a7c4773
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/util/FileUtil.ets
arkts
保存pixelMap,返回路径 @param pm @returns
export async function savePixelMap(context: Context, pm: PixelMap, fileName: string): Promise<string> { if (pm === null) { logger.error(TAG, '传入的pm为空'); return ''; } const imagePackerApi: image.ImagePacker = image.createImagePacker(); const packOpts: image.PackingOption = { format: 'image/jpeg', quality...
AST#export_declaration#Left export AST#function_declaration#Left async function savePixelMap AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pm : AST#type_annotation#Le...
export async function savePixelMap(context: Context, pm: PixelMap, fileName: string): Promise<string> { if (pm === null) { logger.error(TAG, '传入的pm为空'); return ''; } const imagePackerApi: image.ImagePacker = image.createImagePacker(); const packOpts: image.PackingOption = { format: 'image/jpeg', quality...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/util/FileUtil.ets#L27-L42
1026cd4189d4485025ca0f3481a699c227626401
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Pick a text file from device storage, pulling up a DocumentViewPicker. @returns A string, of the chosen file's uri.
export async function document_pick_to_uri(suffixFilters?: string[]) { try { let documentPicker = new picker.DocumentViewPicker(); let documentSelectResult = await documentPicker.select({ maxSelectNumber: 1, fileSuffixFilters: suffixFilters || [".html", ".txt"] }); console.info('[document_reader] Document...
AST#export_declaration#Left export AST#function_declaration#Left async function document_pick_to_uri AST#parameter_list#Left ( AST#parameter#Left suffixFilters ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#para...
export async function document_pick_to_uri(suffixFilters?: string[]) { try { let documentPicker = new picker.DocumentViewPicker(); let documentSelectResult = await documentPicker.select({ maxSelectNumber: 1, fileSuffixFilters: suffixFilters || [".html", ".txt"] }); console.info('[document_reader] Document...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L289-L300
b95764c477a4b7fc89195add9617d572f5d8f660
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/shopping/user/src/ets/pages/homePage/cart.ets
arkts
Cart
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct Cart { @State flag: boolean = true @State value: number = 1 @Prop ratio: number build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Image('/resources/homeImg/imgLoads/product004.png') .wid...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Cart AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Righ...
@Component export struct Cart { @State flag: boolean = true @State value: number = 1 @Prop ratio: number build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Image('/resources/homeImg/imgLoads/product004.png') .wid...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/shopping/user/src/ets/pages/homePage/cart.ets#L16-L93
a1e84f16afe07ba2f9930d5fc677e718ee1fa227
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
deleteOrigin
清除指定源所使用的存储。 @param origin 指定源的字符串索引,来自于getOrigins。
static deleteOrigin(origin: string): void { webview.WebStorage.deleteOrigin(origin); }
AST#method_declaration#Left static deleteOrigin AST#parameter_list#Left ( AST#parameter#Left origin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
static deleteOrigin(origin: string): void { webview.WebStorage.deleteOrigin(origin); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L258-L260
b14da687010509d8300f9869710526458d47667d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
showPrimaryDialog
两个按钮的AlertDialog(AlertDialogParamWithButtons) @param options
static showPrimaryDialog(options: PrimaryDialogOptions) { DialogUtils.initDialogDefault(options); DialogUtils.initPrimaryButton(options); AlertDialog.show(options as AlertDialogParamWithButtons); }
AST#method_declaration#Left static showPrimaryDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left PrimaryDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_...
static showPrimaryDialog(options: PrimaryDialogOptions) { DialogUtils.initDialogDefault(options); DialogUtils.initPrimaryButton(options); AlertDialog.show(options as AlertDialogParamWithButtons); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L61-L65
3292a6e0482f4325c1e368df3a5fe09fcfb961e5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
calculateTimeSpent
计算游戏时间
private calculateTimeSpent(session: GameSession): number { if (!session.endTime) return 0; const startTime = new Date(session.startTime).getTime(); const endTime = new Date(session.endTime).getTime(); return Math.floor((endTime - startTime) / 1000); }
AST#method_declaration#Left private calculateTimeSpent AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left GameSession AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number...
private calculateTimeSpent(session: GameSession): number { if (!session.endTime) return 0; const startTime = new Date(session.startTime).getTime(); const endTime = new Date(session.endTime).getTime(); return Math.floor((endTime - startTime) / 1000); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L667-L673
d115120c5018740b1a1e6612d075397516bd60d8
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
Defines the Environment interface. @since 7
export class Environment { /** * Called when a property value is checked. * @since 7 * @deprecated since 10 */ static EnvProp<T>(key: string, value: T): boolean { return Environment.envProp(key, value) } /** * Called when a property value is checked. * @since 10 ...
AST#export_declaration#Left export AST#class_declaration#Left class Environment AST#class_body#Left { /** * Called when a property value is checked. * @since 7 * @deprecated since 10 */ AST#method_declaration#Left static EnvProp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter...
export class Environment { static EnvProp<T>(key: string, value: T): boolean { return Environment.envProp(key, value) } static envProp<T>(key: string, value: T): boolean { throw new Error("Environment.EnvProp is not implemented") } static envProps(props: EnvPropsOptio...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L292-L332
206b4c7c8a5846c52b9ac1aa03f5bcf8b696c8be
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/OrderGoodsModal.ets
arkts
OrderGoodsModal
@file 订单商品选择弹窗组件 @author Joker.X
@ComponentV2 export struct OrderGoodsModal { /** * 是否显示弹窗 */ @Param @Require visible: boolean = false; /** * 弹窗标题 */ @Param title: ResourceStr = ""; /** * 操作按钮文案 */ @Param buttonText: ResourceStr = ""; /** * 商品列表 */ @Param cartList: Cart[] = []; /** * 关闭回调 */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderGoodsModal AST#component_body#Left { /** * 是否显示弹窗 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right visible : AST#type_annota...
@ComponentV2 export struct OrderGoodsModal { @Param @Require visible: boolean = false; @Param title: ResourceStr = ""; @Param buttonText: ResourceStr = ""; @Param cartList: Cart[] = []; @Param onDismiss: () => void = () => { }; @Param onItemButtonClick: (goodsId: number) =>...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/OrderGoodsModal.ets#L18-L127
db9c5f88af78ea9285fd54ccb8b242a1a614f8db
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultValueFormatter.ets
arkts
Constructor that specifies to how many digits the value should be formatted. @param digits
constructor(digits: number) { this.setup(digits); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left digits : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#...
constructor(digits: number) { this.setup(digits); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultValueFormatter.ets#L40-L42
4909703a9ff4e444ee1882d848aa5e1cff831908
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Matrix.ets
arkts
仅用于translate 和 scale,rotate、skew未移植
export default class Matrix { public static MSCALE_X: number = 0; //!< use with getValues/setValues public static MSKEW_X: number = 1; //!< use with getValues/setValues public static MTRANS_X: number = 2; //!< use with getValues/setValues public static MSKEW_Y: number = 3; //!< use with getValues/setValues pu...
AST#export_declaration#Left export default AST#ERROR#Left class Matrix { AST#property_declaration#Left public static MSCALE_X : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right //!< use wi...
export default class Matrix { public static MSCALE_X: number = 0; public static MSKEW_X: number = 1; public static MTRANS_X: number = 2; public static MSKEW_Y: number = 3; public static MSCALE_Y: number = 4; public static MTRANS_Y: number = 5; public static MPERSP_0: number = 6; public static MPE...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Matrix.ets#L21-L45
ee5ff3b6d278f537ce9fa2af5f6c07fbcc25f0d2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreviewUtil.ets
arkts
hasDisplayed
判断预览窗口是否已经存在
static hasDisplayed(): Promise<boolean> { return filePreview.hasDisplayed(AppUtil.getContext()); }
AST#method_declaration#Left static hasDisplayed AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type...
static hasDisplayed(): Promise<boolean> { return filePreview.hasDisplayed(AppUtil.getContext()); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L63-L65
37e1abd8cec75745666b9b6102af953482481027
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
统计分析接口
export interface AnalyticsData { greetingStats: GreetingStats; giftStats: GiftStats; modelUsage: ModelUsage; favoriteAnalytics: FavoriteAnalytics; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AnalyticsData AST#object_type#Left { AST#type_member#Left greetingStats : AST#type_annotation#Left AST#primary_type#Left GreetingStats AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left giftStats : AST...
export interface AnalyticsData { greetingStats: GreetingStats; giftStats: GiftStats; modelUsage: ModelUsage; favoriteAnalytics: FavoriteAnalytics; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L656-L661
7ff61371b8221ad298930628be78b71cfc45f809
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ImageComponent/entry/src/main/ets/pages/LoadImageResources.ets
arkts
使用imgDatas的url加载图片。
build() { Column() { Grid() { ForEach(this.imgDatas, (item:string) => { GridItem() { Image(item) .width(200) } }, (item:string):string => JSON.stringify(item)) } }.width('100%').height('100%') }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { AST#ui_contr...
build() { Column() { Grid() { ForEach(this.imgDatas, (item:string) => { GridItem() { Image(item) .width(200) } }, (item:string):string => JSON.stringify(item)) } }.width('100%').height('100%') }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ImageComponent/entry/src/main/ets/pages/LoadImageResources.ets#L50-L61
c760c5412e79ac6faebd8d47dad095273d4a1c4d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceEvenlyStart
纵向均分 + 水平起始
@ComponentV2 export struct ColumnSpaceEvenlyStart { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceEvenlyStart AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#pri...
@ComponentV2 export struct ColumnSpaceEvenlyStart { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1265-L1340
3870a38f13f367a569fdf71cfc3ec5a1623fb68b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
buildEmptyView
构建空状态视图
@Builder buildEmptyView() { Column({ space: 12 }) { Image($r('app.media.ic_calendar_empty')) .width(48) .height(48) .fillColor($r('app.color.text_secondary')) Column({ space: 4 }) { Text(this.widgetData.emptyText || '本周无生日') .fontSize(14) .fontColor...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para...
@Builder buildEmptyView() { Column({ space: 12 }) { Image($r('app.media.ic_calendar_empty')) .width(48) .height(48) .fillColor($r('app.color.text_secondary')) Column({ space: 4 }) { Text(this.widgetData.emptyText || '本周无生日') .fontSize(14) .fontColor...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets#L171-L195
50c96158dcb8d8d8544ae4167f689441da8e9cff
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
lessThan
判断是否小于另一个Box @param other - 另一个Box对象
lessThan(other: Box): boolean { return this.compareTo(other) < 0; }
AST#method_declaration#Left lessThan AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Box 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#Right AST...
lessThan(other: Box): boolean { return this.compareTo(other) < 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L82-L84
7dbc6c25f4ac06667291aba6d27d19459269d93a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fitfordarkmode/Index.ets
arkts
FitForDarkModeComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { FitForDarkModeComponent } from './src/main/ets/view/FitForDarkMode';
AST#export_declaration#Left export { FitForDarkModeComponent } from './src/main/ets/view/FitForDarkMode' ; AST#export_declaration#Right
export { FitForDarkModeComponent } from './src/main/ets/view/FitForDarkMode';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/Index.ets#L15-L15
8d6f2661fde6d843ffbc2be087b48b93a39e8058
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/WorksListsUtils.ets
arkts
getBookIds
获取书单中的bookId
getBookIds(worksBookList: WorksBookList[]): number[] { const bookIds = worksBookList .filter(item => item !== undefined) // 过滤掉 undefined 的 item .map(item => item.bookId) .filter(bookId => bookId !== undefined); // 如果 bookIds 长度为 0,直接返回空数组 if (bookIds.length === 0) { return []; ...
AST#method_declaration#Left getBookIds AST#parameter_list#Left ( AST#parameter#Left worksBookList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WorksBookList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
getBookIds(worksBookList: WorksBookList[]): number[] { const bookIds = worksBookList .filter(item => item !== undefined) .map(item => item.bookId) .filter(bookId => bookId !== undefined); if (bookIds.length === 0) { return []; } return bookIds.toString().split(',').map(N...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/WorksListsUtils.ets#L27-L39
6e7e5bf2d8bece83010cb4c8e7cccdf954d141e4
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/KMP.ets
arkts
findNonOverlappingMatches
查找所有不重叠的匹配位置 @param text 文本字符串 @param pattern 模式串 @returns 不重叠的匹配位置数组
static findNonOverlappingMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const lps = KMP.computeLPS(pattern); const m = pattern.length; const n = text.length; let i = 0; let j = 0; w...
AST#method_declaration#Left static findNonOverlappingMatches 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#Left pattern : AST#type_annotation#Left AST#primary_type#Left string...
static findNonOverlappingMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const lps = KMP.computeLPS(pattern); const m = pattern.length; const n = text.length; let i = 0; let j = 0; w...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L242-L273
9575adbb34048429f185c1b5c915ce91ec91740a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets
arkts
pickerSave
保存ArrayBuffer到用户选择的路径 @param buffer:图片ArrayBuffer @returns
async pickerSave(buffer: ArrayBuffer | string): Promise<void> { const photoSaveOptions = new picker.PhotoSaveOptions(); // 创建文件管理器保存选项实例 photoSaveOptions.newFileNames = ['PhotoViewPicker ' + new Date().getTime() + '.jpg']; // 保存文件名(可选) const photoViewPicker = new picker.PhotoViewPicker; photoViewPicker....
AST#method_declaration#Left async pickerSave AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ...
async pickerSave(buffer: ArrayBuffer | string): Promise<void> { const photoSaveOptions = new picker.PhotoSaveOptions(); photoSaveOptions.newFileNames = ['PhotoViewPicker ' + new Date().getTime() + '.jpg']; const photoViewPicker = new picker.PhotoViewPicker; photoViewPicker.save(photoSaveOptions) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets#L110-L125
f79832cd168462b897a52aab828ac6b742b2b804
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
strKey2Uint8Array
将字符串转换成uint8Array-加解密key @param str 字符串 @param keyLen 编码长度 @param keyCoding key的编码格式 @returns
static strKey2Uint8Array(str: string, keyLen: number, keyCoding: buffer.BufferEncoding): Uint8Array { //判断编码类型 if (keyCoding === 'base64') { //base64 // let base64Arr = Base64Util.decodeSync(str); return Base64Util.decodeSync(str); // if (base64Arr.length != keyLen / 8) { //需要 ...
AST#method_declaration#Left static strKey2Uint8Array 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 keyLen : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
static strKey2Uint8Array(str: string, keyLen: number, keyCoding: buffer.BufferEncoding): Uint8Array { if (keyCoding === 'base64') { return Base64Util.decodeSync(str); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L88-L127
da1a886c99406af6b8314632c70fe053d20b3f2a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppDelay/entry/src/main/ets/pages/CameraPage.ets
arkts
onPageHide
[Start camera_release_before] The camera page is triggered once every time it is hidden.
onPageHide() { this.releaseCamera(); }
AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . releaseCamera AST#member_...
onPageHide() { this.releaseCamera(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CameraPage.ets#L37-L39
9e4abdd0976b681add1fcf263e5f9512461928c7
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/DynamicSyncUtil.ets
arkts
dynamicKey
动态协商密钥 @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流 @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流 @param symAlgName 秘钥规格 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 共享密钥
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { //公钥数据 let pubKeyArray: Uint8Array = new Uint8Array(); //私钥数据 let priKeyArray: Uint...
AST#method_declaration#Left static dynamicKey AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ...
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { let pubKeyArray: Uint8Array = new Uint8Array(); let priKeyArray: Uint8Array = new...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L39-L76
be8473f1a332943ecdf1af906dbc74da85350ae0
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets
arkts
isEmptyStr
Check str is empty. @param {string} str @return {boolean} true(empty)
isEmptyStr(str: string) { return str.trim().length === 0; }
AST#method_declaration#Left isEmptyStr AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return A...
isEmptyStr(str: string) { return str.trim().length === 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets#L36-L38
3590acf6b7552615c21ffc2bc6598050421c4cd2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
setFontSize
设置字体大小
async setFontSize(fontSize: FontSizeLevel): Promise<void> { await this.updateSettings({ fontSize }); }
AST#method_declaration#Left async setFontSize AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#primary_type#Left FontSizeLevel 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 setFontSize(fontSize: FontSizeLevel): Promise<void> { await this.updateSettings({ fontSize }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L259-L261
d9d28299ae2b24d45b19b76ff0b150dc24700228
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
putPreference
设置key-value
async putPreference(key:string,value:string) { if (preference === null) { await this.getPreferencesFromStorage() } try { await preference.put(key, value) } catch (err) { console.error(err) } await preference.flush() }
AST#method_declaration#Left async putPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
async putPreference(key:string,value:string) { if (preference === null) { await this.getPreferencesFromStorage() } try { await preference.put(key, value) } catch (err) { console.error(err) } await preference.flush() }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L27-L37
e78fcc5a45187c914cb3849f6c880c06a0c1fef1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/components/Component.ets
arkts
ListItemView
视频list布局样式
@Component export struct ListItemView { private videoName: ResourceStr = ''; private authorName: ResourceStr = ''; build() { RelativeContainer() { Image($r("app.media.bottompanelslide_strawberry")) .objectFit(ImageFit.Contain) .width(Constants.FORTY_PERCENT_SIZE) .height($r("app...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemView AST#component_body#Left { AST#property_declaration#Left private videoName : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef...
@Component export struct ListItemView { private videoName: ResourceStr = ''; private authorName: ResourceStr = ''; build() { RelativeContainer() { Image($r("app.media.bottompanelslide_strawberry")) .objectFit(ImageFit.Contain) .width(Constants.FORTY_PERCENT_SIZE) .height($r("app...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/components/Component.ets#L19-L90
d5e044f9ca85bc9cd4fb754850e890fd694a0cf5
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets
arkts
Constructs the file path of history index data in which history in [year, month] should be. @param year A number, the year, like 2024. @param month A number, the month, like 12. @returns A string, 'history-index/index_year_month_00_00_00_00_000.txt'
export function index_path_of_month(year: number, month: number) { return 'history-index/' + index_file_name_of_month(year, month); }
AST#export_declaration#Left export AST#function_declaration#Left function index_path_of_month 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#Le...
export function index_path_of_month(year: number, month: number) { return 'history-index/' + index_file_name_of_month(year, month); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L293-L295
3eb215ffa2ac36a9d3582a1049242a042c6b7283
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets
arkts
matchEnWords
/查找英文单字
static matchEnWords(srcStr: string | null): Array<string> { const RegEnword = "([A-Za-z']+)"; return StringDealUtilityForBaseWord.matchRegex(srcStr, RegEnword); }
AST#method_declaration#Left static matchEnWords AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) ...
static matchEnWords(srcStr: string | null): Array<string> { const RegEnword = "([A-Za-z']+)"; return StringDealUtilityForBaseWord.matchRegex(srcStr, RegEnword); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets#L13-L16
0ef5f64cd4516e891c0ea27e4ab7c1f8a0ee91a6
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
setWidth
设置组件宽度 @param width 宽度 @param vp 屏幕密度
setWidth(width: number, vp: number) { this.width = width this.widthVp = vp this.frame = { x: 0, y: 0, width: vp, height: this.heightVp } }
AST#method_declaration#Left setWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left vp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#...
setWidth(width: number, vp: number) { this.width = width this.widthVp = vp this.frame = { x: 0, y: 0, width: vp, height: this.heightVp } }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L347-L356
15eabca984099178f2cc0ecf27f10cc0354c61d1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets
arkts
destroySession
销毁AVSession实例 @returns {void}
destroySession(): void { // TODO:知识点:注销AVSession事件 this.unRegisterListener(); // TODO:知识点:销毁AVSession实例 this.session?.destroy((err) => { if (err) { logger.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); } else { logger.info('Destroy : SUCCESS'); ...
AST#method_declaration#Left destroySession AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // TODO:知识点:注销AVSession事件 AST#expression_statement#Left AST#expression#Left AST#call_exp...
destroySession(): void { this.unRegisterListener(); this.session?.destroy((err) => { if (err) { logger.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); } else { logger.info('Destroy : SUCCESS'); } }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L87-L98
89b071cabf87ce37f203d0881d921fd004bcda07
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
set
Calculates the minimum and maximum x values as well as the range between them. @param chart @param dataSet
public set(chart: BarLineScatterCandleBubbleDataProvider, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>) { let phaseX: number = Math.max(0, Math.min(1, (this.mAnimator ? this.mAnimator.getPhaseX() : 1))); let low: number = chart.getLowestVisibleX(); let high: number = chart.getHighestVisibleX(); ...
AST#method_declaration#Left public set AST#parameter_list#Left ( AST#parameter#Left chart : AST#type_annotation#Left AST#primary_type#Left BarLineScatterCandleBubbleDataProvider AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#...
public set(chart: BarLineScatterCandleBubbleDataProvider, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>) { let phaseX: number = Math.max(0, Math.min(1, (this.mAnimator ? this.mAnimator.getPhaseX() : 1))); let low: number = chart.getLowestVisibleX(); let high: number = chart.getHighestVisibleX(); ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets#L50-L64
992ece2d5fee418abb075ca5f799ce73c63482ef
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets
arkts
calBezierPoint
是否是翻下一页的状态 计算各个关键点坐标
private calBezierPoint() { this.middleX = (this.touchOffset.dx + this.cornerX) / 2; this.middleY = (this.touchOffset.dy + this.cornerY) / 2; this.bezierControl1 = new Offset( this.middleX - (this.cornerY - this.middleY) * (this.cornerY - this.middleY) / (this.cornerX - thi...
AST#method_declaration#Left private calBezierPoint AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . middleX AST#member_expressi...
private calBezierPoint() { this.middleX = (this.touchOffset.dx + this.cornerX) / 2; this.middleY = (this.touchOffset.dy + this.cornerY) / 2; this.bezierControl1 = new Offset( this.middleX - (this.cornerY - this.middleY) * (this.cornerY - this.middleY) / (this.cornerX - thi...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets#L568-L658
041d2271f70e94d9e1230c6f98099775b4a9e585
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/VerificationCodeField.ets
arkts
buildSendCodeText
构建发送验证码按钮 @returns {void} 无返回值
@Builder private buildSendCodeText(): void { Text($r("app.string.get_verification_code")) .fontSize($r("app.float.headline_large")) .fontColor(this.getSendCodeTextColor()) .onClick((): void => { if (this.isPhoneValid) { this.onSendVerificationCode(); } }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildSendCodeText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AS...
@Builder private buildSendCodeText(): void { Text($r("app.string.get_verification_code")) .fontSize($r("app.float.headline_large")) .fontColor(this.getSendCodeTextColor()) .onClick((): void => { if (this.isPhoneValid) { this.onSendVerificationCode(); } }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/VerificationCodeField.ets#L89-L99
0323f4c4a5860f0375171c52cb834631bef87d65
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/net/src/main/ets/rcp/NetConfig.ets
arkts
@author open_9527 @date 2025/5/15 @desc 描述信息
export interface RequestConfig { url: rcp.URLOrString,//TODO:是完整url method?: rcp.HttpMethod, headers?: rcp.RequestHeaders, content?: rcp.RequestContent, cookies?: rcp.RequestCookies, transferRange?: rcp.TransferRange | rcp.TransferRange[], configuration?: rcp.Configuration }
AST#export_declaration#Left export AST#interface_declaration#Left interface RequestConfig AST#object_type#Left { AST#type_member#Left url : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . URLOrString AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#R...
export interface RequestConfig { url: rcp.URLOrString, method?: rcp.HttpMethod, headers?: rcp.RequestHeaders, content?: rcp.RequestContent, cookies?: rcp.RequestCookies, transferRange?: rcp.TransferRange | rcp.TransferRange[], configuration?: rcp.Configuration }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/net/src/main/ets/rcp/NetConfig.ets#L9-L17
a027d8deb30c8e33866ed890fe9fb0bcb7e4feec
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/CategoryManager.ets
arkts
MARK: -
export class Category { categoryName: string | null = null; constructor(categoryName: string | null) { this.categoryName = categoryName; } // 实现 Equatable 接口(以名称判断) static equals(lhs: Category, rhs: Category): boolean { return lhs.categoryName === rhs.categoryName; } }
AST#export_declaration#Left export AST#class_declaration#Left class Category AST#class_body#Left { AST#property_declaration#Left categoryName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#ty...
export class Category { categoryName: string | null = null; constructor(categoryName: string | null) { this.categoryName = categoryName; } static equals(lhs: Category, rhs: Category): boolean { return lhs.categoryName === rhs.categoryName; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L4-L15
40e51f8a3d328c7b46731f7722c722fd2efebf86
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setHoleRadius
sets the radius of the hole in the center of the piechart in percent of the maximum radius (max = the radius of the whole chart), default 50% @param percent
public setHoleRadius(percent: number): void { this.mHoleRadiusPercent = percent; }
AST#method_declaration#Left public setHoleRadius AST#parameter_list#Left ( AST#parameter#Left percent : 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 setHoleRadius(percent: number): void { this.mHoleRadiusPercent = percent; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L623-L625
b5b9238b2f0f3dc6bf675b4e8c39548a6bd00c12
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/Index.ets
arkts
handleTabChange
处理标签切换
private handleTabChange(index: number): void { hilog.info(DOMAIN, TAG, 'Tab changed to: %{public}d', index); this.currentTabIndex = index; }
AST#method_declaration#Left private handleTabChange 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...
private handleTabChange(index: number): void { hilog.info(DOMAIN, TAG, 'Tab changed to: %{public}d', index); this.currentTabIndex = index; }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/Index.ets#L31-L34
42cfc29a028f9158682abcc59d531b7c32632ae1
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AbilityUtils.ets
arkts
toBluetoothSetting
跳转蓝牙设置页面
static toBluetoothSetting(): Promise<void> { return AbilityUtils.toAppSetting(AbilityUtils.uri_bluetooth) }
AST#method_declaration#Left static toBluetoothSetting 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#t...
static toBluetoothSetting(): Promise<void> { return AbilityUtils.toAppSetting(AbilityUtils.uri_bluetooth) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L52-L54
c94a28db47c5280d9d480a65d8956eaed046c5cf
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setLabelCount
sets the number of label entries for the y-axis max = 25, min = 2, default: 6, be aware that this number is not fixed (if force == false) and can only be approximated. @param count the number of y-axis labels that should be displayed @param force if enabled, the set label count will be forced, meaning that the exact s...
public setLabelCount(count: number, force?: boolean): void { if (count > this.getAxisMaxLabels()) { count = this.getAxisMaxLabels(); } if (count < this.getAxisMinLabels()) { count = this.getAxisMinLabels(); } this.mLabelCount = count; this.mForceLabels = false; if (force != null ...
AST#method_declaration#Left public setLabelCount AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left force ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#prima...
public setLabelCount(count: number, force?: boolean): void { if (count > this.getAxisMaxLabels()) { count = this.getAxisMaxLabels(); } if (count < this.getAxisMinLabels()) { count = this.getAxisMinLabels(); } this.mLabelCount = count; this.mForceLabels = false; if (force != null ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L357-L369
f56ba8e39d912db0d266c2c00437cf7e4d50c9c6
gitee
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/common/utils/optionItem.ets
arkts
optionItem
该组件为设置和其他类似UI的选项布局。 主要内容为图片+文字+导航箭头 powered by yiyefangzhou24 2022/5/15
@Component export struct optionItem { @State bgColor: Resource = $r("app.color.white") private img: Resource //图标资源 private context: string //文字内容 private isNext: boolean //是否有下一步的导航箭头 private marginTop: number //组件上边距 private itemOnClick = (event: ClickEvent) =>{} //item的单击事件(可选) build...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct optionItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bgColor : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annot...
@Component export struct optionItem { @State bgColor: Resource = $r("app.color.white") private img: Resource private context: string private isNext: boolean private marginTop: number private itemOnClick = (event: ClickEvent) =>{} build(){ Row(){ if(this.img != null){ ...
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/utils/optionItem.ets#L8-L62
f3a847d68774dce87fc95b1412215054c212e327
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ReviewUtils.ets
arkts
openWebAppMarket
使用WebView打开应用市场网页版 @param context - UIAbility上下文 @param bundleName - 应用包名
private static openWebAppMarket(context: common.UIAbilityContext, bundleName: string): void { const webUrl: string = `https://appgallery.huawei.com/app/${bundleName}`; // 假设有一个WebViewPage页面用于展示网页 router.pushUrl({ url: 'pages/WebViewPage', params: { urlToLoad: webUrl } }).catch((err: Busines...
AST#method_declaration#Left private static openWebAppMarket AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramete...
private static openWebAppMarket(context: common.UIAbilityContext, bundleName: string): void { const webUrl: string = `https://appgallery.huawei.com/app/${bundleName}`; router.pushUrl({ url: 'pages/WebViewPage', params: { urlToLoad: webUrl } }).catch((err: BusinessError) => { hilog.er...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L86-L100
086db20fc67285e2ccec81394fc2c6c9ce8209a3
github
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
entry/src/main/ets/rdb/MessageDialog.ets
arkts
确认对话框
export function alertDialog(msg: string, submit: () => void, title: string = '系统提示') { AlertDialog.show({ title, message: msg, secondaryButton: { value: '取消', action: () => { } }, primaryButton: { value: '确定', action: () => submit() } }) }
AST#export_declaration#Left export AST#function_declaration#Left function alertDialog AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left submit : AST#type_annotation#Left AST#f...
export function alertDialog(msg: string, submit: () => void, title: string = '系统提示') { AlertDialog.show({ title, message: msg, secondaryButton: { value: '取消', action: () => { } }, primaryButton: { value: '确定', action: () => submit() } }) }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/entry/src/main/ets/rdb/MessageDialog.ets#L35-L45
3379f0febef9b82bda9f4632effdad60aee02b04
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/MyHttpUtils.ets
arkts
getTodayPoem
获取今日诗词数据
async getTodayPoem(){ let res = await http.createHttp().request(Constants.todayPoem) return JSON.parse(`${res.result}`) as Poem }
AST#method_declaration#Left async getTodayPoem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressio...
async getTodayPoem(){ let res = await http.createHttp().request(Constants.todayPoem) return JSON.parse(`${res.result}`) as Poem }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/MyHttpUtils.ets#L40-L43
3630d8d660ea51b0404dff2cdb26defd8c29aa11
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets
arkts
multiplyPoint
计算点P的n倍 @param P 点 @param n 倍数 @returns n倍点
private static multiplyPoint(P: Point, n: number): Point { let result: Point = { x: 0, y: 0 }; // 无穷远点 let temp: Point = P; while (n > 0) { if (n % 2 === 1) { result = EllipticCurveKeyExchange.addPoints(result, temp); } temp = EllipticCurveKeyExchange.addPoints(temp, temp); ...
AST#method_declaration#Left private static multiplyPoint AST#parameter_list#Left ( AST#parameter#Left P : AST#type_annotation#Left AST#primary_type#Left Point AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left n : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
private static multiplyPoint(P: Point, n: number): Point { let result: Point = { x: 0, y: 0 }; let temp: Point = P; while (n > 0) { if (n % 2 === 1) { result = EllipticCurveKeyExchange.addPoints(result, temp); } temp = EllipticCurveKeyExchange.addPoints(temp, temp); n = Mat...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets#L81-L94
d805104e5796f26a6b50cbcead3444e530f81820
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/VideoShow/VideoComponent/src/main/ets/components/pages/SmallVideo.ets
arkts
SmallVideo
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct SmallVideo { @State smallVideoSrc: Resource = $rawfile('video1.mp4'); @Link @Watch("onChanged") isHidden: boolean; @Link isCancel: boolean; @Consume('playTime') updateTime: number; smallVideoController: VideoController = new VideoController(); onChanged(): void { if (this.isHid...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SmallVideo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right smallVideoSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type...
@Component export struct SmallVideo { @State smallVideoSrc: Resource = $rawfile('video1.mp4'); @Link @Watch("onChanged") isHidden: boolean; @Link isCancel: boolean; @Consume('playTime') updateTime: number; smallVideoController: VideoController = new VideoController(); onChanged(): void { if (this.isHid...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoShow/VideoComponent/src/main/ets/components/pages/SmallVideo.ets#L16-L67
f6845a6dd53fa433394dbeffd9013c9059ba9c32
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
builder
构建efRcpSession对象 @returns
builder(): rcp.Session { if (this.efRcp === undefined) { throw new EfRcpError(12306, '构建efRcpSession异常', '请在构建之前调用create方法创建~'); } return this.efRcp as rcp.Session; }
AST#method_declaration#Left builder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Session AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if...
builder(): rcp.Session { if (this.efRcp === undefined) { throw new EfRcpError(12306, '构建efRcpSession异常', '请在构建之前调用create方法创建~'); } return this.efRcp as rcp.Session; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L113-L118
4b56f99bdb33940f1afc9822ca82ea637670ee41
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets
arkts
init
初始化ai语音转文字引擎 实现一键开启语音识别
static async init(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { await SpeechRecognizerManager.createEngine() SpeechRecognizerManager.setListener(callback) SpeechRecognizerManager.startListening() }
AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#q...
static async init(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { await SpeechRecognizerManager.createEngine() SpeechRecognizerManager.setListener(callback) SpeechRecognizerManager.startListening() }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L138-L143
9ae0f06254d9035446c507dee7e14ed599132e8b
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/FlowLocale.ets
arkts
default
Gets the current value of the default locale for this instance of the Java Virtual Machine. @see java.util.Locale.getDefault
public static default(): FlorisLocale { return FlorisLocale.from(Locale.getDefault()); }
AST#method_declaration#Left public static default AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FlorisLocale AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#cal...
public static default(): FlorisLocale { return FlorisLocale.from(Locale.getDefault()); }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L97-L99
70d485ff778084bae27fdafe38a28eab58e30e33
github
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/components/AudioCard.ets
arkts
AudioCard
自定义音频卡片组件 封装音频项的展示和交互逻辑
@Component export struct AudioCard { // 音频数据 @Prop item: AudioItem = new AudioItem(); // 播放状态 @Prop state: PlaybackState = PlaybackState.IDLE; // 事件回调 onPlay: () => void = () => {}; onStop: () => void = () => {}; // 内部状态 @State private expanded: boolean = false; // 获取按钮背景色 private getButtonColo...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AudioCard AST#component_body#Left { // 音频数据 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right item : AST#type_annotation#Left AST#primary_type#Left AudioItem AST#primary_type#Right AST#type_a...
@Component export struct AudioCard { @Prop item: AudioItem = new AudioItem(); @Prop state: PlaybackState = PlaybackState.IDLE; onPlay: () => void = () => {}; onStop: () => void = () => {}; @State private expanded: boolean = false; private getButtonColor(): string { switch (this.state) ...
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/AudioCard.ets#L7-L145
f5c1bc1e0a70a54525b5cbfb7459508ac95446d8
github
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleE/entry/src/main/ets/pages/Index.ets
arkts
getLocation
获取定位服务
getLocation(): void { let locationChange = (err: BusinessError, location: geoLocationManager.Location) => { if (err) { console.log('locationChanger: err=' + JSON.stringify(err)); } if (location) { this.latitude = location.latitude.toString(); this.longitude = location.longi...
AST#method_declaration#Left getLocation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left locationChange ...
getLocation(): void { let locationChange = (err: BusinessError, location: geoLocationManager.Location) => { if (err) { console.log('locationChanger: err=' + JSON.stringify(err)); } if (location) { this.latitude = location.latitude.toString(); this.longitude = location.longi...
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleE/entry/src/main/ets/pages/Index.ets#L32-L50
ccca637cd32993cde9f7c8c15e6184369dbc1a6c
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
save
保存记录(新增或更新) @returns {Promise<void>} Promise<void>
async save(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { if (this.editingId > 0) { await this.updateById(this.editingId); } else { await this.demoRepository.createDemo(this.titleInput, this.descInput); } this.resetInputs(); await this.fetchLi...
AST#method_declaration#Left async save 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_arguments#R...
async save(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { if (this.editingId > 0) { await this.updateById(this.editingId); } else { await this.demoRepository.createDemo(this.titleInput, this.descInput); } this.resetInputs(); await this.fetchLi...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L81-L91
bb775ec0eaf8ee62ad063f72a6dae9f78ed5312b
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
1000ms
export const DURATION_800: number = 800;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DURATION_800 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 800 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaratio...
export const DURATION_800: number = 800;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L100-L100
5b3c995d5876a9528c6854db877e43843f5b1e0f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
用户游戏数据接口
export interface UserGameData { userId: string; totalPoints: number; availablePoints: number; level: UserLevel; experience: number; achievements: Achievement[]; dailyTasks: DailyTask[]; streaks: Map<string, StreakData>; statistics: GameStatistics; preferences: GamePreferences; lastCheckIn: string;...
AST#export_declaration#Left export AST#interface_declaration#Left interface UserGameData AST#object_type#Left { AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalPoints : AST#type_annotat...
export interface UserGameData { userId: string; totalPoints: number; availablePoints: number; level: UserLevel; experience: number; achievements: Achievement[]; dailyTasks: DailyTask[]; streaks: Map<string, StreakData>; statistics: GameStatistics; preferences: GamePreferences; lastCheckIn: string;...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L171-L185
1d8199b9735a150834be8790bbe82724289ba611
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Enumerate blending modes for colors. Blend is a operation that use 4 components(red, green, blue, alpha) to generate a new color from two colors(source, destination). @enum { number } @syscap SystemCapability.Graphics.Drawing @since 11
export enum BlendMode { /** * Disable 4 regions(red, green, blue, alpha) * @syscap SystemCapability.Graphics.Drawing * @since 11 */ CLEAR = 0, /** * Use components of the source * @syscap SystemCapability.Graphics.Drawing * @since 11 */ SRC = 1, /** * Use...
AST#export_declaration#Left export AST#enum_declaration#Left enum BlendMode AST#enum_body#Left { /** * Disable 4 regions(red, green, blue, alpha) * @syscap SystemCapability.Graphics.Drawing * @since 11 */ AST#enum_member#Left CLEAR = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right ,...
export enum BlendMode { CLEAR = 0, SRC = 1, DST = 2, SRC_OVER = 3, DST_OVER = 4, SRC_IN = 5, DST_IN = 6, SRC_OUT = 7, DST_OUT = 8, SRC_ATOP = 9, DST_ATOP = 10, XOR = 11, PLUS = 12, MODULATE = 13...
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L57-L233
6bca6deebf8b833081cc899121e8f23b8adf3564
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
isNotNull
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotNull(str: string | undefined | null): boolean { return false === Helper.isNull(str); }
AST#method_declaration#Left static isNotNull AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Rig...
static isNotNull(str: string | undefined | null): boolean { return false === Helper.isNull(str); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L24-L26
6d863922965f610ba445a3a54de3ac76f1e71c0a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets
arkts
ImageItemView
TODO:知识点:组件复用
@Reusable @Component export struct ImageItemView { @Consume private bgc: Color; @Link isEnableSwipe: boolean; // TODO:需求:多图切换 @State isEnableOffset: boolean = false; @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); @State ma...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ImageItemView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right private bgc : AST#type_annotation#Left AST#prima...
@Reusable @Component export struct ImageItemView { @Consume private bgc: Color; @Link isEnableSwipe: boolean; @State isEnableOffset: boolean = false; @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); @State matrix: matrix4.M...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets#L25-L253
84d74132ba22fa98bbe934d4e87ab5bfbac0304e
gitee