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
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
普通文本通知配置项(基础通知类型)
export interface NotificationBasicOptions extends NotificationOptions { /** 通知主标题(不可为空字符串) */ mainTitle: string; /** 通知核心内容(不可为空字符串) */ mainContent: string; /** 通知补充内容(对核心内容的额外说明,可选) */ supplementaryContent?: string; /** 通知在锁屏界面显示的图片(可选) */ lockscreenDisplayImage?: image.PixelMap; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationBasicOptions AST#extends_clause#Left extends NotificationOptions AST#extends_clause#Right AST#object_type#Left { /** 通知主标题(不可为空字符串) */ AST#type_member#Left mainTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
export interface NotificationBasicOptions extends NotificationOptions { mainTitle: string; mainContent: string; supplementaryContent?: string; lockscreenDisplayImage?: image.PixelMap; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L548-L557
6d769cde330fd97f3ffc558ca68c40a57672b15f
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/style/PickerStyle.ets
arkts
文本选择器 样式
export class PickerStyle implements IPickerDialogStyle { /** * 弹窗标题区域 按钮 字体大小 * @default 16 */ buttonFontSize: Length = 16 /** * 左侧按钮的字体颜色(即:取消) */ buttonFontColorPrimary: ResourceColor = $r("app.color.harmony_dialog_title_color"); /** * 右侧按钮的字体颜色(即:确定) */ buttonFontColorSecondary: Reso...
AST#export_declaration#Left export AST#ERROR#Left class PickerStyle AST#implements_clause#Left implements IPickerDialogStyle AST#implements_clause#Right { /** * 弹窗标题区域 按钮 字体大小 * @default 16 */ AST#property_declaration#Left buttonFontSize AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Length AS...
export class PickerStyle implements IPickerDialogStyle { buttonFontSize: Length = 16 buttonFontColorPrimary: ResourceColor = $r("app.color.harmony_dialog_title_color"); buttonFontColorSecondary: ResourceColor = $r("app.color.harmony_dialog_title_color"); headerStyle: ITextStyle = { background: $...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/PickerStyle.ets#L12-L83
bb7e7b14c65b6b30f125b1505339db460f9ac259
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
margin or font size
export const enum MARGIN_FONT_SIZE { FIRST_MARGIN = 12, SECOND_MARGIN = 16, THIRD_MARGIN = 18, FOURTH_MARGIN = 24, FIFTH_MARGIN = 50, SIXTH_MARGIN = 94, SEVENTH_MARGIN = 132 }
AST#export_declaration#Left export AST#enum_declaration#Left const enum MARGIN_FONT_SIZE AST#enum_body#Left { AST#enum_member#Left FIRST_MARGIN = AST#expression#Left 12 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SECOND_MARGIN = AST#expression#Left 16 AST#expression#Right AST#enum_member#Right , A...
export const enum MARGIN_FONT_SIZE { FIRST_MARGIN = 12, SECOND_MARGIN = 16, THIRD_MARGIN = 18, FOURTH_MARGIN = 24, FIFTH_MARGIN = 50, SIXTH_MARGIN = 94, SEVENTH_MARGIN = 132 }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L116-L124
b91e00f5d769a6de19ac46741691862adcfacf4c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
实现SwiperDataSource接口的对象,用于Swiper加载数据
export class SwiperDataSource extends BasicDataSource<SwiperModule> { private dataArray: SwiperModule[] = []; /** * 获取数据总数 * @returns */ public totalCount(): number { return this.dataArray.length; } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */ public getData(index: number): S...
AST#export_declaration#Left export AST#class_declaration#Left class SwiperDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SwiperModule AST#primary_type#Right AST#type_annotation#Right > AST#t...
export class SwiperDataSource extends BasicDataSource<SwiperModule> { private dataArray: SwiperModule[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): SwiperModule { return this.dataArray[index]; } public addData(index: number, data: Sw...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L22-L58
670dae047a0ac267d33fedb227c4af98258f47b5
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/LoadingUtil.ets
arkts
LoadingUtil
@Author csx @DateTime 2024/3/25 15:54:03 @TODO LoadingUtil 全局加载工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
@Component export struct LoadingUtil { @Prop @Watch("change") options: LoadOptions = new LoadOptions(); /** * 自定义loading */ private dialogControllerProgress: CustomDialogController = new CustomDialogController({ builder: LoadingDialog({ content: this.options.content }), autoCancel: false, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingUtil AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left "change" AST#expression#Right ) AST#decorator#Right op...
@Component export struct LoadingUtil { @Prop @Watch("change") options: LoadOptions = new LoadOptions(); private dialogControllerProgress: CustomDialogController = new CustomDialogController({ builder: LoadingDialog({ content: this.options.content }), autoCancel: false, alignment: this.optio...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/LoadingUtil.ets#L27-L66
d8dc309f2a685ec701097221631bf8eb3c38b70c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
getFormData
Get form data. @param {number} stepValue Value of steps. @param {number} dimension Card Specifications. @param {DataRdb.RdbStore} rdbStore RDB database. @return {FormData} formData.
async getFormData(formId: string, stepValue: number, dimension: number, rdbStore: DataRdb.RdbStore) { let round: number; if (stepValue >= CommonConstants.TARGET_STEPS) { round = CommonConstants.HUNDRED_PERCENT; } else { round = Math.round(stepValue / CommonConstants.TARGET_STEPS * CommonConstant...
AST#method_declaration#Left async getFormData AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stepValue : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
async getFormData(formId: string, stepValue: number, dimension: number, rdbStore: DataRdb.RdbStore) { let round: number; if (stepValue >= CommonConstants.TARGET_STEPS) { round = CommonConstants.HUNDRED_PERCENT; } else { round = Math.round(stepValue / CommonConstants.TARGET_STEPS * CommonConstant...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L102-L127
c7798a670c68eb2be078ccc5bc2eb51bb439bd4f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
Basic implementation of data listening with IDataSource.
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; // Get the length of the array. public abstract totalCount(): number; // Retrieve data at the specified index. public getData(index: number): void { } // Add a listener to the data source for th...
AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChange...
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; public abstract totalCount(): number; public getData(index: number): void { } registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L19-L72
fabbc1905b85c283295dc9aad5f4736244444f99
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
转场动画管理器
export class NavAnimationMgr { private static delegate = new NavAnimationMgr(); private constructor() { } static getInstance(): NavAnimationMgr { return NavAnimationMgr.delegate; } /** * 该页面的动画转场所需要的modifier,也可以自己传进去 * @param component * @param modifier * @returns */ public modifier(...
AST#export_declaration#Left export AST#class_declaration#Left class NavAnimationMgr AST#class_body#Left { AST#property_declaration#Left private static delegate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left NavAnimationMgr AST#expression#Right AST#new_...
export class NavAnimationMgr { private static delegate = new NavAnimationMgr(); private constructor() { } static getInstance(): NavAnimationMgr { return NavAnimationMgr.delegate; } public modifier(component: object, modifier?: NavAnimationModifier): NavAnimationModifier { return NavAnimationSt...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L48-L137
9b915716c7fc2654fa753f263c37a99ff6014826
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
updateRemark
更新订单备注 @param {string} newRemark 新的备注内容 @returns {void} 无返回值
updateRemark(newRemark: string): void { this.remark = newRemark; }
AST#method_declaration#Left updateRemark AST#parameter_list#Left ( AST#parameter#Left newRemark : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
updateRemark(newRemark: string): void { this.remark = newRemark; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L205-L207
dc43c1af00a363aa2276640c3dfae2e599c53a4d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
Canvas drawing method class.
export default class DrawModel { private startAngle: number = 0; private avgAngle: number = CommonConstants.CIRCLE / CommonConstants.COUNT; private screenWidth: number = 0; private canvasContext?: CanvasRenderingContext2D; /** * Draw the raffle round turntable. * * @param canvasContext canvasContext...
AST#export_declaration#Left export default AST#ERROR#Left class DrawModel AST#ERROR#Left { AST#property_declaration#Left private startAngle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Rig...
export default class DrawModel { private startAngle: number = 0; private avgAngle: number = CommonConstants.CIRCLE / CommonConstants.COUNT; private screenWidth: number = 0; private canvasContext?: CanvasRenderingContext2D; draw(canvasContext: CanvasRenderingContext2D, screenWidth: number, screenHeight: nu...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L27-L240
275c6329b0568b84da8d420fb2315463e88bb23a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/auth/src/main/ets/viewmodel/LoginViewModel.ets
arkts
@file 登录页 ViewModel @author Joker.X
@ObservedV2 export default class LoginViewModel extends BaseViewModel { /** * 全局用户状态 */ private readonly userState: UserState = getUserState(); /** * 认证仓库 */ private readonly authRepository: AuthRepository = new AuthRepository(); /** * 登录按钮加载状态 */ @Trace isLoginLoading: boolean = false; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class LoginViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 全局用户状态 */ AST#p...
@ObservedV2 export default class LoginViewModel extends BaseViewModel { private readonly userState: UserState = getUserState(); private readonly authRepository: AuthRepository = new AuthRepository(); @Trace isLoginLoading: boolean = false; login(): void { const params: PasswordLoginRequest = ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/viewmodel/LoginViewModel.ets#L13-L61
63de4653c8917aec607f6b441b966bc3199c1c1e
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/Action.ets
arkts
应用约束60:使用ES模块语法代替CommonJS
export default GenericAction;
AST#export_declaration#Left export default AST#expression#Left GenericAction AST#expression#Right ; AST#export_declaration#Right
export default GenericAction;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/Action.ets#L17-L17
2a3c78ba958a20f7332fd2077d0e61571d05eef3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/viewmodel/MusicViewModel.ets
arkts
Initialize music data. @param musicDataArray Music data array.
export function initializeMusic(musicDataArray: Array<MusicItem>) { if (musicDataArray === undefined) { Logger.error(TAG, 'getNextMusic fail,context is empty.'); return; } MUSIC_DATA.forEach((item: MusicItem) => { ResourceManagerUtil.getSrcPath(item.path, (value: resourceManager.RawFileDescriptor) => ...
AST#export_declaration#Left export AST#function_declaration#Left function initializeMusic AST#parameter_list#Left ( AST#parameter#Left musicDataArray : 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 MusicItem AST#primar...
export function initializeMusic(musicDataArray: Array<MusicItem>) { if (musicDataArray === undefined) { Logger.error(TAG, 'getNextMusic fail,context is empty.'); return; } MUSIC_DATA.forEach((item: MusicItem) => { ResourceManagerUtil.getSrcPath(item.path, (value: resourceManager.RawFileDescriptor) => ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/viewmodel/MusicViewModel.ets#L98-L110
1d8dc1b24f77075440b6af6d6b2c157201be8b08
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
fadeIn
淡入动画
static fadeIn(duration: number = 300): object { return { duration: duration, curve: curve.EaseOut }; }
AST#method_declaration#Left static fadeIn AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
static fadeIn(duration: number = 300): object { return { duration: duration, curve: curve.EaseOut }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L11-L16
5def3a325e271469584ee950a84f51bccd2b439b
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/MosaicComponent.ets
arkts
MosaicComponent
马赛克组件
@ComponentV2 export struct MosaicComponent { @Param @Require eventListener: MosaicEventListener; @Param @Require sourcePixelMap: PixelMap; @Local contentWidth: number = 0; @Local contentHeight: number = 0; private mosaicPixelMap: PixelMap | null = null; private contentOffset?: common2D.Point; private canv...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MosaicComponent AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right eventListener : AST#type_annotation#Left AST#primary_typ...
@ComponentV2 export struct MosaicComponent { @Param @Require eventListener: MosaicEventListener; @Param @Require sourcePixelMap: PixelMap; @Local contentWidth: number = 0; @Local contentHeight: number = 0; private mosaicPixelMap: PixelMap | null = null; private contentOffset?: common2D.Point; private canv...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/MosaicComponent.ets#L47-L150
4d6c8862732f6ef3a75f7f91f65ed647e103b5f2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ArrayUtil.ets
arkts
isNotEmpty
判断集合是否为非空集合。 @param array @returns
static isNotEmpty<T>(array: T[]): boolean { return undefined !== array && null !== array && array.length !== 0; }
AST#method_declaration#Left static isNotEmpty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Righ...
static isNotEmpty<T>(array: T[]): boolean { return undefined !== array && null !== array && array.length !== 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L32-L34
9747f1a8c55131298b2df52740891b4e2f05f041
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/constants/RouterConstants.ets
arkts
Key of the builderMap of the routing table in the RouterModule. The format is as follows:{bundleName}_${pageName}.
export class BuilderNameConstants { static readonly HARA_A1: string = '@ohos/hara_A1'; static readonly HARA_A2: string = '@ohos/hara_A2'; static readonly HARB_B1: string = '@ohos/harb_B1'; static readonly HARB_B2: string = '@ohos/harb_B2'; static readonly HARB_B3: string = '@ohos/harb_B3'; static readonly H...
AST#export_declaration#Left export AST#class_declaration#Left class BuilderNameConstants AST#class_body#Left { AST#property_declaration#Left static readonly HARA_A1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '@ohos/hara_A1' AST#expressi...
export class BuilderNameConstants { static readonly HARA_A1: string = '@ohos/hara_A1'; static readonly HARA_A2: string = '@ohos/hara_A2'; static readonly HARB_B1: string = '@ohos/harb_B1'; static readonly HARB_B2: string = '@ohos/harb_B2'; static readonly HARB_B3: string = '@ohos/harb_B3'; static readonly H...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/constants/RouterConstants.ets#L17-L25
586b682a26ff2f72bdfc8b47022ca63a4d01b320
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets
arkts
refresh state enum
export enum RefreshState { IDLE = 0, DRAGGING = 1, DRAGGING_REFRESHABLE = 2, REFRESHING = 3, COMPLETE = 4 }
AST#export_declaration#Left export AST#enum_declaration#Left enum RefreshState AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DRAGGING = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DRAGG...
export enum RefreshState { IDLE = 0, DRAGGING = 1, DRAGGING_REFRESHABLE = 2, REFRESHING = 3, COMPLETE = 4 }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/constants/RefreshConstants.ets#L50-L56
a20805ae952ef702c7d17c50576b51e1cb869f91
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
2025年节日数据库(基于权威日历数据更新) 包含中国传统节日、国际节日、法定节假日等 确保农历节日与2025年公历对应准确 节日类型枚举
export enum FestivalType { TRADITIONAL = 'traditional', // 传统节日 INTERNATIONAL = 'international', // 国际节日 LEGAL = 'legal', // 法定节假日 SOLAR_TERM = 'solar_term', // 二十四节气 MEMORIAL = 'memorial', // 纪念日 WESTERN = 'western', // 西方节日 MODERN = 'modern' // 现代...
AST#export_declaration#Left export AST#enum_declaration#Left enum FestivalType AST#enum_body#Left { AST#enum_member#Left TRADITIONAL = AST#expression#Left 'traditional' AST#expression#Right AST#enum_member#Right , // 传统节日 AST#enum_member#Left INTERNATIONAL = AST#expression#Left 'international' AST#expression#Right AST#...
export enum FestivalType { TRADITIONAL = 'traditional', INTERNATIONAL = 'international', LEGAL = 'legal', SOLAR_TERM = 'solar_term', MEMORIAL = 'memorial', WESTERN = 'western', MODERN = 'modern' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L10-L18
a8a47a5072677da59ca8c5f4bacb870db4ee8faa
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets
arkts
自定义class实现Image组件的AttributeModifier接口
export class ImageModifier implements AttributeModifier<ImageAttribute> { width: Length | Resource = 0; height: Length | Resource = 0; constructor(width: Length | Resource, height: Length | Resource) { this.width = width; this.height = height; } applyNormalAttribute(instance: ImageAttribute): void {...
AST#export_declaration#Left export AST#class_declaration#Left class ImageModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ImageAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Ri...
export class ImageModifier implements AttributeModifier<ImageAttribute> { width: Length | Resource = 0; height: Length | Resource = 0; constructor(width: Length | Resource, height: Length | Resource) { this.width = width; this.height = height; } applyNormalAttribute(instance: ImageAttribute): void {...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets#L73-L87
ce0f61dfeb64f37eb3a2768280dc7ac367b18682
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/uploadanddownload/RequestUpload.ets
arkts
getFilesAndData
获取上传文件数据
private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> { logger.info(TAG, `getFilesAndData begin`); let files: request.agent.FormItem[] = []; for (let i = 0; i < fileUris.length; i++) { logger.info(TAG, `getFilesAndData fileUri = ${fileUris[i]}...
AST#method_declaration#Left private async getFilesAndData AST#parameter_list#Left ( AST#parameter#Left cacheDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileUris : AST#type_annotation#Left AST#primary_type#Left AST#...
private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> { logger.info(TAG, `getFilesAndData begin`); let files: request.agent.FormItem[] = []; for (let i = 0; i < fileUris.length; i++) { logger.info(TAG, `getFilesAndData fileUri = ${fileUris[i]}...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/uploadanddownload/RequestUpload.ets#L129-L146
d340ab4002b7f5a8b2a9ddb14cf1307c373a1c56
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
padZero
补零操作 @param num @returns
private static padZero(num: number): string { return num.toString().padStart(2, "0"); }
AST#method_declaration#Left private static padZero 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 static padZero(num: number): string { return num.toString().padStart(2, "0"); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L425-L427
654d6ef55ce8ee1cd7792071c2d330c38d62bc7e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets
arkts
控制组件状态 true:开启水波纹 false:停止水波纹 创建一个Column组件,内部的ButtonWithWaterRipples为水波纹按钮,用来切换水波纹动画。 当点击按钮时,开始触发水波纹动画,下方的文字从点击开始识曲改为正在聆听
build() { Column() { Text($r('app.string.water_ripples_sound_hound')) .fontColor(Color.White) .fontSize(18) .margin({ top: $r('app.integer.water_ripples_margin_large') }) ButtonWithWaterRipples({ isListening: this.isListening }) Text(this.isListening ? $r('app.string.wate...
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 AST#resource_expression#Left...
build() { Column() { Text($r('app.string.water_ripples_sound_hound')) .fontColor(Color.White) .fontSize(18) .margin({ top: $r('app.integer.water_ripples_margin_large') }) ButtonWithWaterRipples({ isListening: this.isListening }) Text(this.isListening ? $r('app.string.wate...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets#L39-L57
0f02f8b848d80fa9a9c9fe89f7edc3f923d10156
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowShortcuts.ets
arkts
shortcut_alignItems
Values
shortcut_alignItems() { let status = this.preferred_hand_left_or_right == 'right'; if (this.preferred_hand_reverse_homepage_shortcuts) { status = !status; } return status ? HorizontalAlign.End : HorizontalAlign.Start; }
AST#method_declaration#Left shortcut_alignItems AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left status = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
shortcut_alignItems() { let status = this.preferred_hand_left_or_right == 'right'; if (this.preferred_hand_reverse_homepage_shortcuts) { status = !status; } return status ? HorizontalAlign.End : HorizontalAlign.Start; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowShortcuts.ets#L90-L96
98a77c092306bf5195875fd8d8a103c7c9cbb4ff
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets
arkts
Canvas drawing method class.
export class DrawUtil { private screenWidth: number = 0; private screenHeight: number = 0; private settings: RenderingContextSettings = new RenderingContextSettings(true); private canvasContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); private offsetXLeft: number = 0; private ...
AST#export_declaration#Left export AST#class_declaration#Left class DrawUtil AST#class_body#Left { AST#property_declaration#Left private screenWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declar...
export class DrawUtil { private screenWidth: number = 0; private screenHeight: number = 0; private settings: RenderingContextSettings = new RenderingContextSettings(true); private canvasContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); private offsetXLeft: number = 0; private ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets#L20-L133
09bc983c2c195f9f4b0cf63f6a16c1b1a5371038
gitee
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/商品详情品牌研究所
export const BRAND_INFO_ITEMS = baseUrl + '/xhr/item/brand/index.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BRAND_INFO_ITEMS = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/item/brand/index.json' AST#expression#Right AST#binary_expression#Right AST#e...
export const BRAND_INFO_ITEMS = baseUrl + '/xhr/item/brand/index.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L49-L49
b1648f0ecf0e3b45b57f4c92422b301ff3fa53f3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets
arkts
ripplesStyle
动画持续时间
@Styles ripplesStyle() { .width(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE) .height(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE) .borderRadius(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE / 2) .backgroundColor(Color.White) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right ripplesStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#exp...
@Styles ripplesStyle() { .width(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE) .height(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE) .borderRadius(this.BUTTON_SIZE * this.BUTTON_CLICK_SCALE / 2) .backgroundColor(Color.White) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets#L76-L82
d579cdb4f10272fab54104ce79ab03ba412b126b
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets
arkts
setLabel
Sets the label that is drawn next to the limit line. Provide "" if no label is required. @param label
public setLabel(label: string) { this.mLabel = label; }
AST#method_declaration#Left public setLabel AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expres...
public setLabel(label: string) { this.mLabel = label; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L188-L190
221542c04d390ae13247db81e7e87faf574209da
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
hideRefundModal
隐藏退款原因选择弹窗 @returns {void} 无返回值
hideRefundModal(): void { this.refundModalVisible = false; }
AST#method_declaration#Left hideRefundModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#me...
hideRefundModal(): void { this.refundModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L97-L99
1d0d675f6f7471e19e616cfa9754a80ccef331b1
github
1lck/MindFlow.git
f05fab0891716cb852946ac02ed08dd2c0b9155a
front/entry/src/main/ets/pages/auth/Login.ets
arkts
LinearGradientDirection
Helper for gradient (HarmonyOS ArkTS way might differ slightly based on version, adapting to standard Stack/Gradient)
@Builder LinearGradientDirection(options: LinearGradientDirectionOptions) { Row().width('100%').height('100%') .linearGradient({ angle: 135, // Approx LeftBottom to RightTop colors: options.colors }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LinearGradientDirection AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LinearGradientDirectionOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
@Builder LinearGradientDirection(options: LinearGradientDirectionOptions) { Row().width('100%').height('100%') .linearGradient({ angle: 135, colors: options.colors }) }
https://github.com/1lck/MindFlow.git/blob/f05fab0891716cb852946ac02ed08dd2c0b9155a/front/entry/src/main/ets/pages/auth/Login.ets#L254-L261
496297ca54fb5924b1cb9ad094dcbf4b1539c89a
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/RequstDownload/entry/src/main/ets/pages/Index.ets
arkts
downloadFile
下载文件
downloadFile() { this.localFilePath = getContext(this).tempDir + "/demo.txt" //文件如果已经存在,就删除 if (fs.accessSync(this.localFilePath)) { fs.unlink(this.localFilePath) } let cfg: request.DownloadConfig = { url: this.downloadUrl, header: { 'Accept-Encoding': 'gzip, deflate, br'...
AST#method_declaration#Left downloadFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . localFilePath AST#member...
downloadFile() { this.localFilePath = getContext(this).tempDir + "/demo.txt" if (fs.accessSync(this.localFilePath)) { fs.unlink(this.localFilePath) } let cfg: request.DownloadConfig = { url: this.downloadUrl, header: { 'Accept-Encoding': 'gzip, deflate, br', 'Acc...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/RequstDownload/entry/src/main/ets/pages/Index.ets#L153-L194
a2fb627b8fd99140316d9170e75ed88b223d06b3
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/IMClientManager.ets
arkts
releaseMobileIMSDK
释放IM框架所占用的资源,在退出登陆时请务必调用本方法,否则重新登陆将不能正常实现(指APP进程不退出时切换账号这种情况)。
releaseMobileIMSDK(): void { // 释放IM核心库资源 ClientCoreSDK.getInstance().release(); // 重置本类的初始化标识 this.resetInitFlag(); // 取消注册事件监听 this.unregisterSocketEvent(); // 清空聊天数据 this.messageProvider.clear(); }
AST#method_declaration#Left releaseMobileIMSDK 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 { // 释放IM核心库资源 AST#expression_statement#Left AST#expression#Left AST#call_expression#L...
releaseMobileIMSDK(): void { ClientCoreSDK.getInstance().release(); this.resetInitFlag(); this.unregisterSocketEvent(); this.messageProvider.clear(); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/IMClientManager.ets#L101-L110
e6ed39de1d3abcf1fa324c3d9555f6276393514d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/DevelopingFileManagerApplication/entry/src/main/ets/filemanager/pages/FileManagerApplication.ets
arkts
getRoots
[Start file_access_get_root]
async getRoots(): Promise<void> { try { rootIterator = await fileAccessHelperAllServer.getRoots(); if (!rootIterator) { Logger.error('getRoots interface returns an undefined object'); return; } while (!isDone) { let result = rootIterator.next(); Logger.info('n...
AST#method_declaration#Left async getRoots 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_argumen...
async getRoots(): Promise<void> { try { rootIterator = await fileAccessHelperAllServer.getRoots(); if (!rootIterator) { Logger.error('getRoots interface returns an undefined object'); return; } while (!isDone) { let result = rootIterator.next(); Logger.info('n...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/DevelopingFileManagerApplication/entry/src/main/ets/filemanager/pages/FileManagerApplication.ets#L93-L112
cffb3e8e85ffe87433889178bec4cd77590308f5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
animation/entry/src/main/ets/pages/UpdateMultipleProperties.ets
arkts
UpdateMultipleProperties
[Start update_multiple_properties1] [Start update_multiple_properties2] [Start update_multiple_properties3]
@Component export struct UpdateMultipleProperties { @State w: number = 100 @State h: number = 2 @State color: Color = Color.Red build() { Column() { Row() { Row() { Row() .width(this.w) .backgroundColor(this.color) .height(this.h) } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UpdateMultipleProperties AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right w : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type...
@Component export struct UpdateMultipleProperties { @State w: number = 100 @State h: number = 2 @State color: Color = Color.Red build() { Column() { Row() { Row() { Row() .width(this.w) .backgroundColor(this.color) .height(this.h) } ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/animation/entry/src/main/ets/pages/UpdateMultipleProperties.ets#L19-L181
217a5d7846c2fe774eb88c104ee5e4b0d91b324c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
putPreference
Save the data to the Preferences. @param fruit Fruit data.
async putPreference(fruit: Fruit) { if (!preference) { await this.getPreferencesFromStorage(); } // The fruit name and fruit quantity data entered by the user are saved to the cached Preference instance. try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(fruit)); } catch...
AST#method_declaration#Left async putPreference AST#parameter_list#Left ( AST#parameter#Left fruit : AST#type_annotation#Left AST#primary_type#Left Fruit AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if...
async putPreference(fruit: Fruit) { if (!preference) { await this.getPreferencesFromStorage(); } try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(fruit)); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to put value, Cause: ${err}`); } awa...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L63-L75
de075aa5ed2fe113c901bece2838f215a9c87175
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/wifi/WifiInfo/entry/src/main/ets/pages/Index.ets
arkts
showIPInfo
显示IP相关信息
showIPInfo() { let ipInfo = wifiManager.getIpInfo(); let ipAddr = getIpAddrFromNum(ipInfo.ipAddress) this.msgHistory += `IP地址: ${ipAddr}\r\n`; let gateAddr = getIpAddrFromNum(ipInfo.gateway) this.msgHistory += `网关地址: ${gateAddr}\r\n`; let maskAddr = getIpAddrFromNum(ipInfo.netmask) this.m...
AST#method_declaration#Left showIPInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ipInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Lef...
showIPInfo() { let ipInfo = wifiManager.getIpInfo(); let ipAddr = getIpAddrFromNum(ipInfo.ipAddress) this.msgHistory += `IP地址: ${ipAddr}\r\n`; let gateAddr = getIpAddrFromNum(ipInfo.gateway) this.msgHistory += `网关地址: ${gateAddr}\r\n`; let maskAddr = getIpAddrFromNum(ipInfo.netmask) this.m...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/wifi/WifiInfo/entry/src/main/ets/pages/Index.ets#L66-L85
0cc7b3065a64e8f0be59f86099d96c884c0c9996
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets
arkts
connectServer
连接服务器
async connectServer(serverIp: string, serverPort: number) { const serverAddress: socket.NetAddress = { address: serverIp, port: serverPort, family: 1 }; try { await this.tcpConnect.connect({ address: serverAddress }); console.log('连接服务器成功'); this.tcpConnect.on('message'...
AST#method_declaration#Left async connectServer AST#parameter_list#Left ( AST#parameter#Left serverIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serverPort : AST#type_annotation#Left AST#primary_type#Left number AST#p...
async connectServer(serverIp: string, serverPort: number) { const serverAddress: socket.NetAddress = { address: serverIp, port: serverPort, family: 1 }; try { await this.tcpConnect.connect({ address: serverAddress }); console.log('连接服务器成功'); this.tcpConnect.on('message'...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets#L63-L87
2f0d637d300cc7415e972852400a8893d3d13ce2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Ability/AppStartup/entry/src/main/ets/startup/FileTask.ets
arkts
fs
关闭文件
fs.closeSync(srcFile);
AST#method_declaration#Left fs AST#ERROR#Left . closeSync AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left srcFile AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
fs.closeSync(srcFile);
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Ability/AppStartup/entry/src/main/ets/startup/FileTask.ets#L40-L40
739a3f26c0c0cd04bee81a9ca0eb04a7f7f1253b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets
arkts
fatal
打印FATAL级别日志 @param args
static fatal(...args: string[]): void { if (LogUtil.showLog) { hilog.fatal(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args) } }
AST#method_declaration#Left static fatal AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A...
static fatal(...args: string[]): void { if (LogUtil.showLog) { hilog.fatal(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args) } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L94-L98
9ae596230b196a29ed677dc2bdf4dc212e662c2c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateRegionPickerVisible
更新地区选择弹窗可见状态 @param {boolean} visible - 是否可见 @returns {void} 无返回值
updateRegionPickerVisible(visible: boolean): void { this.isRegionPickerVisible = visible; }
AST#method_declaration#Left updateRegionPickerVisible AST#parameter_list#Left ( AST#parameter#Left visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr...
updateRegionPickerVisible(visible: boolean): void { this.isRegionPickerVisible = visible; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L209-L211
eac840d78c646335f8335b867bbf7b12f25ab239
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeaderV2.d.ets
arkts
Defines the SubHeaderV2OperationItemOptions. @interface SubHeaderV2OperationItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export interface SubHeaderV2OperationItemOptions { /** * The content of text or the address of icon. * @type { SubHeaderV2OperationItemType }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ content: SubHeaderV2OperationItemType; /** * callback ...
AST#export_declaration#Left export AST#interface_declaration#Left interface SubHeaderV2OperationItemOptions AST#object_type#Left { /** * The content of text or the address of icon. * @type { SubHeaderV2OperationItemType }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice *...
export interface SubHeaderV2OperationItemOptions { content: SubHeaderV2OperationItemType; action?: SubHeaderV2OperationItemAction; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; accessibilityLevel?: string; defaultFocus?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeaderV2.d.ets#L376-L438
93df950d0fa3c8e3e7ac6bf22572ebbf9853462b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets
arkts
模拟发起调用
export const mockDocumentViewPickerSelectJSThread: () => void;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left mockDocumentViewPickerSelectJSThread : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS...
export const mockDocumentViewPickerSelectJSThread: () => void;
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets#L41-L41
3537ea2a3c07d13c0ab75403914d47c22596bce3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/FeatureComponent.ets
arkts
popRouter
路由返回
popRouter() { DynamicsRouter.popAppRouter(); }
AST#method_declaration#Left popRouter 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 DynamicsRouter AST#expression#Right . popAppRouter AST...
popRouter() { DynamicsRouter.popAppRouter(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/FeatureComponent.ets#L8-L10
25e3113fd2c0a1b7422cb5fe5ec4d82adff9cbfb
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
loadMoreSearchResults
加载更多搜索结果
async loadMoreSearchResults() { if (!this.searchHasMore || this.isLoadingMore) return; this.isLoadingMore = true; try { const offset = this.searchPage * this.episodesPageSize; const result = await this.dbService.searchEpisodes( this.episodeSearchKeyword.trim(), offset, ...
AST#method_declaration#Left async loadMoreSearchResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Le...
async loadMoreSearchResults() { if (!this.searchHasMore || this.isLoadingMore) return; this.isLoadingMore = true; try { const offset = this.searchPage * this.episodesPageSize; const result = await this.dbService.searchEpisodes( this.episodeSearchKeyword.trim(), offset, ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L247-L267
e4b7d728c7c8acf8ae20df1c40d2d917e377b99e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
exportSettings
导出设置数据 @returns 导出的设置数据
async exportSettings(): Promise<SettingsExportData> { try { const settings = await this.getSettings(); const exportContent: SettingsExportContent = { theme: settings.theme, notification: settings.notification, reminder: settings.reminder, privacy: settings.privacy, ...
AST#method_declaration#Left async exportSettings 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 SettingsExportData AST#primary_type#Right AST#type_annotation#Righ...
async exportSettings(): Promise<SettingsExportData> { try { const settings = await this.getSettings(); const exportContent: SettingsExportContent = { theme: settings.theme, notification: settings.notification, reminder: settings.reminder, privacy: settings.privacy, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L355-L383
522b710c4cae9beedff1ed7145a1ed8d657aa5f6
github
HarmonyCandies/image_editor.git
16924481f667efa4bdd1a0b39e6f5a80c43e5ff4
image_editor/src/main/ets/components/util/ImageUtils.ets
arkts
parseExifRotate
1 上 左 0° 2 上 右 水平翻转 3 下 右 180° 4 下 左 垂直翻转 5 左 上 顺时针90°+水平翻转 6 右 上 顺时针90° 7 右 下 顺时针90°+垂直翻转 8 左 下 逆时针90°
static parseExifRotate(orientation: string): number { orientation = orientation.toLowerCase(); switch (orientation) { // 1 上 左 0° case 'top-left': return 0; // 2 上 右 水平翻转 case 'top-right': return 0; // 3 下 右 180° case 'bottom-right': return 180; // 4 下 左...
AST#method_declaration#Left static parseExifRotate AST#parameter_list#Left ( AST#parameter#Left orientation : 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#...
static parseExifRotate(orientation: string): number { orientation = orientation.toLowerCase(); switch (orientation) { case 'top-left': return 0; case 'top-right': return 0; case 'bottom-right': return 180; case 'bottom-left': return 0; ...
https://github.com/HarmonyCandies/image_editor.git/blob/16924481f667efa4bdd1a0b39e6f5a80c43e5ff4/image_editor/src/main/ets/components/util/ImageUtils.ets#L20-L51
ab18ece4c0d06e6327e699b1ced006354c1f58c7
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets
arkts
Class representing one entry in the chart. Might contain multiple values. Might only contain a single value depending on the used constructor.
export default class EntryOhos extends BaseEntry { private x: number = 0; constructor(x?: number, y?: number, icon?: ImagePaint, data?: Object) { super(y, icon, data); this.x = x; } /** * Returns the x-value of this Entry object. * * @return */ public getX(): nu...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryOhos extends AST#type_annotation#Left AST#primary_type#Left BaseEntry AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private x : AST#type_annotation#Left AST#primary_type#Left number AS...
export default class EntryOhos extends BaseEntry { private x: number = 0; constructor(x?: number, y?: number, icon?: ImagePaint, data?: Object) { super(y, icon, data); this.x = x; } public getX(): number { return this.x; } public setX(x: number): void { ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets#L25-L99
c9720ec180307e72029cbf9ec93479bea2fba82d
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets
arkts
removeFormAnimate
Animation effect when card is removed.
private removeFormAnimate() { Log.showInfo(TAG, 'removeFormAnimate start'); if (this.isRemoveForm && this.formAnimateData.isOpenRemoveFormDialog && this.formAnimateData.cardId === this.formItem.cardId) { animateTo({ duration: 250, tempo: 0.5, curve: ...
AST#method_declaration#Left private removeFormAnimate 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 Log AST#expression#Right ...
private removeFormAnimate() { Log.showInfo(TAG, 'removeFormAnimate start'); if (this.isRemoveForm && this.formAnimateData.isOpenRemoveFormDialog && this.formAnimateData.cardId === this.formItem.cardId) { animateTo({ duration: 250, tempo: 0.5, curve: ...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets#L112-L137
2df46ba695ad32417f96d6d816faa092bfe2b3cc
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Copy a text file to sandbox temp directory, overwrites whatever that was at that place. Adds a timestamp in the file's name. THIS IS A SYNC FUNCTION @param from from a uri (file://). @param to a sandbox directory, the new parent folder of this file (in sandbox). @returns a sandbox uri.
export function copy_from_uri_to_sandbox_temp_with_timestamp(from: string, to: string, max_name_length?: number): string { let filesDir: string = meowContext().tempDir; let max_name_l: number = max_name_length || 64; // Get from path const from_path = new fileUri.FileUri(from).path; // Get file name const s...
AST#export_declaration#Left export AST#function_declaration#Left function copy_from_uri_to_sandbox_temp_with_timestamp AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : ...
export function copy_from_uri_to_sandbox_temp_with_timestamp(from: string, to: string, max_name_length?: number): string { let filesDir: string = meowContext().tempDir; let max_name_l: number = max_name_length || 64; const from_path = new fileUri.FileUri(from).path; const split_result = from.split('/'); ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L529-L550
946c05e85b609ee1ecd9cd830c4eea61b35a63c7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/searchswiper/src/main/ets/components/mainpage/SearchSwiper.ets
arkts
列表内容
constructor(id: number, title: string, content: string) { this.id = id; this.title = title; this.content = content; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
constructor(id: number, title: string, content: string) { this.id = id; this.title = title; this.content = content; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchswiper/src/main/ets/components/mainpage/SearchSwiper.ets#L66-L70
9e8ce2ccb965caf67d535d463baced598ef6866d
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
Class representing the x-axis labels settings. Only use the setter methods to modify it. Do not access public variables directly. Be aware that not all features the XLabels class provides are suitable for the RadarChart. @author Philipp Jahoda
export class XAxis extends AxisBase { /** * width of the x-axis labels in pixels - this is automatically * calculated by the computeSize() methods in the renderers */ public mLabelWidth: number = 1; /** * height of the x-axis labels in pixels - this is automatically * calculated by...
AST#export_declaration#Left export AST#class_declaration#Left class XAxis extends AST#type_annotation#Left AST#primary_type#Left AxisBase AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * width of the x-axis labels in pixels - this is automatically * calculated by the computeSize() ...
export class XAxis extends AxisBase { public mLabelWidth: number = 1; public mLabelHeight: number = 1; public mLabelRotatedWidth: number = 1; public mLabelRotatedHeight: number = 1; protected mLabelRotationAngle: number = 0; private mAvoidFirstLastClipping: boo...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L26-L124
98842176abac3fc10de3093ec4bac25f788608b6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/FileSample/entry/src/main/ets/pages/Index.ets
arkts
getShareFile
[End import_starf_storageStatistics] [Start get_share_file]
function getShareFile(): string { let strFile = ''; try { let URI: string | undefined = AppStorage.get('URI'); if (URI === null || URI === undefined) { Logger.info('uri is invalid'); let str = 'uri is invalid'; return str; } try { // 根据需要对被分享文件的URI进行相应操作。例如读写的方式打开URI获取file对象 ...
AST#function_declaration#Left function getShareFile 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#variable_declaration#Left let AST#variable_declarator#Left s...
function getShareFile(): string { let strFile = ''; try { let URI: string | undefined = AppStorage.get('URI'); if (URI === null || URI === undefined) { Logger.info('uri is invalid'); let str = 'uri is invalid'; return str; } try { let file = fs.openSync(URI, fs.OpenMod...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/pages/Index.ets#L46-L83
fedd2a1c031528a560b52ff71e178043b381dba5
gitee
jianguo888/nut-weather
d37553c8d4c994c5e69134e7591318c4790a8245
entry/src/main/ets/MainAbility/pages/Main.ets
arkts
getWeekRequest
请求方式:GET 获取一周天气预报
getWeekRequest() { // 每一个httpRequest对应一个http请求任务,不可复用 let httpRequest = http.createHttp() let url = 'https://devapi.qweather.com/v7/weather/7d?location=101010100&key=48fbadf80bbc43ce853ab9a92408373e' httpRequest.request(url, (err, data) => { if (!err) { if (data.responseCode == 200) { ...
AST#method_declaration#Left getWeekRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 每一个httpRequest对应一个http请求任务,不可复用 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left A...
getWeekRequest() { let httpRequest = http.createHttp() let url = 'https://devapi.qweather.com/v7/weather/7d?location=101010100&key=48fbadf80bbc43ce853ab9a92408373e' httpRequest.request(url, (err, data) => { if (!err) { if (data.responseCode == 200) { console.info('=====data.resu...
https://github.com/jianguo888/nut-weather/blob/d37553c8d4c994c5e69134e7591318c4790a8245/entry/src/main/ets/MainAbility/pages/Main.ets#L114-L148
a34bcda9ec4cbd74fcc74eb0710abe6c6fc84f92
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
removeListener
移除任务变更监听器
removeListener(listener: TaskChangeListener) { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } }
AST#method_declaration#Left removeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TaskChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_...
removeListener(listener: TaskChangeListener) { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L39-L44
83de0686c485afa8bfbfe14e9275bd60f7996457
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/RelationshipAdd.ets
arkts
应用约束60: 使用ES模块导出
export default RelationshipAddHandler;
AST#export_declaration#Left export default AST#expression#Left RelationshipAddHandler AST#expression#Right ; AST#export_declaration#Right
export default RelationshipAddHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/RelationshipAdd.ets#L25-L25
4ff016587010ca6606b6e91e3a5b7e21615052b9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/pageTransition/template2/Page1.ets
arkts
pageTransition
自定义方式2:使用系统提供的多种默认效果(平移、缩放、透明度等)
pageTransition() { PageTransitionEnter({ duration: 200 }) .slide(SlideEffect.END) //Right PageTransitionExit({ delay: 100 }) .slide(SlideEffect.END) //Right }
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression...
pageTransition() { PageTransitionEnter({ duration: 200 }) .slide(SlideEffect.END) PageTransitionExit({ delay: 100 }) .slide(SlideEffect.END) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/pageTransition/template2/Page1.ets#L43-L48
2ee3891ef28e1b10a22282e346ceedef9570e250
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
generateYearList
生成年份列表方法
generateYearList(): number[] { const currentYear = new Date().getFullYear(); const years: number[] = []; for (let i = currentYear - 10; i <= currentYear + 19; i++) { years.push(i); } return years; }
AST#method_declaration#Left generateYearList AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#L...
generateYearList(): number[] { const currentYear = new Date().getFullYear(); const years: number[] = []; for (let i = currentYear - 10; i <= currentYear + 19; i++) { years.push(i); } return years; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L68-L75
b7a4db893a12b9afbad8dd74fb210e7affbb0d5f
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets
arkts
vPath example: difile://data/storage/el2/base/haps/entry/files/dm_bundles_v2/dd8a9edfa385c38808/resource localPath example: /data/storage/el2/base/haps/entry/files/dm_bundles_v2/dd8a9edfa385c38808/resource 涉及到worker线程,移除app相关逻辑,仅处理前缀
export class DMPFileUrlConvertor { //鸿蒙原生上传只支持internal://cache 协议 static uri2UploadImageFilePath(url: string): string { const cacheDir = DMPContextUtils.getUIAbilityContext().cacheDir; const cacheUri = 'internal://cache' if (url.startsWith("difile://")) { return url.replace("difile://", cacheUri) ...
AST#export_declaration#Left export AST#class_declaration#Left class DMPFileUrlConvertor AST#class_body#Left { //鸿蒙原生上传只支持internal://cache 协议 AST#method_declaration#Left static uri2UploadImageFilePath AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
export class DMPFileUrlConvertor { static uri2UploadImageFilePath(url: string): string { const cacheDir = DMPContextUtils.getUIAbilityContext().cacheDir; const cacheUri = 'internal://cache' if (url.startsWith("difile://")) { return url.replace("difile://", cacheUri) } else if (url.startsWith(...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets#L9-L43
8754be6cf120cfccb981e1845922f486562237bc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets
arkts
ScanLine
二维码扫描线动画
@Component export struct ScanLine { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @State linePosition: number = 0; @State allAngle: number = 180; @State lightFactor: number = 0.075; @State factor: number = 0.025; @State reverse: boolean = false; @State sp...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScanLine AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'currentBreakpoint' AST#expression#Right ) AST#decorator#Right currentBreakpoint : AST#type_annot...
@Component export struct ScanLine { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @State linePosition: number = 0; @State allAngle: number = 180; @State lightFactor: number = 0.075; @State factor: number = 0.025; @State reverse: boolean = false; @State sp...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets#L44-L196
206efd44d0ff7d0d2df316c8729a1630ce01fb1a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/components/OneMoment.ets
arkts
OneMoment
列表子组件 TODO: 性能知识点:@Reusable复用组件优化,详情请见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/best-practices-long-list-0000001728333749#section36781044162218
@Reusable @Component export struct OneMoment { @Prop moment: FriendMoment; build() { Column() { Row() { Image($r(this.moment.avatar)) .autoResize(false) .width($r('app.integer.list_slide_to_history_user_image_width')) .height($r('app.integer.list_slide_to_history_use...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct OneMoment AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right moment : AST#type_annotation#Left AST#primary_type#Left...
@Reusable @Component export struct OneMoment { @Prop moment: FriendMoment; build() { Column() { Row() { Image($r(this.moment.avatar)) .autoResize(false) .width($r('app.integer.list_slide_to_history_user_image_width')) .height($r('app.integer.list_slide_to_history_use...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/components/OneMoment.ets#L25-L128
e5352e9894769a9419a9a9c0d0e8b93e3745429b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/bookDetail/note/CircleGeneralButton.ets
arkts
CircleGeneralButton
Copyright (C), 2024-05-15 @author LinXun @date 2024/5/15 13:03 @version 1.0 @description: 圆形通用按钮
@Component export default struct CircleGeneralButton { private icon: ResourceStr = $r('app.media.ic_public_edit'); private text: string = '编辑'; build() { Column({space: 8}) { Column() { Image(this.icon) .width(24) .height(24) .fillColor('#a6000000') } .b...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CircleGeneralButton AST#component_body#Left { AST#property_declaration#Left private icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expr...
@Component export default struct CircleGeneralButton { private icon: ResourceStr = $r('app.media.ic_public_edit'); private text: string = '编辑'; build() { Column({space: 8}) { Column() { Image(this.icon) .width(24) .height(24) .fillColor('#a6000000') } .b...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/bookDetail/note/CircleGeneralButton.ets#L8-L41
d002bde9f0c8d1d921a90585d42b372d81115294
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
queryForCharGroup
按英文首字母进行分段(abc 分组) isStill = true:仅返回未测试(lastResultType = NONE)的单词 searchText 可选:模糊查询(仅匹配 wordEn 与 wordJp)
queryForCharGroup(filtedWords: WordUser[], isStill: boolean): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); // 排序:按英文字母排序(忽略大小写) filtedWords.sort((a, b) => this.compareByWordEn(a, b)); filtedWords.forEach(word => { // 仅保留未测试单词(isStill = true) i...
AST#method_declaration#Left queryForCharGroup AST#parameter_list#Left ( AST#parameter#Left filtedWords : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isStill : AST#type_annot...
queryForCharGroup(filtedWords: WordUser[], isStill: boolean): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); filtedWords.sort((a, b) => this.compareByWordEn(a, b)); filtedWords.forEach(word => { if (isStill && word.lastResultType !== SearchCon...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L667-L684
fa2cd72bb793282b983a5dde0223288b9dbea864
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Header.ets
arkts
Header
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export default struct Header { @StorageProp('fontSize') fontSize: number = 0 build() { Row() { Image($r('app.media.ic_back')) .width(20) .height(20) .margin({ left: 16 }) Text($r('app.string.play_list')) .fontSize(this.fontSize + 4) .fontWeight(500...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Header AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'fontSize' AST#expression#Right ) AST#decorator#Right fontSize : AST#type_annotation#Left A...
@Component export default struct Header { @StorageProp('fontSize') fontSize: number = 0 build() { Row() { Image($r('app.media.ic_back')) .width(20) .height(20) .margin({ left: 16 }) Text($r('app.string.play_list')) .fontSize(this.fontSize + 4) .fontWeight(500...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Header.ets#L16-L44
255dba262de8a7044b45a73b186178f35068a274
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets
arkts
aboutToResize
Callback when layout size changes.
aboutToResize(size: Size): void { console.log('aboutToResize width : ' + size.width + ' height : ' + size.height ) }
AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size 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 A...
aboutToResize(size: Size): void { console.log('aboutToResize width : ' + size.width + ' height : ' + size.height ) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L69-L71
e979c5d4a84244bfde7bea3708dfc99615083b62
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/DataModel.ets
arkts
getData
Retrieve data at the specified index.
public getData(index: number): VideoData { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left VideoData AST#primary_typ...
public getData(index: number): VideoData { return this.dataArray[index]; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/DataModel.ets#L108-L110
00abd4c7d54477f0a4bba6a77b9ddc2a9a5fab34
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
getWifiIsConnected
查询WLAN是否已连接是判断能否通过Wi-Fi 进行各种网络活动的直接方式。 @returns true,已连接。false,未连接
getWifiIsConnected(): boolean { try { let ret = wifiManager.isConnected(); logger.info('isConnected:' + ret); return ret; } catch (error) { logger.error('failed:' + JSON.stringify(error)); } return false; }
AST#method_declaration#Left getWifiIsConnected 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#try_statement#Left try AST#block_statement#Left { AST#statement#...
getWifiIsConnected(): boolean { try { let ret = wifiManager.isConnected(); logger.info('isConnected:' + ret); return ret; } catch (error) { logger.error('failed:' + JSON.stringify(error)); } return false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L235-L244
0d9b243197c1900368fa60ca25f0d6e61909fd65
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/HttpUtil.ets
arkts
put
@description: put请求函数 @param {string} url 请求地址 @param {Object} data 请求参数 @param {RequestConfig} OtherConfig request其他配置 @return {*}
public put<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url,{ method: http.RequestMethod.PUT,extraData: data}) }
AST#method_declaration#Left public put AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ,...
public put<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> { return this.request<T>(url,{ method: http.RequestMethod.PUT,extraData: data}) }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/HttpUtil.ets#L127-L129
f55bb796d4702f837b32446ffe8b4872a3e8344f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
分享平台枚举
export enum SharePlatform { WECHAT = 'wechat', WECHAT_MOMENTS = 'wechat_moments', QQ = 'qq', QQ_ZONE = 'qq_zone', WEIBO = 'weibo', DINGTALK = 'dingtalk', SMS = 'sms', EMAIL = 'email', SYSTEM = 'system' }
AST#export_declaration#Left export AST#enum_declaration#Left enum SharePlatform AST#enum_body#Left { AST#enum_member#Left WECHAT = AST#expression#Left 'wechat' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WECHAT_MOMENTS = AST#expression#Left 'wechat_moments' AST#expression#Right AST#enum_member#Rig...
export enum SharePlatform { WECHAT = 'wechat', WECHAT_MOMENTS = 'wechat_moments', QQ = 'qq', QQ_ZONE = 'qq_zone', WEIBO = 'weibo', DINGTALK = 'dingtalk', SMS = 'sms', EMAIL = 'email', SYSTEM = 'system' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L17-L27
a59812fe9d6fe9f1342cd8e5efe1d5235eac35d6
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/utils/MqttUtil.ets
arkts
startListen
启动消息监听
private async startListen() { if (!this.mqttClient) { console.warn('MQTT 客户端未创建'); return; } //当收到消息时 this.mqttClient.messageArrived((err, msg) => { const payload = msg.payload as string; const topic = JSON.parse(payload).notify_data.body.topic as string // 华为云IOT底层策略一条主题全...
AST#method_declaration#Left private async startListen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right...
private async startListen() { if (!this.mqttClient) { console.warn('MQTT 客户端未创建'); return; } this.mqttClient.messageArrived((err, msg) => { const payload = msg.payload as string; const topic = JSON.parse(payload).notify_data.body.topic as string if (msg.topic != to...
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L102-L121
980ecc8c77d49f850f9b173c5c729b18bd673c64
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/TEUtility.ets
arkts
convertDateFromYMD
根据 YMD 生成 Date
static convertDateFromYMD(year: number, month: number, day: number): Date { // ArkTS/JS 的 Date 构造方法:month 从 0 开始 return new Date(year, month - 1, day); }
AST#method_declaration#Left static convertDateFromYMD AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
static convertDateFromYMD(year: number, month: number, day: number): Date { return new Date(year, month - 1, day); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/TEUtility.ets#L154-L157
06de8989ab89beff150a7f227617192ce93ae68e
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/navigation/user/src/ets/search.ets
arkts
SearchPage
@Entry
@Component export struct SearchPage { @Consume('pathInfos') pathInfos: NavPathStack build() { NavDestination() { Column() { Blank().height('10%') // TODO: return Text after it is ready to work correctly Text('SearchPage') Butto...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SearchPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'pathInfos' AST#expression#Right ) AST#decorator#Right pathInfos : AST#type_annotation#Left AST#pri...
@Component export struct SearchPage { @Consume('pathInfos') pathInfos: NavPathStack build() { NavDestination() { Column() { Blank().height('10%') Text('SearchPage') Button('go back').width(200).height(100).onClick((e?: ClickEv...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/navigation/user/src/ets/search.ets#L10-L27
eb25cbc5313cd15458e503fd87f7395bd32ec138
gitee
xixi-cquer/BiJiDaiBan.git
206dc33a837acbe6fc837feff848427e83946534
entry/src/main/ets/common/constants/Constants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
export default class Constants { /** * The host address of the server. */ static readonly SERVER: string = 'http://xxx.xxx.xxx.xxx:9588'; /** * Get the news type. */ static readonly GET_NEWS_TYPE: string = 'news/getNewsType'; /** * Get the news list. */ static readonly GET_NEWS_LIST: str...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { /** * The host address of the server. */ AST#property_declaration#Left static readonly SERVER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#e...
export default class Constants { static readonly SERVER: string = 'http://xxx.xxx.xxx.xxx:9588'; static readonly GET_NEWS_TYPE: string = 'news/getNewsType'; static readonly GET_NEWS_LIST: string = 'news/getNewsList'; static readonly UPLOAD_NEWS: string = 'news/addNews'; static readonly UPLO...
https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/common/constants/Constants.ets#L14-L154
a8a6991b52b3b0d283899d0a810a9743e881d898
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/dialogs/managers/woofHistory.ets
arkts
focus_search
Focus on the search input.
focus_search() { focusControl.requestFocus(this.my_id); }
AST#method_declaration#Left focus_search 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 focusControl AST#expression#Right . requestFocus AS...
focus_search() { focusControl.requestFocus(this.my_id); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/dialogs/managers/woofHistory.ets#L661-L663
6a4bfc073a76c91d5b472bf1f811656c00a72aff
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
sign
签名 @param str 需要签名的字符串 @param priKey 私钥 @returns OutDTO<string> 签名对象
static async sign(str: string, priKey: string): Promise<OutDTO<string>> { return CryptoUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256); }
AST#method_declaration#Left static async sign 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static async sign(str: string, priKey: string): Promise<OutDTO<string>> { return CryptoUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets#L61-L63
b9ceb4d0705775a28df04b1b9b7c3d84eb523728
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Logger.ets
arkts
debug
打印 debug 级别日志 @param args - 可变参数,用于填充日志内容
debug(...args: string[]): void { hilog.debug(this.domain, this.prefix, this.format, ...args); }
AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
debug(...args: string[]): void { hilog.debug(this.domain, this.prefix, this.format, ...args); }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Logger.ets#L25-L27
602cc640e8307acae32f26193f636aa978196638
github
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/common/utils/ReadFile.ets
arkts
readFile. Reads the contents of a file and returns a string. @return string.
export function readFile(filename: string): string { try { let filePath = filesDir + '/' + filename; console.log(`文件路径:${filePath}`); let stat = fileIo.statSync(filePath); let size = stat.size; console.log(`文件大小: ${size} 字节`); // 如果文件为空,直接返回空字符串 if (size === 0) { console.log('文件为空'...
AST#export_declaration#Left export AST#function_declaration#Left function readFile AST#parameter_list#Left ( AST#parameter#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#...
export function readFile(filename: string): string { try { let filePath = filesDir + '/' + filename; console.log(`文件路径:${filePath}`); let stat = fileIo.statSync(filePath); let size = stat.size; console.log(`文件大小: ${size} 字节`); if (size === 0) { console.log('文件为空'); return ''...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/ReadFile.ets#L87-L134
6c0b6d9124cd3e9010d6d73ecc7ff1c2df4b0361
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/GridSample/entry/src/main/ets/view/GridAreaComponent.ets
arkts
GridAreaComponent
GridView component display and layout
@Component export struct GridAreaComponent { private gridAreaContents: Array<GridAreaContent>; build() { Column() { ForEach(this.gridAreaContents, (gridAreaContent: GridAreaContent) => { Grid() { ForEach(gridAreaContent.gridItems, (item: GridItemData) => { GridItem() { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridAreaComponent AST#component_body#Left { AST#property_declaration#Left private gridAreaContents : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annota...
@Component export struct GridAreaComponent { private gridAreaContents: Array<GridAreaContent>; build() { Column() { ForEach(this.gridAreaContents, (gridAreaContent: GridAreaContent) => { Grid() { ForEach(gridAreaContent.gridItems, (item: GridItemData) => { GridItem() { ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/GridSample/entry/src/main/ets/view/GridAreaComponent.ets#L8-L58
ab17e80d41140e8f311563104baa5e66ec9c2890
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets
arkts
cameraInputOpenFn
打开相机
async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> { let isOpenSuccess = false; try { await cameraInput.open(); isOpenSuccess = true; logger.info(TAG, 'cameraInput open success'); } catch (error) { logger.error(TAG, `createCameraInput failed : ${JSON.stringify...
AST#method_declaration#Left async cameraInputOpenFn AST#parameter_list#Left ( AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri...
async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> { let isOpenSuccess = false; try { await cameraInput.open(); isOpenSuccess = true; logger.info(TAG, 'cameraInput open success'); } catch (error) { logger.error(TAG, `createCameraInput failed : ${JSON.stringify...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets#L206-L216
887a22abaaffa988953fa1370d6edd4e6a4023c6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ThumbContent { framePlaceholder?: PixelMap = undefined; pixelMap?: PixelMap = undefined; }
AST#export_declaration#Left export AST#class_declaration#Left class ThumbContent AST#class_body#Left { AST#property_declaration#Left framePlaceholder ? : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#pr...
export class ThumbContent { framePlaceholder?: PixelMap = undefined; pixelMap?: PixelMap = undefined; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets#L16-L19
cf46d6e5c665a9099e081a762d16604f2f8dbdf9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsCommentsCard.ets
arkts
buildTitle
构建标题区域 @returns {void} 无返回值
@Builder private buildTitle(): void { TitleWithLine({ text: $r("app.string.goods_reviews") }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildTitle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#L...
@Builder private buildTitle(): void { TitleWithLine({ text: $r("app.string.goods_reviews") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsCommentsCard.ets#L72-L75
38c9b749a5e761044dee08c9f66c95e4a965db58
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderCard.ets
arkts
buildHeader
构建订单头部 @returns {void} 无返回值
@Builder private buildHeader(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: this.order.orderNum, value: this.getStatusText(this.order.status), isLink: false, hasBorder: true, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private buildHeader(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: this.order.orderNum, value: this.getStatusText(this.order.status), isLink: false, hasBorder: true, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderCard.ets#L88-L104
433ece0e90c4397d5b190ff8c01203f9b2908eef
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
toggleFavorite
切换收藏状态
toggleFavorite(): Contact { this.contact.isFavorite = !this.contact.isFavorite; this.contact.updatedAt = new Date().toISOString(); return this.getContact(); }
AST#method_declaration#Left toggleFavorite AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#...
toggleFavorite(): Contact { this.contact.isFavorite = !this.contact.isFavorite; this.contact.updatedAt = new Date().toISOString(); return this.getContact(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L232-L236
f43236ce030fc671f8139f28fdc8a8c9ef14b212
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
selectCoupon
选择优惠券 @param {Coupon | null} coupon 选中的优惠券,null表示不使用优惠券 @returns {void} 无返回值
selectCoupon(coupon: Coupon | null): void { this.selectedCoupon = coupon; this.hideCouponModal(); this.calculatePrices(); }
AST#method_declaration#Left selectCoupon AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Coupon AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#par...
selectCoupon(coupon: Coupon | null): void { this.selectedCoupon = coupon; this.hideCouponModal(); this.calculatePrices(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L230-L234
8b9353ef64c41b04901e924d86860a3a72231112
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/LazyForEach.ets
arkts
pushData
添加数据。 @param {string} data - 需要添加的数据。
public pushData(data: string | string[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#typ...
public pushData(data: string | string[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/LazyForEach.ets#L148-L155
395a08ce62c22ce24b0461bbd000b968ac69fec7
gitee
qytwnx/rxt
5950e6eb5fcdf9c8076fa0f0d002d752cb1c2496
entry/src/main/ets/component/home/component/Broadcast.ets
arkts
HomeBroadcast
轮播图
@Preview @Component export default struct HomeBroadcast { private broadcastList: Array<Resource> = [ $r('app.media.banner_01'), $r('app.media.banner_02'), $r('app.media.banner_03'), $r('app.media.banner_04'), $r('app.media.banner_05'), ] build() { Flex({ direction: FlexDirection.Column, a...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export default struct HomeBroadcast AST#component_body#Left { AST#property_declaration#Left private broadcastList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
@Preview @Component export default struct HomeBroadcast { private broadcastList: Array<Resource> = [ $r('app.media.banner_01'), $r('app.media.banner_02'), $r('app.media.banner_03'), $r('app.media.banner_04'), $r('app.media.banner_05'), ] build() { Flex({ direction: FlexDirection.Column, a...
https://github.com/qytwnx/rxt/blob/5950e6eb5fcdf9c8076fa0f0d002d752cb1c2496/entry/src/main/ets/component/home/component/Broadcast.ets#L4-L25
79ad6a53c6320a6811d57b38d56cf34aba8bb3e8
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
getNextReconnectDelay
计算指数退避重连延迟
private getNextReconnectDelay(): number { // 指数退避算法,最大延迟30秒 const delay = Math.min(30000, this.reconnectDelay * Math.pow(1.5, this.reconnectAttempts)); return delay; }
AST#method_declaration#Left private getNextReconnectDelay 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 { // 指数退避算法,最大延迟30秒 AST#statement#Left AST#variable_declaration#Left const AST#...
private getNextReconnectDelay(): number { const delay = Math.min(30000, this.reconnectDelay * Math.pow(1.5, this.reconnectAttempts)); return delay; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L49-L53
0a2d5f866a5002ec59e824e9f1fac7f8f450a580
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets
arkts
selectCACert
选择并加载 CA 证书
selectCACert() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.caCert = result[0]; this.msgHistory += `Selected CA certificate file: ${this.caCert}\n`; } }).catch((err: Error) => { this.msgHist...
AST#method_declaration#Left selectCACert AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expr...
selectCACert() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.caCert = result[0]; this.msgHistory += `Selected CA certificate file: ${this.caCert}\n`; } }).catch((err: Error) => { this.msgHist...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets#L226-L236
542090c1205fa89be926ccb764e808ba04def5ce
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativeembed/Index.ets
arkts
WebViewDemoComponent
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 { WebViewDemoComponent } from "./src/main/ets/view/NativeEmbedView";
AST#export_declaration#Left export { WebViewDemoComponent } from "./src/main/ets/view/NativeEmbedView" ; AST#export_declaration#Right
export { WebViewDemoComponent } from "./src/main/ets/view/NativeEmbedView";
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/Index.ets#L15-L15
6f72fc30cb62971d67d4b75ed7cc7e8e27532fdb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
[End pixelmap_get_resource_manager]
export class Decode { /** * 通过沙箱路径直接获取文件资源实例 * * @param fileName - 文件名称。 * @returns 图片资源实例。 **/ public getImageSourceByFilePath(fileName: string): image.ImageSource { // [Start pixelmap_get_image_by_filepath] const context: Context = getContext(this); // fileName可使用'/test.jpg',也可以根据实际环境传...
AST#export_declaration#Left export AST#class_declaration#Left class Decode AST#class_body#Left { /** * 通过沙箱路径直接获取文件资源实例 * * @param fileName - 文件名称。 * @returns 图片资源实例。 **/ AST#method_declaration#Left public getImageSourceByFilePath AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotati...
export class Decode { public getImageSourceByFilePath(fileName: string): image.ImageSource { const context: Context = getContext(this); const filePath: string = context.cacheDir + fileName; const imageSource: image.ImageSource = image.createImageSource(filePath); retur...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L37-L303
a568fae5e934975d01580fcc713193391ef6173a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
录音配置接口
export interface AudioRecordConfig { format: media.CodecMimeType; sampleRate: number; channels: number; bitRate: number; maxDuration: number; // 最大录制时长(秒) outputPath: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AudioRecordConfig AST#object_type#Left { AST#type_member#Left format : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . CodecMimeType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ty...
export interface AudioRecordConfig { format: media.CodecMimeType; sampleRate: number; channels: number; bitRate: number; maxDuration: number; outputPath: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L61-L68
f4610b83e70f0ea8ec1836c7d5759f1258a754be
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ResponsiveLayout/entry/src/main/ets/utils/BreakpointType.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class BreakpointType<T> { sm: T; md: T; lg: T; constructor(sm: T, md: T, lg: T) { this.sm = sm; this.md = md; this.lg = lg; } getValue(currentWidthBreakpoint: WidthBreakpoint): T { if (currentWidthBreakpoint === WidthBreakpoint.WIDTH_MD) { return this.md; } if (current...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointType AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left sm : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AS...
export class BreakpointType<T> { sm: T; md: T; lg: T; constructor(sm: T, md: T, lg: T) { this.sm = sm; this.md = md; this.lg = lg; } getValue(currentWidthBreakpoint: WidthBreakpoint): T { if (currentWidthBreakpoint === WidthBreakpoint.WIDTH_MD) { return this.md; } if (current...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ResponsiveLayout/entry/src/main/ets/utils/BreakpointType.ets#L16-L37
55645767abac652ba638f242ab816b1d3f748726
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets
arkts
disableWindowSystemBar
[End set_main]
disableWindowSystemBar(): void { if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } // Set the status bar and navigation bar to be invisible in full-screen mode. this.mainWindowClass.setWindowSystemBarEnable([]).catch((err: BusinessError) => { ...
AST#method_declaration#Left disableWindowSystemBar AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expressio...
disableWindowSystemBar(): void { if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } this.mainWindowClass.setWindowSystemBarEnable([]).catch((err: BusinessError) => { Logger.error(TAG, `disableWindowSystemBar failed, err.code:${err.code}, ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets#L101-L110
3c6d4565b5408fb2ad6671e1cfabdfeceb9f4a33
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
toggleFavoriteStatus
切换收藏状态
async toggleFavoriteStatus(historyId: string): Promise<boolean> { const history = this.generationHistory.find(h => h.id === historyId); if (!history) { return false; } history.isFavorited = !history.isFavorited; if (history.isFavorited) { await this.addToFavorites(history.type, history...
AST#method_declaration#Left async toggleFavoriteStatus AST#parameter_list#Left ( AST#parameter#Left historyId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
async toggleFavoriteStatus(historyId: string): Promise<boolean> { const history = this.generationHistory.find(h => h.id === historyId); if (!history) { return false; } history.isFavorited = !history.isFavorited; if (history.isFavorited) { await this.addToFavorites(history.type, history...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L163-L184
e0c817ce52fc79d6db72fffdb7f4df61eff748d0
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
deleteFile
删除路径下的文件 @param path 要删除的路径 @param fileName 要删除的文件 为空则删除path目录 直接写文件名即可无需左斜杠 @returns true删除成功,false删除失败
static deleteFile(path: string, fileName?: string): boolean { try { if (fileName) { //删除文件 fs.unlinkSync(path + '/' + fileName); return true; } //删除整个目录 fs.rmdirSync(path); return true; } catch (e) { return false; } }
AST#method_declaration#Left static deleteFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static deleteFile(path: string, fileName?: string): boolean { try { if (fileName) { fs.unlinkSync(path + '/' + fileName); return true; } fs.rmdirSync(path); return true; } catch (e) { return false; } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L279-L292
6631ed9e47be97b834a0b9c7f69fcea632a34254
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SettingsPage.ets
arkts
showAppDetailInfo
显示应用详情
showAppDetailInfo(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('确定', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( 'WaveCast(声波播客)', '一款专为HarmonyOS平台打造的开源播客管理器\n\n名称含义:\n• Wave - 声波\n• Cast - 播客/广播\n\n使用ArkTS语言和HarmonyOS SDK开发,提供完整的播客订阅、管理、下载和播放功能。\n\n开发者:陈云亮\n邮箱:67...
AST#method_declaration#Left showAppDetailInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left buttons...
showAppDetailInfo(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('确定', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( 'WaveCast(声波播客)', '一款专为HarmonyOS平台打造的开源播客管理器\n\n名称含义:\n• Wave - 声波\n• Cast - 播客/广播\n\n使用ArkTS语言和HarmonyOS SDK开发,提供完整的播客订阅、管理、下载和播放功能。\n\n开发者:陈云亮\n邮箱:67...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SettingsPage.ets#L338-L347
a12aceca6ccaf60c0884c85d654a96652e4142dd
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/FileUtil.ets
arkts
writeEasy
将数据写入文件,并关闭文件。 @param path string 文件的应用沙箱路径或URI。 @param buffer ArrayBuffer|string 待写入文件的数据,可来自缓冲区或字符串。 @param append 是否追加,true-追加,false-不追加(直接覆盖) @returns Promise对象。返回实际写入的数据长度,单位字节。
static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> { const file = FileUtil.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); const offset = append ? FileUtil.statSync(file.fd).size : 0 const options: WriteOptions = { offset: offset, encodin...
AST#method_declaration#Left static async writeEasy AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le...
static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> { const file = FileUtil.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); const offset = append ? FileUtil.statSync(file.fd).size : 0 const options: WriteOptions = { offset: offset, encodin...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L438-L445
e960433d56aa74060d523b1f92377f61fc58c40c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/ResultSetTool.ets
arkts
decodeString
/解码String
static decodeString(rs: relationalStore.ResultSet, colName: string): string | null { return StringEncoder.decodeAfterRemoveSalt(rs.getString(rs.getColumnIndex(colName))) }
AST#method_declaration#Left static decodeString AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left colName ...
static decodeString(rs: relationalStore.ResultSet, colName: string): string | null { return StringEncoder.decodeAfterRemoveSalt(rs.getString(rs.getColumnIndex(colName))) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/ResultSetTool.ets#L7-L9
8350b8335d7a507464a5a5e6d7887410467fceed
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
buildSearchTabs
构建搜索标签页
@Builder buildSearchTabs() { Row({ space: 20 }) { this.buildTabItem('全部', 'all', this.searchResult.total) this.buildTabItem('联系人', 'contacts', this.searchResult.contacts.length) this.buildTabItem('祝福语', 'greetings', this.searchResult.greetings.length) } .width('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTabs 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#component_parameters#Left { AST#component_parame...
@Builder buildSearchTabs() { Row({ space: 20 }) { this.buildTabItem('全部', 'all', this.searchResult.total) this.buildTabItem('联系人', 'contacts', this.searchResult.contacts.length) this.buildTabItem('祝福语', 'greetings', this.searchResult.greetings.length) } .width('100%') }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L268-L276
b963dac30d3a5bc1c4c27c0951ac4343aff26b0a
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
downloadEpisode
下载Episode
async downloadEpisode(episode: Episode): Promise<void> { // 如果已经在下载或队列中,直接返回 if (this.downloadTasks.has(episode.id) || this.downloadQueue.find(e => e.id === episode.id)) { console.warn('Episode is already downloading or in queue'); return; } // 如果已下载,直接返回 if (episode.downloadStatus === ...
AST#method_declaration#Left async downloadEpisode AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async downloadEpisode(episode: Episode): Promise<void> { if (this.downloadTasks.has(episode.id) || this.downloadQueue.find(e => e.id === episode.id)) { console.warn('Episode is already downloading or in queue'); return; } if (episode.downloadStatus === DownloadStatus.DOWNLOADED) { ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L49-L67
757a6e7862f6bb999cb2e123217482f63b4473a7
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/DeviceScreen.ets
arkts
getDeviceSize
Get the device size. @returns promise of window.
public static getDeviceSize(context: common.UIAbilityContext): Promise<null | window.Window> { let lastWindow = window.getLastWindow(context).catch((err: Error) => { Logger.error(TAG, `getDeviceSize failed, error = ${JSON.stringify(err)}`); return null; }) return lastWindow }
AST#method_declaration#Left public static getDeviceSize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
public static getDeviceSize(context: common.UIAbilityContext): Promise<null | window.Window> { let lastWindow = window.getLastWindow(context).catch((err: Error) => { Logger.error(TAG, `getDeviceSize failed, error = ${JSON.stringify(err)}`); return null; }) return lastWindow }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/DeviceScreen.ets#L30-L36
1778f49ef235e49d6de908b45f4bdd73f53d4200
github