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
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/path_sensitive/exception_throw/exception_throw_002_F.ets
arkts
Introduction 异常抛出-try块
export function exception_throw_002_F(taint_src : string) { try { throw new Error() taint.Sink(taint_src) } catch (e) { } }
AST#export_declaration#Left export AST#function_declaration#Left function exception_throw_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function exception_throw_002_F(taint_src : string) { try { throw new Error() taint.Sink(taint_src) } catch (e) { } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/exception_throw/exception_throw_002_F.ets#L6-L12
99c250163288d8ea2cf9fa3710e149ae22ce3743
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets
arkts
buffer
[StartExclude split_buffer1]
function buffer(bufferArray: ESObject, taskNum: number, sliderValue: number, value: number) { let Workers: ESObject // [EndExclude split_buffer1] // Assign the split pixels to the Worker instance. const buffers: ArrayBuffer[] = splitArrayBuffer(bufferArray, taskNum); let messages: MessageItem[] = []; for (l...
AST#function_declaration#Left function buffer AST#parameter_list#Left ( AST#parameter#Left bufferArray : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left taskNum : AST#type_annotation#Left AST#primary_type#Left number AST#p...
function buffer(bufferArray: ESObject, taskNum: number, sliderValue: number, value: number) { let Workers: ESObject const buffers: ArrayBuffer[] = splitArrayBuffer(bufferArray, taskNum); let messages: MessageItem[] = []; for (let i = 0; i < taskNum; i++) { let message = new MessageItem(buffers[i], sl...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets#L386-L404
9ee37a2ddc271224059d15c5ed0cfbab034e5700
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppContext.ets
arkts
获取 UIContext(推荐方式)
export function getUIContext(): UIContext { return AppContext.uiContext }
AST#export_declaration#Left export AST#function_declaration#Left function getUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ...
export function getUIContext(): UIContext { return AppContext.uiContext }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppContext.ets#L78-L80
e10ebcf3c5cf0b5f250ac3b61d9063ff61ba7212
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
Get swiper image data. @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4') ]; return swiperImages; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets#L28-L36
85d7328032d68695ef2b7cac6205f28c267e5f23
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
时间范围接口
export interface TimeRange { min: string; max: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TimeRange AST#object_type#Left { AST#type_member#Left min : 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 max : AST#type_annotation#Left AST#p...
export interface TimeRange { min: string; max: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L145-L148
edf6703aeccd2c7352d4efacbed8481051dee915
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ImageUtil.ets
arkts
base64ToPixelMap
图片base64字符串转PixelMap @param base64 图片base64字符串 @returns
static base64ToPixelMap(base64: string): Promise<image.PixelMap> { //将原始图片base64字符串转变为通过base64字符串 const reg = new RegExp('data:image/\\w+;base64,'); const base64Str = base64.replace(reg, ''); //将通用base64字符串转变为arrayBuffer let arrayBuffer = Base64Util.decodeSync(base64Str).buffer as ArrayBuffer; /...
AST#method_declaration#Left static base64ToPixelMap AST#parameter_list#Left ( AST#parameter#Left base64 : 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_typ...
static base64ToPixelMap(base64: string): Promise<image.PixelMap> { const reg = new RegExp('data:image/\\w+;base64,'); const base64Str = base64.replace(reg, ''); let arrayBuffer = Base64Util.decodeSync(base64Str).buffer as ArrayBuffer; let imageSource = image.createImageSource(arrayBuffer)...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L40-L51
ca10f226ec3ea035fcb20cbb667d51d44d80ec85
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
brightChange
亮度调节
async brightChange(): Promise<void> { let headFilter: effectKit.Filter = effectKit.createEffect(this.brightnessOriginBM); if (headFilter !== null && !this.isBrightChanging) { this.isBrightChanging = true; headFilter.brightness(this.brightnessValue); this.pixelMap = await headFilter.getEffectPi...
AST#method_declaration#Left async brightChange 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_arg...
async brightChange(): Promise<void> { let headFilter: effectKit.Filter = effectKit.createEffect(this.brightnessOriginBM); if (headFilter !== null && !this.isBrightChanging) { this.isBrightChanging = true; headFilter.brightness(this.brightnessValue); this.pixelMap = await headFilter.getEffectPi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L216-L225
26890cf1e551888bd881bffbb15f91a65b084bca
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets
arkts
getNavParam
获取指定栈中指定页面的参数,不支持栈内存在多个同名页面的情况
public static getNavParam<T = object>(info: NavRouterInfo): T | undefined { try { const paramsArr = RouterModule._stack.getParamByName(info.url) as | T[] | undefined[]; if (paramsArr.length) { const lastParam = paramsArr[paramsArr.length - 1]; if (typeof lastParam !== 'un...
AST#method_declaration#Left public static getNavParam AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left info : AST...
public static getNavParam<T = object>(info: NavRouterInfo): T | undefined { try { const paramsArr = RouterModule._stack.getParamByName(info.url) as | T[] | undefined[]; if (paramsArr.length) { const lastParam = paramsArr[paramsArr.length - 1]; if (typeof lastParam !== 'un...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets#L82-L100
3fd8e9b17ae2dac52402e61d71f08d7badcde823
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PickerColorMode. include AUTO, LIGHT and DARK @enum { number } PickerColorMode @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum PickerColorMode { /** * AUTO. follow system color * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AUTO = 0, /** * LIGHT. light color * * @syscap SystemCapability.FileManagement.PhotoAccessHelp...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PickerColorMode AST#enum_body#Left { /** * AUTO. follow system color * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#L...
export declare enum PickerColorMode { AUTO = 0, LIGHT = 1, DARK = 2 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L637-L662
ec6b2c81652afe715bd61d52324bd65fbdeef581
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
previewOutputCallBack
Listening for preview events
previewOutputCallBack(previewOutput: camera.PreviewOutput): void { Logger.info(TAG, 'previewOutputCallBack is called'); try { previewOutput.on('frameStart', (): void => { Logger.debug(TAG, 'Preview frame started'); }); previewOutput.on('frameEnd', (): void => { Logger.debug(TAG...
AST#method_declaration#Left previewOutputCallBack AST#parameter_list#Left ( AST#parameter#Left previewOutput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . PreviewOutput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#...
previewOutputCallBack(previewOutput: camera.PreviewOutput): void { Logger.info(TAG, 'previewOutputCallBack is called'); try { previewOutput.on('frameStart', (): void => { Logger.debug(TAG, 'Preview frame started'); }); previewOutput.on('frameEnd', (): void => { Logger.debug(TAG...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L557-L572
acbd270547eb4c048ad58c446b9d04e72f7bea56
gitee
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
common/totp/src/main/ets/common/Constants.ets
arkts
Copyright (c) 2024 Yang He TickAuth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be...
export class Constants { static readonly DOMAIN: number = 0x00203; }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly DOMAIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x00203 AST#expression#Right ; AST#prope...
export class Constants { static readonly DOMAIN: number = 0x00203; }
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/common/totp/src/main/ets/common/Constants.ets#L18-L21
67e2c5a45c570d2e010a2cfe4cdecf56e08b45ec
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
get_from_kv
Legacy THIS IS LEGACY CODE FOR MIGRATION ONLY Gets the corresponding value of key from the kvStore and stores in settings_list. @param key A string, the key of the setting. @returns A string | boolean | number, the corresponding value got for requested key.
private static async get_from_kv(key: string) { let key_default_index = bunch_of_settings.settings_defaults_key.indexOf(key); let key_default_value = bunch_of_settings.settings_defaults_value[key_default_index]; let type = bunch_of_settings.settings_defaults_type[key_default_index]; let result: string ...
AST#method_declaration#Left private static async get_from_kv 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable...
private static async get_from_kv(key: string) { let key_default_index = bunch_of_settings.settings_defaults_key.indexOf(key); let key_default_value = bunch_of_settings.settings_defaults_value[key_default_index]; let type = bunch_of_settings.settings_defaults_type[key_default_index]; let result: string ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L347-L362
6843bc7944bdf85612e22a0dd2a93e77ac6f7b56
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/ItemDescription.ets
arkts
ItemDescription
Copyright (c) 2021-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,...
@Component export struct ItemDescription { private description: string | Resource = '' build() { Text(this.description) .fontSize($r('sys.float.ohos_id_text_size_body2')) .fontColor($r('sys.color.ohos_id_color_text_secondary')) .fontWeight(FontWeight.Regular) .fontFamily('HarmonyHeiTi'...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ItemDescription AST#component_body#Left { AST#property_declaration#Left private description : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Re...
@Component export struct ItemDescription { private description: string | Resource = '' build() { Text(this.description) .fontSize($r('sys.float.ohos_id_text_size_body2')) .fontColor($r('sys.color.ohos_id_color_text_secondary')) .fontWeight(FontWeight.Regular) .fontFamily('HarmonyHeiTi'...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/ItemDescription.ets#L16-L29
c3ad1aa876a5d01383d3ade0d7ef83ae5f3b70b8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人完整信息接口
export interface Contact extends ContactInfo, ExtendedContactInfo { birthday: BirthdayInfo; intimacyLevel: number; // 亲密度等级 1-5 isFavorite: boolean; // 是否收藏 lastContactDate?: string; // 最后联系日期 }
AST#export_declaration#Left export AST#interface_declaration#Left interface Contact AST#extends_clause#Left extends ContactInfo , ExtendedContactInfo AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left birthday : AST#type_annotation#Left AST#primary_type#Left BirthdayInfo AST#primary_type#Right AST#typ...
export interface Contact extends ContactInfo, ExtendedContactInfo { birthday: BirthdayInfo; intimacyLevel: number; isFavorite: boolean; lastContactDate?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L155-L160
559911f62f219de9c41e6314d7e774133f532e30
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/CombinedChartRenderer.ets
arkts
getSubRenderers
Returns all sub-renderers. @return
public getSubRenderers(): JArrayList<DataRenderer> { return this.mRenderers; }
AST#method_declaration#Left public getSubRenderers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DataRenderer AST#primary_type#Right AST#type_annotation#Right...
public getSubRenderers(): JArrayList<DataRenderer> { return this.mRenderers; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/CombinedChartRenderer.ets#L194-L196
a1b7d64fe4a962379ffc32a032a7e582e3d5d98a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets
arkts
generateClickStyle
生成点击手势样式 @param {MyCustomSpan} span - 自定义文本片段,包含文本类型和内容 @returns {GestureStyle} - 包含点击事件处理的手势样式对象
generateClickStyle(span: MyCustomSpan): GestureStyle { return new GestureStyle({ onClick: () => { if(this.linkClickCallback){ this.linkClickCallback(span); } } }) }
AST#method_declaration#Left generateClickStyle AST#parameter_list#Left ( AST#parameter#Left span : AST#type_annotation#Left AST#primary_type#Left MyCustomSpan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GestureStyle AST...
generateClickStyle(span: MyCustomSpan): GestureStyle { return new GestureStyle({ onClick: () => { if(this.linkClickCallback){ this.linkClickCallback(span); } } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L230-L238
3ff0045431f5a23b0e30060cab112344adb731ac
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/FootprintRepository.ets
arkts
getFootprintCount
获取足迹记录总数量 @returns {Promise<number>} 足迹数量
getFootprintCount(): Promise<number> { return this.dataSource.getFootprintCount(); }
AST#method_declaration#Left getFootprintCount 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
getFootprintCount(): Promise<number> { return this.dataSource.getFootprintCount(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L60-L62
68631bc7dfc9dc8bd6c311b6d828e7939b3b0127
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getFileDirSize
获取指定文件夹下所有文件的大小或指定文件大小。 @param path 文件夹路径 或 文件路径
static getFileDirSize(path: string): number { if (FileUtil.accessSync(path)) { //path存在 if (FileUtil.isDirectory(path)) { //文件夹 let count: number = 0; FileUtil.listFileSync(path, { recursion: true }).forEach((filePath) => { count = count + FileUtil.lstatSync(path + filePath).size ...
AST#method_declaration#Left static getFileDirSize AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
static getFileDirSize(path: string): number { if (FileUtil.accessSync(path)) { if (FileUtil.isDirectory(path)) { let count: number = 0; FileUtil.listFileSync(path, { recursion: true }).forEach((filePath) => { count = count + FileUtil.lstatSync(path + filePath).size }) ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L255-L268
07b418b772f82afd7291b119718367c3c9d39322
gitee
HunZiLei/ArtTs_PokeAccountBook.git
3d91db931f5dd6cea3c6cd414fad7c28942a58ac
entry/src/main/ets/pages/mePage.ets
arkts
/*页面跳转动画 pageTransition() { PageTransitionEnter({ duration: 400, curve: Curve.Ease }) .slide(SlideEffect.Left) PageTransitionExit({ duration: 400, curve: Curve.Ease }) }
build() { Stack() { Column() { //标题 & 编辑按钮 Row() { Text($r('app.string.mainPage_title')) .fontColor(Color.White) .height(30) .fontSize(30) .margin({ left: 24,bottom:'50vp' }) } .sharedTransition('title', { duration: 500,...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { //标题 & 编辑按钮...
build() { Stack() { Column() { Row() { Text($r('app.string.mainPage_title')) .fontColor(Color.White) .height(30) .fontSize(30) .margin({ left: 24,bottom:'50vp' }) } .sharedTransition('title', { duration: 500, curve: Cur...
https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/pages/mePage.ets#L86-L375
648d126288960e93097e87f2a37571d21e879c3a
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/Widget/DialogApi.ets
arkts
createSubWindow
创建子窗口
private createSubWindow(params: ModalOption) { try { if (!this.windowStage) { return; } this.windowStage.createSubWindow('DiminaDialogSubWindow' + params.dialogId, (err: BusinessError, data) => { const errorCode: number = err.code; if (errorCode) { DMPLogger.e("Fa...
AST#method_declaration#Left private createSubWindow AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ModalOption AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_state...
private createSubWindow(params: ModalOption) { try { if (!this.windowStage) { return; } this.windowStage.createSubWindow('DiminaDialogSubWindow' + params.dialogId, (err: BusinessError, data) => { const errorCode: number = err.code; if (errorCode) { DMPLogger.e("Fa...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/Widget/DialogApi.ets#L58-L84
c96d7713f9419732e9bb91bd8731f0513e758956
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/ChatBubble.ets
arkts
getUserShadowColor
获取用户消息阴影色
private getUserShadowColor(): string { return 'rgba(147, 51, 234, 0.3)'; // 紫色发光阴影 }
AST#method_declaration#Left private getUserShadowColor 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 'rgba(14...
private getUserShadowColor(): string { return 'rgba(147, 51, 234, 0.3)'; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ChatBubble.ets#L217-L219
d826674873b59c73f4e32fec69b69cce0c052831
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
selected
二维码位置的样式
@Extend(Image) function selected(scanState: boolean, x: number, y: number) { .width(40) .height(40) .position({ x: x, y: y }) .markAnchor({ x: 20, y: 20 }) .visibility(scanState ? Visibility.Visible : Visibility.Hidden) .draggable(false) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function selected AST#parameter_list#Left ( AST#parameter#Left scanState : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AS...
@Extend(Image) function selected(scanState: boolean, x: number, y: number) { .width(40) .height(40) .position({ x: x, y: y }) .markAnchor({ x: 20, y: 20 }) .visibility(scanState ? Visibility.Visible : Visibility.Hidden) .draggable(false) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L32-L40
c2f03235b773599318e64272ea6cb89665a67ad1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarCalendar.ets
arkts
numberToChinese
数字转中文
private numberToChinese(num: number): string { const digits = ['○', '一', '二', '三', '四', '五', '六', '七', '八', '九']; return num.toString().split('').map(d => digits[parseInt(d)]).join(''); }
AST#method_declaration#Left private numberToChinese AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
private numberToChinese(num: number): string { const digits = ['○', '一', '二', '三', '四', '五', '六', '七', '八', '九']; return num.toString().split('').map(d => digits[parseInt(d)]).join(''); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarCalendar.ets#L214-L217
26285c53e596e7d371f3fdc04685bb286cbdd82d
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets
arkts
pushGlobalPreLoadPageRecord
存储预加载记录
pushGlobalPreLoadPageRecord(record: DMPPageRecord) { this.preLoadWebViewIdAndPageRecordMaps.set(record.webViewId, record) }
AST#method_declaration#Left pushGlobalPreLoadPageRecord AST#parameter_list#Left ( AST#parameter#Left record : AST#type_annotation#Left AST#primary_type#Left DMPPageRecord AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_state...
pushGlobalPreLoadPageRecord(record: DMPPageRecord) { this.preLoadWebViewIdAndPageRecordMaps.set(record.webViewId, record) }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets#L100-L102
05221353c83ce2e94c083829c304d72b1c77a3f3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Utils.ets
arkts
roundToNextSignificant
rounds the given number to the next significant number @param number @return
public static roundToNextSignificant(number: number): number { if (number == Number.MAX_VALUE || Number.isNaN(number) || number == 0.0) return 0; const d: number = Math.ceil(Math.log10(number < 0 ? -number : number)); const pw: number = 1 - Math.floor(d); const magnitude: number = Math....
AST#method_declaration#Left public static roundToNextSignificant AST#parameter_list#Left ( AST#parameter#Left number : 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 nu...
public static roundToNextSignificant(number: number): number { if (number == Number.MAX_VALUE || Number.isNaN(number) || number == 0.0) return 0; const d: number = Math.ceil(Math.log10(number < 0 ? -number : number)); const pw: number = 1 - Math.floor(d); const magnitude: number = Math....
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L172-L183
a8fa2ab10720d6c3494dbd56e627df461c799974
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
好友列表项
export interface FriendItem { friend_id: string; update_time: string; unread: number; notation: string; is_hidden: boolean; session_id: string; last_message: string; id: number; avatar: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface FriendItem AST#object_type#Left { AST#type_member#Left friend_id : 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 update_time : AST#type_annota...
export interface FriendItem { friend_id: string; update_time: string; unread: number; notation: string; is_hidden: boolean; session_id: string; last_message: string; id: number; avatar: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L91-L101
4358047ff28287fae982c2f2eb80ff3982b39b87
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets
arkts
getSelectedPlace
从TextPicker返回选中的数据中逐级查找省、市、区的名称,并将其组合成一个完整的地址字符串。
getSelectedPlace(selectArr: number | number []) { if (selectArr instanceof Array) { let province = this.cascade[selectArr[0]]; // 获取省信息 let areaName = ""; // 存储最终构建的省市区名称 if (province) { areaName += this.cascade[selectArr[0]].text; // 省的名称添加到容器里 if (province.children) { // 检查是否有市的信...
AST#method_declaration#Left getSelectedPlace AST#parameter_list#Left ( AST#parameter#Left selectArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right A...
getSelectedPlace(selectArr: number | number []) { if (selectArr instanceof Array) { let province = this.cascade[selectArr[0]]; let areaName = ""; if (province) { areaName += this.cascade[selectArr[0]].text; if (province.children) { let city = province.children[selectA...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets#L200-L219
713199cdb452eb8048e5a10cc9f153abbd71b083
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets
arkts
selectedLeftText
左边标题(固定在当前选项的左侧) @param selectedLeftText @returns
selectedLeftText(selectedLeftText: string) { this.builderOptions.selectedLeftText = selectedLeftText return this }
AST#method_declaration#Left selectedLeftText AST#parameter_list#Left ( AST#parameter#Left selectedLeftText : 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#expression_...
selectedLeftText(selectedLeftText: string) { this.builderOptions.selectedLeftText = selectedLeftText return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L39-L42
2391bc688b29bfbe7424ce63718a7171e559ec1e
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Ads Blocker Apply all files of EasyList rules in directory of filesDir/easylist.
export function apply_EasyList() { let lists = get_EasyLists(); let overall_rules = ''; for (let index = 0; index < lists.length; index++) { let new_paragraph = sandbox_read_text_sync('easylist/' + lists[index][0]); if (new_paragraph != 'undefined') { overall_rules += '\n' + new_paragraph; } }...
AST#export_declaration#Left export AST#function_declaration#Left function apply_EasyList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lists = AST#expression#Left AST#call_expression#Left AST#expression#L...
export function apply_EasyList() { let lists = get_EasyLists(); let overall_rules = ''; for (let index = 0; index < lists.length; index++) { let new_paragraph = sandbox_read_text_sync('easylist/' + lists[index][0]); if (new_paragraph != 'undefined') { overall_rules += '\n' + new_paragraph; } }...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L18-L33
cb004eb6907735691378d5f40d97bfe595b96d48
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/common/AppViewModel.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/12/6 23:28 @Version V1.0 @Description
export class AppViewModel extends FinViewModel<Repository> { constructor(context: Context) { super(context) } }
AST#export_declaration#Left export AST#class_declaration#Left class AppViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left FinViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Repository AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
export class AppViewModel extends FinViewModel<Repository> { constructor(context: Context) { super(context) } }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/common/AppViewModel.ets#L11-L17
31a20651dbc976e7ba1b45aff70e7b5d91183890
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
keys
Set the key value. @since 10
static keys(): Array<string> { throw new Error("Environment.Keys is not implemented") }
AST#method_declaration#Left static keys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
static keys(): Array<string> { throw new Error("Environment.Keys is not implemented") }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L329-L331
55a79b5c06d01facf744b0dd7a94f4ba85424644
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/ConnectionUtils.ets
arkts
The ConnectionUtils provides the network listening capability.
export class ConnectionUtils { netConnection = connection.createNetConnection(); /** *The method of checking whether the monitoring network is connected.. */ async isNetworkConnected(): Promise<boolean> { let result: boolean = false; await connection.getDefaultNet().then(async (data: connection.Net...
AST#export_declaration#Left export AST#class_declaration#Left class ConnectionUtils AST#class_body#Left { AST#property_declaration#Left netConnection = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . createNetConnection AS...
export class ConnectionUtils { netConnection = connection.createNetConnection(); async isNetworkConnected(): Promise<boolean> { let result: boolean = false; await connection.getDefaultNet().then(async (data: connection.NetHandle) => { if (data.netId === 0) { hilog.info(0x0000, TAG, 'networ...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/ConnectionUtils.ets#L13-L92
00711c4e79663a9c88f7df6acad09de69eb7236e
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
arkts
encodePKCS1Segment
加密-分段 @param str 待加密的字符串 @param pubKey RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static encodePKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
AST#method_declaration#Left static encodePKCS1Segment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
static encodePKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L69-L73
891242aaf98b9f071d652aeab9ed0db23321da30
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSTaskPool/entry/src/main/ets/pages/Index.ets
arkts
add
支持使用@Concurrent装饰器声明并校验并发函数
@Concurrent function add(num1: number, num2: number): number { return num1 + num2; }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function add AST#parameter_list#Left ( AST#parameter#Left num1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left num2 : AST#type_ann...
@Concurrent function add(num1: number, num2: number): number { return num1 + num2; }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSTaskPool/entry/src/main/ets/pages/Index.ets#L27-L30
490c34dec370c0eb5700167769bac8ab9b45e960
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/function/function_001_T.ets
arkts
Introduction 函数类型
export function function_001_T(taint_src : Function) { taint.Sink(taint_src) }
AST#export_declaration#Left export AST#function_declaration#Left function function_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le...
export function function_001_T(taint_src : Function) { taint.Sink(taint_src) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/function/function_001_T.ets#L6-L8
615a28cd635c8ca071992afa2d699e76f57d7833
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
setBadgeFromNotificationCount
设置桌面角标数量,来自于通知数量。
static async setBadgeFromNotificationCount(): Promise<void> { let count = await NotificationUtils.getActiveNotificationCount(); return notificationManager.setBadgeNumber(count); //设置角标 }
AST#method_declaration#Left static async setBadgeFromNotificationCount 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_annotat...
static async setBadgeFromNotificationCount(): Promise<void> { let count = await NotificationUtils.getActiveNotificationCount(); return notificationManager.setBadgeNumber(count); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L339-L342
62971528161dbb752e5b51b5976cc3b5112a4fe1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/DialogOptions.ets
arkts
两个按钮的AlertDialog参数类
export class PrimaryDialogOptions extends DialogOptions { primaryButton?: ButtonOptions | ResourceStr; secondaryButton?: ButtonOptions | ResourceStr; }
AST#export_declaration#Left export AST#class_declaration#Left class PrimaryDialogOptions extends AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left primaryButton ? : AST#type_annotation#Left AST#union_type#Lef...
export class PrimaryDialogOptions extends DialogOptions { primaryButton?: ButtonOptions | ResourceStr; secondaryButton?: ButtonOptions | ResourceStr; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L74-L77
6838fc8f52f8aa5022f220e6a407f131c52e32a2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
[End entry_ability_window_stage_created_after_specified_page_loaded]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/entryability/EntryAbility.ets#L43-L46
31aca79e5d8ef0f8eae5a0ab51f9ce11d2f4cf36
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
colorRgb
from Color.rgb() @param r @param g @param b
public static colorRgb(r: number, g: number, b: number): number { return 0xff000000 | (r << 16) | (g << 8) | b; }
AST#method_declaration#Left public static colorRgb AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left g : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
public static colorRgb(r: number, g: number, b: number): number { return 0xff000000 | (r << 16) | (g << 8) | b; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L231-L233
102472363e8c0ad8b81ba5b6f6b29433c94fc9a2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DateModel.ets
arkts
设置项的数据类
export class DateModel { day: number; week: number; month: number; year: number; constructor(day: number, week: number, month: number, year: number) { this.day = day; this.week = week; this.month = month; this.year = year; } }
AST#export_declaration#Left export AST#class_declaration#Left class DateModel AST#class_body#Left { AST#property_declaration#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left week : AST#type_an...
export class DateModel { day: number; week: number; month: number; year: number; constructor(day: number, week: number, month: number, year: number) { this.day = day; this.week = week; this.month = month; this.year = year; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DateModel.ets#L19-L31
a0db104062ef8905f9e3ce50ced64c4c16fde9bb
gitee
texiwustion/chinese-herbal-shopping--arkts.git
3f71338f3c6d88bc74342e0322867f3a0c2c17d1
entry/src/main/ets/database/Rdb.ets
arkts
deleteData
删除数据的方法,接收谓词和回调函数两个参数
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { // 如果回调函数为空、或undefined 打印错误日志,退出方法 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } // 创建结果标...
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callb...
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } let resFlag: boolean = false; ...
https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/Rdb.ets#L103-L127
ea764d7e5ed0d41fbf46dd9a17eb825ffd21164b
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/model/AdjustData.ets
arkts
Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l...
export enum Tasks { SCALE, CROP, ROTATE, TONING, TEXT, STICKER, ADJUST, MARK, NONE = 99 }
AST#export_declaration#Left export AST#enum_declaration#Left enum Tasks AST#enum_body#Left { AST#enum_member#Left SCALE AST#enum_member#Right , AST#enum_member#Left CROP AST#enum_member#Right , AST#enum_member#Left ROTATE AST#enum_member#Right , AST#enum_member#Left TONING AST#enum_member#Right , AST#enum_member#Left T...
export enum Tasks { SCALE, CROP, ROTATE, TONING, TEXT, STICKER, ADJUST, MARK, NONE = 99 }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/model/AdjustData.ets#L16-L26
1f84fa1998eb2770833a3c8cd37bf22e87a48ae3
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/BinarySearch.ets
arkts
findFirst
查找第一个等于目标值的元素 @param arr 已排序的数组 @param target 目标值 @returns 第一个等于目标值的元素索引,如果不存在则返回-1
public static findFirst(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; let result = -1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (arr[mid] === target) { ...
AST#method_declaration#Left public static findFirst AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation...
public static findFirst(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; let result = -1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (arr[mid] === target) { ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/BinarySearch.ets#L40-L63
176a8615625cf8d25a68c66525d0a488debd8296
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
saveDownload
将文件保存到Download目录(Download目录下当前应用包名对应的路径) @param filePath 待保存文件的沙箱路径 @returns
static async saveDownload(filePath: string): Promise<void> { const fileName = FileUtils.getFileName(filePath); const path = FileUtils.getDownloadPath(undefined, fileName); const file = FileUtils.openSync(path); await FileUtils.copyFile(filePath, file.fd).finally(() => { FileUtils.close(file.fd); ...
AST#method_declaration#Left static async saveDownload AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic...
static async saveDownload(filePath: string): Promise<void> { const fileName = FileUtils.getFileName(filePath); const path = FileUtils.getDownloadPath(undefined, fileName); const file = FileUtils.openSync(path); await FileUtils.copyFile(filePath, file.fd).finally(() => { FileUtils.close(file.fd); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L506-L513
ca2569568bb18214bd9c41d3479935cf157668c7
gitee
ali5669/ArkTSShopping.git
7065d61468d80c143788532337c499eb9eaa5ffd
entry/src/main/ets/viewmodel/ItemModel.ets
arkts
物品
export class Item{ id: string = '' title: string = '' image: ResourceStr = '' price: number = 0 specifications? :Specification[] = [] reviews?:String[]=[] }
AST#export_declaration#Left export AST#class_declaration#Left class Item AST#class_body#Left { AST#property_declaration#Left id AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right title : string = '' image ...
export class Item{ id: string = '' title: string = '' image: ResourceStr = '' price: number = 0 specifications? :Specification[] = [] reviews?:String[]=[] }
https://github.com/ali5669/ArkTSShopping.git/blob/7065d61468d80c143788532337c499eb9eaa5ffd/entry/src/main/ets/viewmodel/ItemModel.ets#L15-L22
5e131b049c3c7eda8e3c2bc055f5bbd7dd4bfdae
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
destroy
销毁 c++ 渲染实例
destroy() { this.instance.destroy() }
AST#method_declaration#Left destroy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#...
destroy() { this.instance.destroy() }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L474-L476
fa794b666ed1f66fc754d41311b2433ca15c72ab
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/receiver/VoiceReadable.ets
arkts
_push
应用约束45:显式标注参数和返回类型
_push(d: Object): void { if (this.open) this.push(d); }
AST#method_declaration#Left _push AST#parameter_list#Left ( AST#parameter#Left d : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_a...
_push(d: Object): void { if (this.open) this.push(d); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/receiver/VoiceReadable.ets#L17-L19
2df884847638fa895e4492c076ec0206d7f50b8d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
getAddressFromLocation
逆地理编码,将坐标转换为地理描述(无需申请定位权限) @param latitude 纬度 @param longitude 经度 @returns 逆编码后对象
static async getAddressFromLocation(latitude: number, longitude: number): Promise<geoLocationManager.GeoAddress> { let geoAddress = await LocationUtil.getGeoAddressFromLocation(latitude, longitude, 1); if (geoAddress != null && geoAddress.length >= 1) { return geoAddress[0]; } return {}; }
AST#method_declaration#Left static async getAddressFromLocation AST#parameter_list#Left ( AST#parameter#Left latitude : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left longitude : AST#type_annotation#Left AST#primary_type#Le...
static async getAddressFromLocation(latitude: number, longitude: number): Promise<geoLocationManager.GeoAddress> { let geoAddress = await LocationUtil.getGeoAddressFromLocation(latitude, longitude, 1); if (geoAddress != null && geoAddress.length >= 1) { return geoAddress[0]; } return {}; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L264-L270
bb259e3b71666e41a441e4f04e95b15e33246f23
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets
arkts
get
应用约束:显式类型标注(错误10)
get name(): string | undefined { return this.file?.name; }
AST#method_declaration#Left get AST#ERROR#Left name AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#union_type#Right AST#type_annotation#Ri...
get name(): string | undefined { return this.file?.name; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets#L21-L23
f584651ad6960a74ae8f213104d8f1a011a2a6e9
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
insertValues
Insert steps to database. @param {number} stepsValue Value of steps. @param {DataRdb.RdbStore} rdbStore RDB database.
async insertValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let now: string = DateUtils.getDate(0); let sensorData: SensorData = new SensorData(); sensorData.date = now; sensorData.stepsValue = stepsValue; // Check whether there is data today. let todayData: SensorData = await this.getS...
AST#method_declaration#Left async insertValues AST#parameter_list#Left ( AST#parameter#Left stepsValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified...
async insertValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let now: string = DateUtils.getDate(0); let sensorData: SensorData = new SensorData(); sensorData.date = now; sensorData.stepsValue = stepsValue; let todayData: SensorData = await this.getSensorData(rdbStore, now); if (tod...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets#L80-L97
a64b40c3cdf2fcc23eb5a8a6c9ecaba8e5799495
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
createCustomTheme
创建自定义主题
async createCustomTheme(name: string, baseTheme: ThemeType, customizations: Partial<ThemeConfig>): Promise<string> { try { const baseColorTheme = this.getColorThemeByType(baseTheme); if (!baseColorTheme) { throw new Error('基础主题不存在'); } const customTheme: ThemeConfig = { mode...
AST#method_declaration#Left async createCustomTheme AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left baseTheme : AST#type_annotation#Left AST#primary_type#Left ThemeType AST...
async createCustomTheme(name: string, baseTheme: ThemeType, customizations: Partial<ThemeConfig>): Promise<string> { try { const baseColorTheme = this.getColorThemeByType(baseTheme); if (!baseColorTheme) { throw new Error('基础主题不存在'); } const customTheme: ThemeConfig = { mode...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L411-L455
ca22342a0cb20032b8069926e4e48589269bbb7f
github
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/components/OptionDialogComponent.ets
arkts
OptionDialogComponent
@description: 修改新别弹窗 @date: 2024-01-14 21:47 @author wuwenqiang
@CustomDialog export default struct OptionDialogComponent { controller: CustomDialogController cancel: () => void = () => { }; confirm: (value: string,index:number) => void = () => { }; options: Array<string> = [] build() { Column() { Column() { ForEach(this.options, (item: string, inde...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct OptionDialogComponent AST#component_body#Left { AST#property_declaration#Left controller : AST#ERROR#Left CustomDialogController cancel : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#...
@CustomDialog export default struct OptionDialogComponent { controller: CustomDialogController cancel: () => void = () => { }; confirm: (value: string,index:number) => void = () => { }; options: Array<string> = [] build() { Column() { Column() { ForEach(this.options, (item: string, inde...
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/components/OptionDialogComponent.ets#L9-L58
b1dbe29d6bcc2a5df4480bd72ad01dd6c8512bfe
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/AgreementView.ets
arkts
webView
Web 视图
@Builder webView() { Stack({ alignContent: Alignment.Center }) { // Web 视图 Web({ src: this.agreementVM?.currentUrl, controller: this.controller }) .width('100%') .layoutWeight(1) .backgroundColor($r('sys.color.comp_background_primary')) .onPageBegin(() => { th...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right webView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Le...
@Builder webView() { Stack({ alignContent: Alignment.Center }) { Web({ src: this.agreementVM?.currentUrl, controller: this.controller }) .width('100%') .layoutWeight(1) .backgroundColor($r('sys.color.comp_background_primary')) .onPageBegin(() => { this.agreem...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/AgreementView.ets#L45-L73
90bf08fc4a0a537bcbb2228539317227b0651fce
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets
arkts
fetchFromDisk
从磁盘中取回数据 @param key 键值
fetchFromDisk(key: string): null | ResponseDataType { let res = this.cache.get(key); if (!res) { return null; } return res; }
AST#method_declaration#Left fetchFromDisk 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_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left null AST...
fetchFromDisk(key: string): null | ResponseDataType { let res = this.cache.get(key); if (!res) { return null; } return res; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets#L41-L47
cd12930b1e871e91321b07b03202f2519c6073bf
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets
arkts
play
MARK: - 公共方法 [停止并清空后]直接播放 @param text 音频资源URI(支持网络路径或本地文件路径)
public async play(text: string | null | undefined): Promise<void> { if (!text) { return } await VolumeChecker.checkVolume() this.stopAndClear(); await this.loadSound(text); }
AST#method_declaration#Left public async play AST#parameter_list#Left ( AST#parameter#Left text : 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#primary_type#Left undefined AST#primary_type#Right AST#union_type#R...
public async play(text: string | null | undefined): Promise<void> { if (!text) { return } await VolumeChecker.checkVolume() this.stopAndClear(); await this.loadSound(text); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets#L44-L50
e701f1e0d96b2b60f058c210ac692bb42e24e274
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DbFileUtility.ets
arkts
文件工具类 提供数据库文件拷贝、ZIP解压等常用文件操作方法
export class DbFileUtility { // ==================== 公有方法 ==================== /** * 同步方式从资源目录拷贝数据库文件到指定位置 * @param context Ability上下文 - 提供资源访问能力 * @param fromPath 源文件路径(相对于resources/rawfile目录) * @param toPath 目标文件绝对路径 */ // static async copyDatabaseFromAssetsIfNeeds(context: common.Context, fromP...
AST#export_declaration#Left export AST#class_declaration#Left class DbFileUtility AST#class_body#Left { // ==================== 公有方法 ==================== /** * 同步方式从资源目录拷贝数据库文件到指定位置 * @param context Ability上下文 - 提供资源访问能力 * @param fromPath 源文件路径(相对于resources/rawfile目录) * @param toPath 目标文件绝对路径 */ // stati...
export class DbFileUtility { static async copyDatabaseFromAssetsIfNeeds(context: common.Context, fromPath: string, toPath: string) { const dbExist = DbFileUtility.checkDataBaseExists(toPath); if (!dbExist) { ; ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L21-L195
e330b6a63b9e0b0bfcbd6f3551f50272d4e70780
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildJsonPreview
构建JSON预览
@Builder buildJsonPreview() { if (this.showJsonPreview && this.jsonParseResult) { Column({ space: 12 }) { Text('JSON解析预览') .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) if (this.jsonParseResult.errors.length > 0) { Column({ space: 8 }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildJsonPreview AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_express...
@Builder buildJsonPreview() { if (this.showJsonPreview && this.jsonParseResult) { Column({ space: 12 }) { Text('JSON解析预览') .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) if (this.jsonParseResult.errors.length > 0) { Column({ space: 8 }) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L497-L583
29f67c835920769706d0c9e47a3bcdec2f2f7a24
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
offBLECharacteristicChange
取消订阅服务端的特征值变化
private offBLECharacteristicChange() { Log.showInfo(TAG, `offBLECharacteristicChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `offBLECharacteristicChange: mGattClientDevice is null`); return; } this.mGattClientDevice.off('BLECharacteristicChange'); }
AST#method_declaration#Left private offBLECharacteristicChange 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 Log AST#expression#Right . sh...
private offBLECharacteristicChange() { Log.showInfo(TAG, `offBLECharacteristicChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `offBLECharacteristicChange: mGattClientDevice is null`); return; } this.mGattClientDevice.off('BLECharacteristicChange'); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L342-L350
074c4416c3586baa9694f39dab32252ef3aa4929
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/RotationGesture.ets
arkts
Rotation
[Start catch_rotation_gesture_event]
@Entry @Component export struct Rotation { @State angle: number = 0; @State rotateValue: number = 0; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('RotationGesture angle:' + this.angle).fontSize(28) // 在组件上绑定旋转布局,可以通过修改旋转角度来实现组件的旋转 .rotat...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Rotation AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right angle : AST#type_annotation#Left AST#primary_type#Left num...
@Entry @Component export struct Rotation { @State angle: number = 0; @State rotateValue: number = 0; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('RotationGesture angle:' + this.angle).fontSize(28) .rotate({ angle: this.angle }) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/RotationGesture.ets#L17-L65
c37b5a56a67971633b91093003bc788bbd37f065
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
buildContactResultItem
构建联系人结果项
@Builder buildContactResultItem(contact: Contact) { Row({ space: 12 }) { // 头像 Image(contact.avatar || $r('app.media.ic_avatar_default')) .width(40) .height(40) .borderRadius(20) .objectFit(ImageFit.Cover) // 信息 Column({ space: 4 }) { Text(con...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactResultItem AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
@Builder buildContactResultItem(contact: Contact) { Row({ space: 12 }) { Image(contact.avatar || $r('app.media.ic_avatar_default')) .width(40) .height(40) .borderRadius(20) .objectFit(ImageFit.Cover) Column({ space: 4 }) { Text(contact.name)...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L480-L530
32b46b44eeacdd03ae133387c0b47d83da5e3a70
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/product/phone/entry/src/main/ets/utils/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, soft...
export default class Constants { // Tab下标为0 public static readonly TAB_INDEX_0: number = 0; // Tab下标为1 public static readonly TAB_INDEX_1: number = 1; // Tab下标为2 public static readonly TAB_INDEX_2: number = 2; // 计时器,每隔1s执行一次 public static readonly SETINTERVAL_TIME: number = 1000; // borderWidth pub...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // Tab下标为0 AST#property_declaration#Left public static readonly TAB_INDEX_0 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#exp...
export default class Constants { public static readonly TAB_INDEX_0: number = 0; public static readonly TAB_INDEX_1: number = 1; public static readonly TAB_INDEX_2: number = 2; public static readonly SETINTERVAL_TIME: number = 1000; public static readonly BORDERWIDTH: number = 1; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/product/phone/entry/src/main/ets/utils/Constants.ets#L16-L27
244ca39380adf504c44216b12e2f6954c6bcb9f4
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
argb
from Color.argb() @param alpha @param red @param green @param blue
public static argb(alpha: number, red: number, green: number, blue: number): number { return (alpha << 24) | (red << 16) | (green << 8) | blue; }
AST#method_declaration#Left public static argb AST#parameter_list#Left ( AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
public static argb(alpha: number, red: number, green: number, blue: number): number { return (alpha << 24) | (red << 16) | (green << 8) | blue; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L242-L244
7c8f74dce903ad055dded9cb1f490ba172a00905
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/components/HcLoadingDialog.ets
arkts
HcLoadingDialog
自定义弹窗装饰器
@CustomDialog export struct HcLoadingDialog { // 控制器控制组件的开关 // 控制器应该是外部new好的 控制组件自身 xx: CustomDialogController // 文案 @Prop message: string = '加载中...' @StorageProp('isDark') isDark: boolean = false//主题色 build() { Column() { Column({ space: 10 }) { LoadingProgress() .width(48) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct HcLoadingDialog AST#component_body#Left { // 控制器控制组件的开关 // 控制器应该是外部new好的 控制组件自身 AST#property_declaration#Left xx : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#t...
@CustomDialog export struct HcLoadingDialog { xx: CustomDialogController @Prop message: string = '加载中...' @StorageProp('isDark') isDark: boolean = false build() { Column() { Column({ space: 10 }) { LoadingProgress() .width(48) .height(48) .color($r('app.c...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/components/HcLoadingDialog.ets#L2-L30
2f04860eaf20a66a92c2a1f464d68ed3107b4b40
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets
arkts
getSupportedColorSpaces
查询支持的色彩空间。
function getSupportedColorSpaces(session: camera.VideoSession): colorSpaceManager.ColorSpace[] { let colorSpaces: colorSpaceManager.ColorSpace[] = []; try { colorSpaces = session.getSupportedColorSpaces(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `The getSupportedColorSpac...
AST#function_declaration#Left function getSupportedColorSpaces AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
function getSupportedColorSpaces(session: camera.VideoSession): colorSpaceManager.ColorSpace[] { let colorSpaces: colorSpaceManager.ColorSpace[] = []; try { colorSpaces = session.getSupportedColorSpaces(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `The getSupportedColorSpac...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets#L104-L113
79807b5e40b58c74fff5386356b083fb4fc94d20
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets
arkts
onDragMaterial
素材的拖拽
onDragMaterial(dx: number, dy: number): void { this.x = this.x + dx; this.y = this.y + dy; }
AST#method_declaration#Left onDragMaterial AST#parameter_list#Left ( AST#parameter#Left dx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dy : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
onDragMaterial(dx: number, dy: number): void { this.x = this.x + dx; this.y = this.y + dy; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets#L111-L114
829274079b7de8c28525da998d6166b3983b4c1f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
backup
备份数据库 @param callback 版本升级方法 @param version 版本
async backup(version: number): Promise<void> { if (store === undefined) { return; } await store.backup(version + Constants.DB_FILE_NAME_SUFFIX); }
AST#method_declaration#Left async backup AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pro...
async backup(version: number): Promise<void> { if (store === undefined) { return; } await store.backup(version + Constants.DB_FILE_NAME_SUFFIX); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L191-L196
a8b8e27a48268c392d99278055f96fd81d2948b2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
buildContactResultItem
构建联系人结果项
@Builder buildContactResultItem(contact: Contact) { Row({ space: 12 }) { // 头像 if (contact.avatar) { Image(contact.avatar) .width('40vp') .height('40vp') .borderRadius(20) .objectFit(ImageFit.Cover) } else { Text(contact.name.charAt(0)) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactResultItem AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
@Builder buildContactResultItem(contact: Contact) { Row({ space: 12 }) { if (contact.avatar) { Image(contact.avatar) .width('40vp') .height('40vp') .borderRadius(20) .objectFit(ImageFit.Cover) } else { Text(contact.name.charAt(0)) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L480-L540
91d72e003af2cf080456d780fa6b3ea158a911e3
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/bluetooth.ets
arkts
showPairingFailedDialog
Show pairing failed title Dialog
private showPairingFailedDialog() { showDialog( $r("app.string.pairing_failed_title"), $r("app.string.pairing_failed_message"), $r("app.string.bluetooth_know_button") ); }
AST#method_declaration#Left private showPairingFailedDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left showDialog ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.pairing_failed_title" AST#expression...
private showPairingFailedDialog() { showDialog( $r("app.string.pairing_failed_title"), $r("app.string.pairing_failed_message"), $r("app.string.bluetooth_know_button") ); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L648-L654
dfa5436fa6e0c8e7e9780442b97d73d8e2b4a876
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/url.ets
arkts
_resolve
==================== 相对URL解析 ====================
private _resolve(relative: string, base: URL): string { // 如果已经是绝对URL if (/^[a-z][a-z0-9+\-.]*:/i.test(relative)) { return relative; } let result = ""; // 处理协议相对URL (//) if (relative.startsWith("//")) { return base.protocol + relative; } ...
AST#method_declaration#Left private _resolve AST#parameter_list#Left ( AST#parameter#Left relative : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left base : AST#type_annotation#Left AST#primary_type#Left URL AST#primary_type#...
private _resolve(relative: string, base: URL): string { if (/^[a-z][a-z0-9+\-.]*:/i.test(relative)) { return relative; } let result = ""; if (relative.startsWith("//")) { return base.protocol + relative; } if (relative...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L451-L486
97b43838e330e8afa61c036d3149467cf90f6804
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets
arkts
Tag
标签类
@Observed export class Tag { label: string = ""; bgColor: Resource | string = ""; fontColor: Resource | string = ""; constructor(label: string, bgColor: Resource | string, fontColor: Resource | string) { this.label = label; this.bgColor = bgColor; this.fontColor = fontColor; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Tag AST#class_body#Left { AST#property_declaration#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#...
@Observed export class Tag { label: string = ""; bgColor: Resource | string = ""; fontColor: Resource | string = ""; constructor(label: string, bgColor: Resource | string, fontColor: Resource | string) { this.label = label; this.bgColor = bgColor; this.fontColor = fontColor; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets#L47-L60
c0dc777f5f1c860334458246a077347ccdccc88b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkBooksDownloadable
/ 检查 是否能下载 是否可用
public checkBooksDownloadable(showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 const booksCnt = BookManager.shared.books.length if (this.maxFreeBooksCount <= booksCnt) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_download...
AST#method_declaration#Left public checkBooksDownloadable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ...
public checkBooksDownloadable(showMessage: boolean = true): boolean { if (this.isActive) { return true } const booksCnt = BookManager.shared.books.length if (this.maxFreeBooksCount <= booksCnt) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_download_books')) ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L244-L257
f76db47716bc12f3f83bbfe59534bea21e0bfcf2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
聊天选择项接口
export interface ChatChoice { index: number; message: ChatMessage; finishReason: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChatChoice AST#object_type#Left { AST#type_member#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left message : AST#type_annotation#Lef...
export interface ChatChoice { index: number; message: ChatMessage; finishReason: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L45-L49
17eeb1096dca1000f91703bd1e4c783abd6dcf3d
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
Clamp a number into [min, max]. @param val Input value. @param min Minimum. @param max Maximum. @returns Clamped value.
export function clamp(val: number, min: number, max: number): number { if (val < min) { return min; } if (val > max) { return max; } return val; }
AST#export_declaration#Left export AST#function_declaration#Left function clamp AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left min : AST#type_annotation#Left AST#primary_ty...
export function clamp(val: number, min: number, max: number): number { if (val < min) { return min; } if (val > max) { return max; } return val; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L325-L333
b7ec41dc703363e1ad5ea5f0a573ecb87305e36b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
cancelReminder
取消提醒
async cancelReminder(reminderId: string): Promise<void> { try { const config = this.activeReminders.get(reminderId); if (!config) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Reminder not found: ${reminderId}`); return; } const notificatio...
AST#method_declaration#Left async cancelReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
async cancelReminder(reminderId: string): Promise<void> { try { const config = this.activeReminders.get(reminderId); if (!config) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Reminder not found: ${reminderId}`); return; } const notificatio...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L357-L378
6e7959fd1a95024eccf0fe43f147397ed98f385b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
getNetBearType
获取网络类型。
static getNetBearType(): connection.NetBearType { return NetworkUtil.getNetBearTypes()[0]; }
AST#method_declaration#Left static getNetBearType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left...
static getNetBearType(): connection.NetBearType { return NetworkUtil.getNetBearTypes()[0]; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L184-L186
e130967192a13d1e77234ea3fa4c04a9167d159f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/NotificationTypes.ets
arkts
通知创建参数接口
export interface NotificationCreationParams { type: NotificationType; title: string; content: string; priority?: NotificationPriority; relatedContactId?: string; actionUrl?: string; metadata?: Record<string, string>; actions?: NotificationAction[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationCreationParams AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left NotificationType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : ...
export interface NotificationCreationParams { type: NotificationType; title: string; content: string; priority?: NotificationPriority; relatedContactId?: string; actionUrl?: string; metadata?: Record<string, string>; actions?: NotificationAction[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L35-L44
667787a608eab6324375e0698534ae198205599b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptGCMSync
解密(GCM模式),同步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。 @returns
static decryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): cryptoFramework.DataBlob { let decoder = cryptoFramework.createCipher(transformation); decoder.initSync(cryptoFramework.CryptoMode.DEC...
AST#method_declaration#Left static decryptGCMSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe...
static decryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): cryptoFramework.DataBlob { let decoder = cryptoFramework.createCipher(transformation); decoder.initSync(cryptoFramework.CryptoMode.DEC...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L91-L99
5b35c287955acf5df7268623b132c249752a7427
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/GreetingsPage.ets
arkts
getStyleColor
获取样式颜色
private getStyleColor(style: GreetingStyle): string { const colors: Record<GreetingStyle, string> = { [GreetingStyle.WARM]: '#ff6b6b', [GreetingStyle.FORMAL]: '#495057', [GreetingStyle.HUMOROUS]: '#ffa500', [GreetingStyle.POETIC]: '#9c88ff', [GreetingStyle.SIMPLE]: '#20c997' }; ...
AST#method_declaration#Left private getStyleColor AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
private getStyleColor(style: GreetingStyle): string { const colors: Record<GreetingStyle, string> = { [GreetingStyle.WARM]: '#ff6b6b', [GreetingStyle.FORMAL]: '#495057', [GreetingStyle.HUMOROUS]: '#ffa500', [GreetingStyle.POETIC]: '#9c88ff', [GreetingStyle.SIMPLE]: '#20c997' }; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L638-L647
7e2b744428f80728eba55f6dd73c6474abd05058
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarData.ets
arkts
getEntryForHighlight
@Override
public getEntryForHighlight(highlight: Highlight): EntryOhos { return super.getDataSetByIndex(highlight.getDataSetIndex()).getEntryForIndex(highlight.getX()); }
AST#method_declaration#Left public getEntryForHighlight AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Entry...
public getEntryForHighlight(highlight: Highlight): EntryOhos { return super.getDataSetByIndex(highlight.getDataSetIndex()).getEntryForIndex(highlight.getX()); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarData.ets#L46-L48
a234c195c142e1cce1792bbdb7d365ac39f8843f
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
setPhotoBrowserItem
Set photo browser item to picker component. @param { string } uri - specify image uri for photo browsing @param { PhotoBrowserRange } photoBrowserRange - photo browser slide range @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void;
AST#method_declaration#Left setPhotoBrowserItem AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left photoBrowserRange ? : AST#type_annotation#Left AST#primary_type#Left PhotoBro...
setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L279-L279
49a84978ad795c10fc973282d3213e68ff770c22
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/privacy.ets
arkts
PermissionComponent
Permission Manager Component
@Component export struct PermissionComponent { @State isTouched: boolean = false; private TAG = `${ConfigData.TAG} PrivacySettings PermissionComponent `; build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text($r('app.string.permissionManager')...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PermissionComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isTouched : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#...
@Component export struct PermissionComponent { @State isTouched: boolean = false; private TAG = `${ConfigData.TAG} PrivacySettings PermissionComponent `; build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text($r('app.string.permissionManager')...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/privacy.ets#L68-L138
4ff9a003adc93c93338c3d9a5dea436e9cf28ac2
gitee
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/globals/event.ets
arkts
queryUserCard
UserCard
public async queryUserCard() { logger.info('AppEvent.queryUserCard is called') const newCard = await UserDatabaser.queryUserCard() await store.storeCard(newCard) return newCard }
AST#method_declaration#Left public async queryUserCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Ri...
public async queryUserCard() { logger.info('AppEvent.queryUserCard is called') const newCard = await UserDatabaser.queryUserCard() await store.storeCard(newCard) return newCard }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L73-L78
a3730a592edc36d9dc3b53ede93b7dee471c1909
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
getDatasSync
/同步方法,需要提前初始化isInitialized
getDatasSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): T[] | null { if (!this.isInitialized) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); // 假设存在同步API DebugLog.d(sql +' 参数: ' + params) const res...
AST#method_declaration#Left getDatasSync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right...
getDatasSync<T>( sql: string, params: ParamType[] = [], handler: (rs: relationalStore.ResultSet) => T ): T[] | null { if (!this.isInitialized) return null; try { const resultSet = this.rdbStore!.querySqlSync(sql, params); DebugLog.d(sql +' 参数: ' + params) const results: T[] = ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L181-L201
56154b56bd9d70c4bd553317cfc19bbd1310881c
github
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets
arkts
getRectInfoById
根据组件的id获取组件的位置信息
private getRectInfoById(id: string): RectInfoInPx { let componentInfo: componentUtils.ComponentInfo = componentUtils.getRectangleById(id); if (!componentInfo) { throw Error('object is empty'); } let rstRect: RectInfoInPx = new RectInfoInPx(); const widthScaleGap = componentInfo.size.width * ...
AST#method_declaration#Left private getRectInfoById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RectInfoInPx AST#pr...
private getRectInfoById(id: string): RectInfoInPx { let componentInfo: componentUtils.ComponentInfo = componentUtils.getRectangleById(id); if (!componentInfo) { throw Error('object is empty'); } let rstRect: RectInfoInPx = new RectInfoInPx(); const widthScaleGap = componentInfo.size.width * ...
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets#L60-L87
0596d621c126bcd2d846872a50ed159a16b3968a
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
Initialization requires UIContext to be obtained in Ability.
export const createNWeb = (url: string, uiContext: UIContext) => { // Create NodeController let baseNode: MyNodeController = new MyNodeController(); let controller: WebviewController = new webview.WebviewController(); // Initialize a custom web component baseNode.initWeb(url, uiContext, controller); control...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left createNWeb = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#param...
export const createNWeb = (url: string, uiContext: UIContext) => { let baseNode: MyNodeController = new MyNodeController(); let controller: WebviewController = new webview.WebviewController(); baseNode.initWeb(url, uiContext, controller); controllerMap.set(url, controller); NodeMap.set(url, baseNode); }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L111-L119
6df7e4300eeaa31bef493d211b2bd95bd8888298
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/social/UserProfilePage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/UserProfilePage.ets#L83-L144
a294b2bc37f5bac290c05ee176345aa8c2b7079c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeCBC128
加密-CBC模式-128位 @param str 待加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeCBC128(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeCBC128 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static encodeCBC128(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L139-L142
951a4a5344201e803cce9c00cab3926ef56d596b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
生产版本:移除测试联系人功能 构建页面UI
build() { Column() { // 测试文本 - 确保页面被渲染 Text('🎂 生日提醒应用 - 测试版本') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#000000') .backgroundColor('#ffff00') .padding(20) .width('100%') .textAlign(TextAlign.Center) // 调试信息 Text(`数据状态:总数...
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 Text ( AST#expression#Left '🎂 生日提醒应用...
build() { Column() { Text('🎂 生日提醒应用 - 测试版本') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#000000') .backgroundColor('#ffff00') .padding(20) .width('100%') .textAlign(TextAlign.Center) Text(`数据状态:总数${this.birthdayStats.tot...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L163-L201
c4374ce2f0d1722a8da87aca1bae18149de2090b
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Scrolls.ets
arkts
bodyBuilder
内容展示(自定义builder渲染)
@Builder bodyBuilder() { Column(){ // 绑定事件 Text('绑定事件') .fontSize(14) .margin({ top:20, bottom: 12}) Scroll(this.bodyScroller) { Column() { ForEach(this.numberData, (item: number, index: number) => { Text(item.toString()) .width('90%') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 绑定事件 AST#arkts...
@Builder bodyBuilder() { Column(){ Text('绑定事件') .fontSize(14) .margin({ top:20, bottom: 12}) Scroll(this.bodyScroller) { Column() { ForEach(this.numberData, (item: number, index: number) => { Text(item.toString()) .width('90%') ...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Scrolls.ets#L48-L89
becd97406f4ef1ba772ae869c9df62b480ca2ee2
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets
arkts
addListener
添加生命周期监听 @param callback @param inRootView 当前页面是否是Navigation根视图中 可选参数
public addListener(callback: LifecycleCallback, inRootView: boolean = false) { RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView); }
AST#method_declaration#Left public addListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left LifecycleCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left inRootView : AST#type_annotation#Left AST#primary_type#Left bo...
public addListener(callback: LifecycleCallback, inRootView: boolean = false) { RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView); }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L47-L49
c2b926014e09ed2729de8c2f9a51ba65ec596134
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/backgroundblur/Index.ets
arkts
TabsSample
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 { TabsSample } from './src/main/ets/pages/TabsSample';
AST#export_declaration#Left export { TabsSample } from './src/main/ets/pages/TabsSample' ; AST#export_declaration#Right
export { TabsSample } from './src/main/ets/pages/TabsSample';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/backgroundblur/Index.ets#L16-L16
763a637e9c992cb5b17a95ddc14bc4f31a6acf7e
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets
arkts
registerDataChangeListener
Add a listener to the data source of the LazyForEach component.
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets#L45-L49
15051e678488e3465826eeba4fdf12faba75326c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinQ.ets
arkts
SpinQ
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinQ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.15 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinQ AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinQ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.15 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinQ.ets#L22-L439
dc3cda43c455ae45c32538a04ec3207c3815e0df
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets
arkts
updateBookDbIfNeeds
更新指定 baseName 的 BookDb
public updateBookDbIfNeeds(baseName: string, proccessing: ((percent: number) => void) | null = null, finished: (succeed: boolean, msg: string | null) => void): void { ///这里不需要决断本地bundle是否存在,这样可难过服务器任意添加新的Book,只需要控制Book.sqlite即可。 ///iOS和Android版本 也要去掉这个判断条件 by ko 2025.09.27 // /// 判断本地 bundle 是否有? // c...
AST#method_declaration#Left public updateBookDbIfNeeds AST#parameter_list#Left ( AST#parameter#Left baseName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#union_type#Left AST#pr...
public updateBookDbIfNeeds(baseName: string, proccessing: ((percent: number) => void) | null = null, finished: (succeed: boolean, msg: string | null) => void): void { this.downloader.getFileMeta(new CBookDbPath(baseName).fileName, (info, msg) => { if (info) { ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L99-L128
44f9981cdec907dae4c3730a61fe7f518d41f262
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/PanGesture.ets
arkts
Pan
[Start catch_pan_gesture_event]
@Entry @Component export struct Pan { @State offsetX: number = 0; @State offsetY: number = 0; @State positionX: number = 0; @State positionY: number = 0; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('PanGesture Offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Pan AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right offsetX : AST#type_annotation#Left AST#primary_type#Left number...
@Entry @Component export struct Pan { @State offsetX: number = 0; @State offsetY: number = 0; @State positionX: number = 0; @State positionY: number = 0; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('PanGesture Offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/PanGesture.ets#L17-L66
61c3bd95ba2dd075b66945db5496d5e1b719eb33
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
getXOffset
Returns the used offset on the x-axis for drawing the axis or legend labels. This offset is applied before and after the label. @return
public getXOffset(): number { return this.mXOffset; }
AST#method_declaration#Left public getXOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public getXOffset(): number { return this.mXOffset; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L60-L62
fd61b82391b85a15b3ce210c610619a0c29ed607
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/sync/EncryptionService.ets
arkts
generateSecurePassword
生成安全随机密码
generateSecurePassword(length: number = 32): string { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'; let password = ''; for (let i = 0; i < length; i++) { const randomIndex = Math.floor(Math.random() * chars.length); password += chars[randomIndex]; ...
AST#method_declaration#Left generateSecurePassword AST#parameter_list#Left ( AST#parameter#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 32 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
generateSecurePassword(length: number = 32): string { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'; let password = ''; for (let i = 0; i < length; i++) { const randomIndex = Math.floor(Math.random() * chars.length); password += chars[randomIndex]; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/EncryptionService.ets#L114-L124
a33cf93c9e4ca59e845029b48848759c6f293f4f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
isHighlightFullBarEnabled
@return true the highlight operation is be full-bar oriented, false if single-value @Override
public isHighlightFullBarEnabled(): boolean { return this.mHighlightFullBarEnabled; }
AST#method_declaration#Left public isHighlightFullBarEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left A...
public isHighlightFullBarEnabled(): boolean { return this.mHighlightFullBarEnabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L251-L253
8039c84fe7a04fb9d12c45ce04af0fff0cac2894
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildStatCard
统计卡片
@Builder buildStatCard(icon: string, count: string, label: string, color: string) { Column({ space: 8 }) { Text(icon) .fontSize(28) Text(count) .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor(color) Text(label) .fontSize(12) .fontColor(this...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStatCard AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left ...
@Builder buildStatCard(icon: string, count: string, label: string, color: string) { Column({ space: 8 }) { Text(icon) .fontSize(28) Text(count) .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor(color) Text(label) .fontSize(12) .fontColor(this...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1410-L1433
4069c2b503db74055cac012311a24eac8029c092
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/UserModel.ets
arkts
toJson
转换为JSON对象
toJson(): UserJsonData { const data: UserJsonData = { id: this.id, username: this.username, password: this.password, like: this.like, history: this.history, phone: this.phone, createdTime: this.createdTime, lastLoginTime: this.lastLoginTime, avatar: this.avatar ...
AST#method_declaration#Left toJson AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserJsonData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data : AST...
toJson(): UserJsonData { const data: UserJsonData = { id: this.id, username: this.username, password: this.password, like: this.like, history: this.history, phone: this.phone, createdTime: this.createdTime, lastLoginTime: this.lastLoginTime, avatar: this.avatar ...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L80-L93
484bde6590ad46e1e1fb09df1c17e396bbe72255
github