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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
动画缓动枚举
export enum AnimationEasing { LINEAR = 'linear', EASE_IN = 'ease_in', EASE_OUT = 'ease_out', EASE_IN_OUT = 'ease_in_out', BOUNCE = 'bounce' }
AST#export_declaration#Left export AST#enum_declaration#Left enum AnimationEasing AST#enum_body#Left { AST#enum_member#Left LINEAR = AST#expression#Left 'linear' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left EASE_IN = AST#expression#Left 'ease_in' AST#expression#Right AST#enum_member#Right , AST#enu...
export enum AnimationEasing { LINEAR = 'linear', EASE_IN = 'ease_in', EASE_OUT = 'ease_out', EASE_IN_OUT = 'ease_in_out', BOUNCE = 'bounce' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L144-L150
afb3ed614b47f706edebb4ff740e8969dd909b46
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
classToPlain
将类实例转换为普通对象 @param classInstance 类实例(或任意数据) @returns 普通纯对象
static classToPlain<T>(classInstance: T): Record<string, Object> { return ClassTransformer.classToPlain(classInstance); }
AST#method_declaration#Left static classToPlain AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left classInstance : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#par...
static classToPlain<T>(classInstance: T): Record<string, Object> { return ClassTransformer.classToPlain(classInstance); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L204-L206
6adab89908c25b013d88fe3c924801de35c9cc08
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
getArgById
根据dialogId获取PromptActionArg @param dialogId @returns
getArgById(dialogId: string): ActionCoreArg | undefined { return this.caches.find(item => dialogId == item.dialogId); }
AST#method_declaration#Left getArgById AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Action...
getArgById(dialogId: string): ActionCoreArg | undefined { return this.caches.find(item => dialogId == item.dialogId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L291-L293
36702fca412e3c42953b4a03e6931bb6510ba266
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/viewmodel/ShotCutCardData.ets
arkts
快捷键列表的Item数据结构
export class ShortCutItemEntity { type: string name: string imageSrc: ResourceStr itemId: string itemName: string itemRes: ResourceStr // constructor( // type: string, // name: string, // imageSrc: ResourceStr) { // this.type = type // this.name = name // this.imageSrc = imageSrc ...
AST#export_declaration#Left export AST#ERROR#Left class ShortCutItemEntity { type AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left name : string imageSrc : ResourceStr itemId AST#ERROR#Right : string itemName : strin...
export class ShortCutItemEntity { type: string name: string imageSrc: ResourceStr itemId: string itemName: string itemRes: ResourceStr constructor
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/ShotCutCardData.ets#L52-L69
2564772362654e26efa6783872ee3530f7a323b6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
reminderId -> systemId
private constructor() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TimedReminderService] Service initialized'); }
AST#constructor_declaration#Left private constructor 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 hilog AST#expression#Right...
private constructor() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TimedReminderService] Service initialized'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L38-L40
d67807e0896f114df1291cf5bad11d13e57c2a9c
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
get
Gets the corresponding value of key from settings. @param key The key. @returns The value.
static get(key: string): string | number | boolean { let key_default_index = bunch_of_settings.settings_defaults_key.indexOf(key); let key_default_value = bunch_of_settings.settings_defaults_value[key_default_index]; let type = bunch_of_settings.settings_defaults_type[key_default_index]; // Sequential ...
AST#method_declaration#Left static get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#...
static get(key: string): string | number | boolean { let key_default_index = bunch_of_settings.settings_defaults_key.indexOf(key); let key_default_value = bunch_of_settings.settings_defaults_value[key_default_index]; let type = bunch_of_settings.settings_defaults_type[key_default_index]; for (let ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L190-L212
5a42703172fa3f2267f8dc07ffd66911042227a3
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/subwindow/SubWindowUtils.ets
arkts
dragToMove
拖拽滑动 @param event 手势事件 @param window 目标窗口 @param windowPosition 位置信息
public dragToMove(event: GestureEvent, windowPosition: Position, windowClass: window.Window = SubWindowUtils.windowClass, context: UIContext = AppUtils.getUIContext()) { if (!windowClass) { LogUtils.error(TAG, "windowClass 为空,请先调用 initSubWindow 初始化!") return } let bottomRectHeight = St...
AST#method_declaration#Left public dragToMove AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowPosition : AST#type_annotation#Left AST#primary_type#Left Positio...
public dragToMove(event: GestureEvent, windowPosition: Position, windowClass: window.Window = SubWindowUtils.windowClass, context: UIContext = AppUtils.getUIContext()) { if (!windowClass) { LogUtils.error(TAG, "windowClass 为空,请先调用 initSubWindow 初始化!") return } let bottomRectHeight = St...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/subwindow/SubWindowUtils.ets#L129-L151
ce2577b3b5f4cdf0e2e4f567deeef515137e815e
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_020_F.ets
arkts
Introduction 库函数-string_toLowerCase
export function string_lib_func_020_F(taint_src : string) { let clean = "clean"; let t = clean.toLowerCase(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_020_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_020_F(taint_src : string) { let clean = "clean"; let t = clean.toLowerCase(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_020_F.ets#L7-L11
52b10bfb5530ef23d580aa03f7ba13977259a868
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Scroll.ets
arkts
MediumPaddingHorizontalScroll
带中等内边距的水平滚动布局
@ComponentV2 export struct MediumPaddingHorizontalScroll { /** * 滚动控制器 */ @Param scroller: Scroller = new Scroller(); /** * 是否填充最大尺寸 */ @Param fillMaxSize: boolean = false; /** * 是否填充最大宽度 */ @Param fillMaxWidth: boolean = true; /** * 宽度 */ @Param widthValue: Length | unde...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MediumPaddingHorizontalScroll AST#component_body#Left { /** * 滚动控制器 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right scroller : AST#type_annotation#Left AST#primary_type#Left Scr...
@ComponentV2 export struct MediumPaddingHorizontalScroll { @Param scroller: Scroller = new Scroller(); @Param fillMaxSize: boolean = false; @Param fillMaxWidth: boolean = true; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L455-L509
93ad0ef53bd6d4ed8d9ad5b09f2cebbce147c0e0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
createBirthdayReminder
为联系人创建生日提醒
async createBirthdayReminder(contact: Contact, advanceDays: number = 1): Promise<string> { try { const settings = await this.settingsService.getSettings(); if (!settings.notification.enabled) { throw new Error('通知未启用'); } const reminderId = this.generateReminderId(ReminderType.BIRTH...
AST#method_declaration#Left async createBirthdayReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left advanceDays : AST#type_annotation#Left AST#primary_type#Left nu...
async createBirthdayReminder(contact: Contact, advanceDays: number = 1): Promise<string> { try { const settings = await this.settingsService.getSettings(); if (!settings.notification.enabled) { throw new Error('通知未启用'); } const reminderId = this.generateReminderId(ReminderType.BIRTH...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L120-L178
bd4e1450bc8cddc4749d222a79a9e7d826d0f811
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/HttpUtil.ets
arkts
setToken
请求函数(单例模式) **注意:** `method`需使用`HttpMethod`枚举类,切勿自行定义 **示例代码** ```js HttpRequest.getInstance().request({ url: "/Api", method: HttpMethod.GET }) ```
public setToken(token:string){ this.token = token; }
AST#method_declaration#Left public setToken AST#parameter_list#Left ( AST#parameter#Left token : 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 setToken(token:string){ this.token = token; }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/HttpUtil.ets#L33-L35
a861abbd4e1fa85af32883a725d971511a362266
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/SendMessage.ets
arkts
SendMessage
Copyright (c) 2022-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,...
@Component export default struct SendMessage { @Link message: string private sendMessage: () => void build() { Row() { TextArea({ placeholder: this.message, text: this.message }) .height(50) .fontSize(25) .id('text_input') .layoutWeight(3) .backgroundColor(Color....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SendMessage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
@Component export default struct SendMessage { @Link message: string private sendMessage: () => void build() { Row() { TextArea({ placeholder: this.message, text: this.message }) .height(50) .fontSize(25) .id('text_input') .layoutWeight(3) .backgroundColor(Color....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/SendMessage.ets#L16-L54
41aea418c251f118ba23e21825b7b649ba050492
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/BaseMapper.ets
arkts
getObject
查询得到对象 @param wrapper 查询条件 @returns 对象数组
async getObject(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<ESObject[]> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.list(myWrapper.g...
AST#method_declaration#Left async getObject AST#parameter_list#Left ( AST#parameter#Left wrapper : AST#type_annotation#Left AST#primary_type#Left Wrapper AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Wr...
async getObject(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<ESObject[]> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.list(myWrapper.g...
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/BaseMapper.ets#L87-L110
a62e7b890bad6593595a50295dca036ffa37159c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
getFileExtention
根据文件名获取文件后缀 @param fileName 例如: test.txt test.doc @returns
static getFileExtention(fileName: string) { if (StrUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement...
static getFileExtention(fileName: string) { if (StrUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L230-L235
6ec834c60b74fca2915aaec0bc325e43ae3a8930
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/permission_tools.ets
arkts
Analyzes a list of protected resource types and return their according permissions. @param prt the list of protected resource types. @returns a list of Permissions.
export function permissions_for_ProtectedResourceTypes(prt: string[]) { let permissions: Permissions[] = []; for (let index = 0; index < prt.length; index++) { const ProtectedResourceType = prt[index]; if (ProtectedResourceType == 'TYPE_AUDIO_CAPTURE') { permissions.push('ohos.permission.MICROPHONE');...
AST#export_declaration#Left export AST#function_declaration#Left function permissions_for_ProtectedResourceTypes AST#parameter_list#Left ( AST#parameter#Left prt : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#para...
export function permissions_for_ProtectedResourceTypes(prt: string[]) { let permissions: Permissions[] = []; for (let index = 0; index < prt.length; index++) { const ProtectedResourceType = prt[index]; if (ProtectedResourceType == 'TYPE_AUDIO_CAPTURE') { permissions.push('ohos.permission.MICROPHONE');...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/permission_tools.ets#L25-L37
ac88e866a973f5bed5573a2e800da5fe37611fbf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/BottomDrawer.ets
arkts
BottomDrawer
功能描述: 1.本示例主要介绍了利用List实现底部抽屉滑动效果场景,并将界面沉浸式(全屏)显示,及背景地图可拖动。 实现原理: 1.通过listHeight记录底部列表高度变化 2.通过onTouch属性实现根据手指滑动距离,底部列表高度进行变化 3.手指移开屏幕后,通过判断列表高度实现抽屉式滑动效果 @param {()=>void} searchAddress - 搜索视图 @param {()=>void} listBuilder - 列表视图 @param {boolean} isShow - 顶部遮蔽导航栏区域是否显示 @param {BottomDrawerHeight} bottomDrawerHeight -...
@Component export struct BottomDrawer { // -------------------对外暴露变量----------------------- @BuilderParam searchAddress: () => void; // 搜索视图组件 @BuilderParam listBuilder: () => void; // 列表视图组件 @Link isShow: boolean; // 顶部遮蔽导航栏区域是否显示 bottomDrawerHeight: BottomDrawerHeight = new BottomDrawerHeight(); // 列表阶段高度属性...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomDrawer AST#component_body#Left { // -------------------对外暴露变量----------------------- AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right searchAddress : AST#type_annotation#Left A...
@Component export struct BottomDrawer { @BuilderParam searchAddress: () => void; @BuilderParam listBuilder: () => void; @Link isShow: boolean; bottomDrawerHeight: BottomDrawerHeight = new BottomDrawerHeight(); @State isUp: boolean = true; @State bottomAvoidHeight: number = 0; @State isScroll: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/BottomDrawer.ets#L39-L213
9979a9815e67f0f35bf4498fe4d9234e014e8e7c
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBarV2.d.ets
arkts
Declare the options of ToolBarV2SymbolGlyph @interface ToolBarV2SymbolGlyphOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export interface ToolBarV2SymbolGlyphOptions { /** * Modifier of toolbarV2's normal symbol. * * @type { SymbolGlyphModifier } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ normal: SymbolGlyphModifier; /** * Modifier of toolbarV2's activated...
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolBarV2SymbolGlyphOptions AST#object_type#Left { /** * Modifier of toolbarV2's normal symbol. * * @type { SymbolGlyphModifier } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 ...
export interface ToolBarV2SymbolGlyphOptions { normal: SymbolGlyphModifier; activated?: SymbolGlyphModifier; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L115-L136
c3679980622e19f76efc2a82997c4b2c850c57bf
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets
arkts
isFirstLaunchOfCurrentVersion
/ 是否为当前版本的首次启动
public async isFirstLaunchOfCurrentVersion(): Promise<boolean> { if (this._newVersion === this.defaultVersion) { await this.initVersionInfo() } return this._oldVersion !== this._newVersion; }
AST#method_declaration#Left public async isFirstLaunchOfCurrentVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_anno...
public async isFirstLaunchOfCurrentVersion(): Promise<boolean> { if (this._newVersion === this.defaultVersion) { await this.initVersionInfo() } return this._oldVersion !== this._newVersion; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L53-L58
4bdcf3120ba6663408994aa4b63da051317af9f2
github
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getDnsOverHttps
Getter and setter for dnsOverHttps
getDnsOverHttps(): string | undefined { return this.dnsOverHttps; }
AST#method_declaration#Left getDnsOverHttps AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#...
getDnsOverHttps(): string | undefined { return this.dnsOverHttps; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L155-L157
bad5ff7c2ecbca04581f67073365bacf330adf74
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets
arkts
@file 页面相关数据源实现类 @author Joker.X
export class PageNetworkDataSourceImpl implements PageNetworkDataSource { /** * 获取首页数据 * @returns {Promise<NetworkResponse<Home>>} 首页聚合数据 */ async getHomeData(): Promise<NetworkResponse<Home>> { const resp: AxiosResponse<NetworkResponse<Home>> = await NetworkClient.http.get("page/home"); retu...
AST#export_declaration#Left export AST#class_declaration#Left class PageNetworkDataSourceImpl AST#implements_clause#Left implements PageNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /** * 获取首页数据 * @returns {Promise<NetworkResponse<Home>>} 首页聚合数据 */ AST#method_declaration#Left async getHom...
export class PageNetworkDataSourceImpl implements PageNetworkDataSource { async getHomeData(): Promise<NetworkResponse<Home>> { const resp: AxiosResponse<NetworkResponse<Home>> = await NetworkClient.http.get("page/home"); return resp.data; } async getGoodsDetail(goodsId: number): Promise<Netw...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets#L10-L41
c0ca2ae1b96c74d88c82443997afdeba5cdbf397
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/AcademyManager.ets
arkts
AI对话记录
export interface AIConversation { id: string; timestamp: Date; userMessage: string; aiResponse: string; context: 'recommendation' | 'learning' | 'analysis' | 'motivation'; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIConversation AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left timestamp : AST#type_annotation#...
export interface AIConversation { id: string; timestamp: Date; userMessage: string; aiResponse: string; context: 'recommendation' | 'learning' | 'analysis' | 'motivation'; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L51-L57
9b81c990aec64f6999c79453bb1ac671345ccb40
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/ResPath.ets
arkts
资源名称常量
export class ResName { // Book static readonly Book = new ResPath("Book", "Datas/0_Books/0_BookCate/BookList.sqlite.zip"); // // Word_Cns // static readonly Word_Cns = new ResPath("Word_Cns", "Datas/Word_Cns.sqlite"); // // // Word_Cnt // static readonly Word_Cnt = new ResPath("Word_Cnt", "Datas/Word_C...
AST#export_declaration#Left export AST#class_declaration#Left class ResName AST#class_body#Left { // Book AST#property_declaration#Left static readonly Book = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ResPath AST#expression#Right AST#new_expression#...
export class ResName { static readonly Book = new ResPath("Book", "Datas/0_Books/0_BookCate/BookList.sqlite.zip"); Word_Cnt static readonly Word_Cnt = new ResPath("Word_Cnt", "Datas/Word_Cnt.sqlite"); BaseDict_Cns static readonly BaseDict_Cns = new ResPath("BaseDict_Cns", "Datas/91_BaseDic...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/ResPath.ets#L37-L77
15a628ab1932c7078bca5e7541fa3f5c3f472007
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
arkts
改为自己应用的编号
export default class EntryBackupAbility extends BackupExtensionAbility { async onBackup() { hilog.info(DOMAIN, 'testTag', 'onBackup ok'); } async onRestore(bundleVersion: BundleVersion) { hilog.info(DOMAIN, 'testTag', `onRestore ok %{public}s`, JSON.stringify(bundleVersion)); } }
AST#export_declaration#Left export default AST#class_declaration#Left class EntryBackupAbility extends AST#type_annotation#Left AST#primary_type#Left BackupExtensionAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left async onBackup AST#parameter_list#Left ( ) AST#p...
export default class EntryBackupAbility extends BackupExtensionAbility { async onBackup() { hilog.info(DOMAIN, 'testTag', 'onBackup ok'); } async onRestore(bundleVersion: BundleVersion) { hilog.info(DOMAIN, 'testTag', `onRestore ok %{public}s`, JSON.stringify(bundleVersion)); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets#L21-L29
0df20bec0292be57300cf8a1386c483027fce9ad
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets
arkts
getDownloadFileSize
获取要下载的文件大小
async getDownloadFileSize() { let size = 0 const session = rcp.createSession(); let resp = await session.head(this.downloadFileInfo.url) if (resp.statusCode != 200) { return 0; } if (resp.headers["content-length"] != undefined) { size = Number.parseInt(resp.headers["content-length"]....
AST#method_declaration#Left async getDownloadFileSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left size = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right AST#variable_declaratio...
async getDownloadFileSize() { let size = 0 const session = rcp.createSession(); let resp = await session.head(this.downloadFileInfo.url) if (resp.statusCode != 200) { return 0; } if (resp.headers["content-length"] != undefined) { size = Number.parseInt(resp.headers["content-length"]....
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets#L157-L169
a8d5e02e1097019f9d9edd8b2456f90c4e92f4e5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceSearch.d.ets
arkts
Defines the InputFilter parameters. @typedef InputFilterParams @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export interface InputFilterParams { /** * Regular expression. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ inputFilterValue: ResourceStr; /** * If the regular expression matching fails, the filtered content is returned. * * @t...
AST#export_declaration#Left export AST#interface_declaration#Left interface InputFilterParams AST#object_type#Left { /** * Regular expression. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#type_member#Left inputFilterValue : AST#type_annot...
export interface InputFilterParams { inputFilterValue: ResourceStr; error?: Callback<string>; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L72-L91
f466a264240f9a771813725e347617c1ff0e2c7b
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/annotation/Attribute.ets
arkts
@author: HZWei @date: 2024/12/3 @desc:
export function ZAttribute(param: Param) { return Object }
AST#export_declaration#Left export AST#function_declaration#Left function ZAttribute AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Param AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#st...
export function ZAttribute(param: Param) { return Object }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/annotation/Attribute.ets#L8-L10
d713cc72075bdfde7b32c9e1413fac33a8525d48
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/viewmodel/SHCViewModel.ets
arkts
getButtonsList
获取所有列表数据(返回副本防止外部修改)
getButtonsList(): SNListItemModel[] { return [...this.buttonsList]; }
AST#method_declaration#Left getButtonsList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SNListItemModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statemen...
getButtonsList(): SNListItemModel[] { return [...this.buttonsList]; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/viewmodel/SHCViewModel.ets#L39-L41
7ac7078180bcaed6592ef195404206cbf18fa3cb
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
Defines new key of exchange data. @interface ExchangeKey @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export interface ExchangeKey { /** * Key of the first exchange data. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ start: string; /** * Key of the second exchange data. * * @type { stri...
AST#export_declaration#Left export AST#interface_declaration#Left interface ExchangeKey AST#object_type#Left { /** * Key of the first exchange data. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ AST#type_member#L...
export interface ExchangeKey { start: string; end: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L306-L327
667d409116da3e295191b00490eb380c24c29ffb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
getNumber
获取number类型的缓存值 @param key @returns
static async getNumber(key: string, defValue: number = 0, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<number> { let value = await PreferencesUtil.get(key, defValue, preferenceName); return value as number; }
AST#method_declaration#Left static async getNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
static async getNumber(key: string, defValue: number = 0, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<number> { let value = await PreferencesUtil.get(key, defValue, preferenceName); return value as number; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L161-L165
cf2f2802a159d89ff4c8aa682baf33125e256a12
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
digest
摘要 @param str 带摘要的字符串 @param symAlgName 秘钥规格 @returns 摘要后的字符串
static async digest(str: string, symAlgName: string): Promise<string> { //摘要对象 let md = crypto.createMd(symAlgName); //字符串转换的字节流对象 let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer); let updateLength = 200; // 默认以200字节为单位进行分段update for (let i = 0; i < messageData.length; i += upd...
AST#method_declaration#Left static async digest 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 symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static async digest(str: string, symAlgName: string): Promise<string> { let md = crypto.createMd(symAlgName); let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer); let updateLength = 200; for (let i = 0; i < messageData.length; i += updateLength) { let updateMessage = mess...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L393-L406
56acd3f07ee0cb46004e7012bfb733f7ac49ac41
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
getIntersection
Get the intersection point of two lines. @param line1 @param line2 @returns Intersection coordinates.
static getIntersection(line1: LineSegment, line2: LineSegment): Point | undefined { let yStartSpacing1 = line1.start.y - line1.end.y; let yEndSpacing1 = line1.end.x - line1.start.x; let resultLine1 = yStartSpacing1 * line1.start.x + yEndSpacing1 * line1.start.y; let yStartSpacing2 = line2.start.y - lin...
AST#method_declaration#Left static getIntersection AST#parameter_list#Left ( AST#parameter#Left line1 : AST#type_annotation#Left AST#primary_type#Left LineSegment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left line2 : AST#type_annotation#Left AST#primary_type#Left LineSegment ...
static getIntersection(line1: LineSegment, line2: LineSegment): Point | undefined { let yStartSpacing1 = line1.start.y - line1.end.y; let yEndSpacing1 = line1.end.x - line1.start.x; let resultLine1 = yStartSpacing1 * line1.start.x + yEndSpacing1 * line1.start.y; let yStartSpacing2 = line2.start.y - lin...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L177-L199
cae70e4d37266c1052dfb40534eb2fabd2580ff1
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets
arkts
operateTextStyle
Custom text button style.
@Extend(Text) function operateTextStyle(color: Resource) { .fontSize($r('app.float.text_button_font')) .fontColor(color) .lineHeight($r('app.float.text_line_height')) .fontWeight(CommonConstants.FONT_WEIGHT) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function operateTextStyle AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Righ...
@Extend(Text) function operateTextStyle(color: Resource) { .fontSize($r('app.float.text_button_font')) .fontColor(color) .lineHeight($r('app.float.text_line_height')) .fontWeight(CommonConstants.FONT_WEIGHT) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets#L174-L179
1e2ad994b3e0c2499ce629d5cffff73051eb3e31
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/TrainsTrack.ets
arkts
fetchStartPosition
Obtain initial position.
fetchStartPosition() { const travelDistance = TrainsMapModel.travelDistance( this.sumDistance, this.fetchStartTime(this.trainLine), this.trainLine); this.calcFirstDistance(this.trainsInfo.lineData, travelDistance); }
AST#method_declaration#Left fetchStartPosition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left travelDistance = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left ...
fetchStartPosition() { const travelDistance = TrainsMapModel.travelDistance( this.sumDistance, this.fetchStartTime(this.trainLine), this.trainLine); this.calcFirstDistance(this.trainsInfo.lineData, travelDistance); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/TrainsTrack.ets#L52-L56
d34e72cf54aadd4a74898896b67f3486132b6ea8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets
arkts
aboutToResize
当布局大小发生变化时进行回调
aboutToResize(size: Size) { console.info('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#builder_function_body#Left { AST#expression_statement#Left AST#expression#...
aboutToResize(size: Size) { console.info('aboutToResize width : ' + size.width + ' height : ' + size.height); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets#L61-L63
d538fb30e072a85971793d5aacb956fd46bf495f
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/workers/History_indexer.ets
arkts
get_history_months_no_create_this_month
Functions borrowed from bunch_of_history to avoid error when bunch_of_history is not even initialized TODO: Find a more elegant way of doing this Lists all the months in which ther are history records made, in ascending order. @returns A number[][] array, e.g. [[2023, 2], [2023, 3], [2023, 4], ...].
function get_history_months_no_create_this_month(context_filesDir: string) { let filesDir: string = context_filesDir; let result: number[][] = []; let history_files = fs.listFileSync(filesDir + '/history', { recursion: false }); for (let index = 0; index < history_files.length; index++) { let f_name = histo...
AST#function_declaration#Left function get_history_months_no_create_this_month AST#parameter_list#Left ( AST#parameter#Left context_filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ...
function get_history_months_no_create_this_month(context_filesDir: string) { let filesDir: string = context_filesDir; let result: number[][] = []; let history_files = fs.listFileSync(filesDir + '/history', { recursion: false }); for (let index = 0; index < history_files.length; index++) { let f_name = histo...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/workers/History_indexer.ets#L108-L123
a3a01d5ed4ca91787e8a2681a452768c79df8dda
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets
arkts
uri2UploadImageFilePath
鸿蒙原生上传只支持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) } else if (url.startsWith(cacheDir)) { return url.replace(ca...
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_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
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(cacheDir)) { return url.replace(ca...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets#L11-L20
3f428fd38bc1726f3aaaffc95e86925f6c55d245
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowBase
@file 通用 Row 布局简化组件 @author Joker.X 通用 Row 布局(保留官方 Row 能力)
@ComponentV2 export struct RowBase { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 主轴对齐方式 */ @Param justifyContent: FlexAlign = FlexAlign.Start; /** * 交叉轴对齐方式 */ @Param alignItems: VerticalAlign = VerticalAlign.Center; /** * 宽度 */ @Param widthVal...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowBase AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Row...
@ComponentV2 export struct RowBase { @Param options: RowOptions | RowOptionsV2 = {}; @Param justifyContent: FlexAlign = FlexAlign.Start; @Param alignItems: VerticalAlign = VerticalAlign.Center; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined =...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L11-L140
1179b314fdf78edb68f25de3b586486f7a463a61
github
fourseas1998/hos.RankingDemo.git
5a98167826252c3c2b5ac58fa9a3db29d5f49d02
entry/src/main/ets/common/constants/Constants.ets
arkts
公共常量枚举-字体大小
export enum FontSize { SMALL = 14, MIDDLE = 16, LARGE = 20, }
AST#export_declaration#Left export AST#enum_declaration#Left enum FontSize AST#enum_body#Left { AST#enum_member#Left SMALL = AST#expression#Left 14 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MIDDLE = AST#expression#Left 16 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LARGE = ...
export enum FontSize { SMALL = 14, MIDDLE = 16, LARGE = 20, }
https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/common/constants/Constants.ets#L4-L8
24ad4252326c0a24a3830bc35b64aa3564ad8b46
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/LottieView.ets
arkts
LottieView
加载动画自定义组件
@Preview @ComponentV2 export struct LottieView { @Require @Param options: LoadOptions; @Local content: string = ''; private canvasRenderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(new RenderingContextSettings(true)); aboutToAppear(): void { if (this.options.content) { this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LottieView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right opt...
@Preview @ComponentV2 export struct LottieView { @Require @Param options: LoadOptions; @Local content: string = ''; private canvasRenderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(new RenderingContextSettings(true)); aboutToAppear(): void { if (this.options.content) { this...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/LottieView.ets#L15-L69
c4b6c17f198253463e0ad028653859d8e22059bf
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/LimitLine.ets
arkts
enum that indicates the position of the LimitLine label
export enum LimitLabelPosition { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM }
AST#export_declaration#Left export AST#enum_declaration#Left enum LimitLabelPosition AST#enum_body#Left { AST#enum_member#Left LEFT_TOP AST#enum_member#Right , AST#enum_member#Left LEFT_BOTTOM AST#enum_member#Right , AST#enum_member#Left RIGHT_TOP AST#enum_member#Right , AST#enum_member#Left RIGHT_BOTTOM AST#enum_membe...
export enum LimitLabelPosition { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/LimitLine.ets#L199-L201
eb00b5592e11446ac6bd30e6833b85fbb30f44fd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/view/TabsWaterFlowView.ets
arkts
methodPoints
底部导航栏高度 瀑布流列表项组件布局 @param listData 组件列表信息
@Builder methodPoints(listData: WaterFlowModule) { Column() { Image(listData.imageSrc) .borderRadius($r('app.integer.dragtoswitchpictures_waterflow_image_borderradius')) .objectFit(ImageFit.Contain) .width($r('app.string.dragtoswitchpictures_full_size')) Text(listData.name) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right methodPoints AST#parameter_list#Left ( AST#parameter#Left listData : AST#type_annotation#Left AST#primary_type#Left WaterFlowModule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fun...
@Builder methodPoints(listData: WaterFlowModule) { Column() { Image(listData.imageSrc) .borderRadius($r('app.integer.dragtoswitchpictures_waterflow_image_borderradius')) .objectFit(ImageFit.Contain) .width($r('app.string.dragtoswitchpictures_full_size')) Text(listData.name) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/view/TabsWaterFlowView.ets#L40-L84
fc62043a8f36a28b55b5624ff5b74aadea0a4288
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getMediaSource
获取媒体数据源 @param id @returns
public getMediaSource(id: string): Promise<FinItemSource> { return this.requireApi().getItemSource(id) }
AST#method_declaration#Left public getMediaSource AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
public getMediaSource(id: string): Promise<FinItemSource> { return this.requireApi().getItemSource(id) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L143-L145
d712ef7dc7bd2f781aae10f1edff7dbe5126d194
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets
arkts
registerDataChangeListener
为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L32-L36
4bdb366a1c15be665f64d26a130738224b80b18e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets
arkts
bottomBar
底部栏视图(正确与错误数量,答题卡入口,是否收藏)
@Builder bottomBar() { Row() { Image($r('app.media.correct')) .width(16) .height(16) .margin({ right: '1%', }); Text(String(this.examManager.correctNumber)); Image($r('app.media.error')) .width(16) .height(16) .margin({ ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#L...
@Builder bottomBar() { Row() { Image($r('app.media.correct')) .width(16) .height(16) .margin({ right: '1%', }); Text(String(this.examManager.correctNumber)); Image($r('app.media.error')) .width(16) .height(16) .margin({ ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L230-L330
e23ae317e7ed9f290cc61dc835e449c7b2e88813
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/wordrecognition/src/main/ets/pages/WordRecognition.ets
arkts
WordRecognitionComponent
允许识别的文本类型 功能描述: 本示例介绍使用text组件的enableDataDetector属性实现文本特殊文字识别。 推荐场景: 文本特殊文字识别场景 核心组件: 1. enableDataDetector 2. dataDetectorConfig 实现步骤: 1. 使用text组件的enableDataDetector属性实现文本特定文字识别。 2. 使用text组件的dataDetectorConfig属性设置允许识别的类型。
@Component export struct WordRecognitionComponent { // 键盘安全高度 @State keyboardHeight: number = 0; private scrollerForLiftUp: Scroller = new Scroller(); // 滚动条组件 private scroller: Scroller = new Scroller(); private textDetailData = new TextDetailData(); // TextArea组件的控制器 textAreaController: TextAreaContro...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WordRecognitionComponent AST#component_body#Left { // 键盘安全高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right keyboardHeight : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
@Component export struct WordRecognitionComponent { @State keyboardHeight: number = 0; private scrollerForLiftUp: Scroller = new Scroller(); private scroller: Scroller = new Scroller(); private textDetailData = new TextDetailData(); textAreaController: TextAreaController = new TextAreaController(); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/wordrecognition/src/main/ets/pages/WordRecognition.ets#L42-L195
a531b29f2cb225f17f889da4be6ae9db1cffd757
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderRefundPage.ets
arkts
OrderRefundPage
@file 订单退款页面视图 @author Joker.X
@ComponentV2 export struct OrderRefundPage { /** * 订单退款页面 ViewModel */ @Local private vm: OrderRefundViewModel = new OrderRefundViewModel(); /** * 当前窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 构建订单退款页面 * @returns {void} 无返回值 */...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderRefundPage AST#component_body#Left { /** * 订单退款页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Orde...
@ComponentV2 export struct OrderRefundPage { @Local private vm: OrderRefundViewModel = new OrderRefundViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build() { AppNavDestination({ title: $r("app.string.order_refund"), viewModel: this.v...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L25-L197
154e1d472518d7fe93e1008db444b33d0455afe9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/library/src/main/ets/components/mainpage/SubPage.ets
arkts
SubPage
... [End not_recommend_demo]
@Component export struct SubPage { @Consume pathStack: NavPathStack; @State message: string = 'HAR SubPage'; build() { Row() { Text(this.message) .fontSize(32) .fontWeight(FontWeight.Bold) }.onClick(() => { this.pathStack.pushPath({ name: 'SecondPage' }); }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SubPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right pathStack : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_...
@Component export struct SubPage { @Consume pathStack: NavPathStack; @State message: string = 'HAR SubPage'; build() { Row() { Text(this.message) .fontSize(32) .fontWeight(FontWeight.Bold) }.onClick(() => { this.pathStack.pushPath({ name: 'SecondPage' }); }) } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/library/src/main/ets/components/mainpage/SubPage.ets#L17-L31
dc9451a10bc0ca7a555f51f3cb5417a26cfc8ab5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/DashboardPage.ets
arkts
buildHeader
构建标题栏
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/DashboardPage.ets#L110-L197
48d71f95c89c014f7b0de0aecd7623da3c7af3be
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Telephony/Contact/entry/src/main/ets/component/UpdateContact.ets
arkts
UpdateContact
Copyright (c) 2022-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,...
@Component export struct UpdateContact { @Link name: string @Link email: string @Link nickName: string @Link phoneNumber: string @Link postalAddress: string build() { Scroll() { Column() { Image($r('app.media.touxiang')) .width(76) .height(74) .margin({ top: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UpdateContact AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct UpdateContact { @Link name: string @Link email: string @Link nickName: string @Link phoneNumber: string @Link postalAddress: string build() { Scroll() { Column() { Image($r('app.media.touxiang')) .width(76) .height(74) .margin({ top: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Telephony/Contact/entry/src/main/ets/component/UpdateContact.ets#L16-L94
a192487b28399855b0356797cd49104859e90717
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/view/BottomPanelSlide.ets
arkts
aboutToAppear
手指按下屏幕起始纵坐标
aboutToAppear(): void { // 构造视频列表数据 for (let index = 0; index < Constants.VIDEO_LIST_LENGTH; index++) { let temp: PanelDataType = new PanelDataType(`收藏夹名称${index + 1}`, `${index + 1}个内容`) this.panelList.pushData(temp); } // 构造panel数据 for (let index = 0; index < Constants.PANEL_LIST_LENG...
AST#method_declaration#Left aboutToAppear 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#for_statement#Left for ( AST#variable_declaration#Left let A...
aboutToAppear(): void { for (let index = 0; index < Constants.VIDEO_LIST_LENGTH; index++) { let temp: PanelDataType = new PanelDataType(`收藏夹名称${index + 1}`, `${index + 1}个内容`) this.panelList.pushData(temp); } for (let index = 0; index < Constants.PANEL_LIST_LENGTH; index++) { le...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/view/BottomPanelSlide.ets#L46-L58
b04c935b1ed7c903f3c52b720f78abd01f92eb44
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
parseRationalNumber
Used to create a RationalNumber instance with a given numerator and denominator. @param { number } numerator - An integer number @param { number } denominator - An integer number @returns { RationalNumber } @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2...
static parseRationalNumber(numerator: number, denominator: number): RationalNumber;
AST#method_declaration#Left static parseRationalNumber AST#parameter_list#Left ( AST#parameter#Left numerator : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left denominator : AST#type_annotation#Left AST#primary_type#Left num...
static parseRationalNumber(numerator: number, denominator: number): RationalNumber;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L902-L902
2cf19200e7b28836921fedfee262ca1de0c8f7e5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
datePickerDialog
DatePickerDialog,日期选择器弹框
datePickerDialog(index: number) { if (index == 0) { DialogHelper.showDatePickerDialog({ dateType: DateType.YmdHms, onAction: (action: number, dialogId: string, date: Date): void => { if (action == DialogAction.SURE) { let dateStr = DateUtil.getFormatDateStr(date, "yyyy-MM...
AST#method_declaration#Left datePickerDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_stat...
datePickerDialog(index: number) { if (index == 0) { DialogHelper.showDatePickerDialog({ dateType: DateType.YmdHms, onAction: (action: number, dialogId: string, date: Date): void => { if (action == DialogAction.SURE) { let dateStr = DateUtil.getFormatDateStr(date, "yyyy-MM...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L832-L891
d9a9ad9e13f78b597ff4dbe5f1b6c64c340480a4
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/src/main/ets/components/mainpage/MainPage.ets
arkts
MainPage
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...
@Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/src/main/ets/components/mainpage/MainPage.ets#L16-L31
f95277dbf8c311e80ebf6d4d995b213d4560cc6f
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/constants/StorageKeys.ets
arkts
项目通用存储Key
export class StorageKeys { static readonly APP_KEY = "app_key"; static readonly USER_INFO_KEY = "user_info_key"; static readonly USER_LOGIN = "user_login"; static readonly SEARCH_TYPE_HOME = "search_type_home"; static readonly SEARCH_TYPE_WX = "search_type_wx"; }
AST#export_declaration#Left export AST#class_declaration#Left class StorageKeys AST#class_body#Left { AST#property_declaration#Left static readonly APP_KEY = AST#expression#Left "app_key" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly USER_INFO_KEY = AST#expression#L...
export class StorageKeys { static readonly APP_KEY = "app_key"; static readonly USER_INFO_KEY = "user_info_key"; static readonly USER_LOGIN = "user_login"; static readonly SEARCH_TYPE_HOME = "search_type_home"; static readonly SEARCH_TYPE_WX = "search_type_wx"; }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/constants/StorageKeys.ets#L4-L13
8d6085632338d7fbc2196fd6ee5aa4870a1a279b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/market/src/main/ets/view/CouponPage.ets
arkts
构建优惠券页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "优惠券", viewModel: this.vm }) { this.CouponContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "优惠券" AST#expression#Right AST#component_parameter#Right , AST#component_p...
build() { AppNavDestination({ title: "优惠券", viewModel: this.vm }) { this.CouponContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/market/src/main/ets/view/CouponPage.ets#L20-L27
4f76f05157e0b287ac151a6061fdc2027319de4f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
getBoolean
获取指定键的值。 @param key 要查询数据的Key @param callback
static async getBoolean(key: string, defValue?: boolean): Promise<boolean> { let value = await KvUtil.get(key, defValue); return value as boolean; }
AST#method_declaration#Left static async getBoolean AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
static async getBoolean(key: string, defValue?: boolean): Promise<boolean> { let value = await KvUtil.get(key, defValue); return value as boolean; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L104-L107
d8fe790962497cfec7c0b2b291a87b0767e9dfeb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/CustomAnimationTabConfigure.ets
arkts
自定义属性
export class CustomAnimationTabConfigure { // 背景条最大偏移距离(单位: px) public static readonly INDICATOR_MAX_LEFT = 90; // 背景条宽度扩展比例 public static readonly DEFAULT_INDICATOR_EXPAND = 1; // 页签宽度 public static readonly LIST_ITEM_WIDTH = 100; // 背景条高度 public static readonly TABBAR_HEIGHT = 70; // 背景条宽度 public ...
AST#export_declaration#Left export AST#class_declaration#Left class CustomAnimationTabConfigure AST#class_body#Left { // 背景条最大偏移距离(单位: px) AST#property_declaration#Left public static readonly INDICATOR_MAX_LEFT = AST#expression#Left 90 AST#expression#Right ; AST#property_declaration#Right // 背景条宽度扩展比例 AST#property_decl...
export class CustomAnimationTabConfigure { public static readonly INDICATOR_MAX_LEFT = 90; public static readonly DEFAULT_INDICATOR_EXPAND = 1; public static readonly LIST_ITEM_WIDTH = 100; public static readonly TABBAR_HEIGHT = 70; public static readonly INDICATOR_WIDTH = 100; public stat...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/CustomAnimationTabConfigure.ets#L19-L42
7663aacc625b8732483b92689718b165f0038fc8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/base/BaseDialogOptions.ets
arkts
TODO 弹窗工具类,Base参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface BaseDialogOptions { uiContext?: UIContext; //UIContext上下文 backCancel?: boolean; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。true表示关闭弹窗。false表示不关闭弹窗。默认值:true。 onAction?: ActionCallBack | ActionStrCallBack | ActionValueCallBack | ActionDateCallBack; //按钮的CallBack事件。 dialogId?: string; //弹框id...
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseDialogOptions AST#object_type#Left { AST#type_member#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //UIContext上下文 AST#type_member#Left ba...
export interface BaseDialogOptions { uiContext?: UIContext; backCancel?: boolean; onAction?: ActionCallBack | ActionStrCallBack | ActionValueCallBack | ActionDateCallBack; dialogId?: string; alignment?: DialogAlignment; offset?: Offset; maskRect?: Rectangle; maskColor?: ResourceColor; isModal...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/BaseDialogOptions.ets#L24-L52
22ef5266f6b7bdba1c457c3e29eac176f7bc68ad
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsData.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 default class NewsData { public newsId: string; public newsTitle: string | Resource; public newsContent: string | Resource; public newsTime: string | Resource; public newsImage: string | Resource; toString(): string { return this.newsId + ' ' + this.newsTitle + ' ' + this.newsContent + ' ' + thi...
AST#export_declaration#Left export default AST#class_declaration#Left class NewsData AST#class_body#Left { AST#property_declaration#Left public newsId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left p...
export default class NewsData { public newsId: string; public newsTitle: string | Resource; public newsContent: string | Resource; public newsTime: string | Resource; public newsImage: string | Resource; toString(): string { return this.newsId + ' ' + this.newsTitle + ' ' + this.newsContent + ' ' + thi...
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsData.ets#L16-L35
d5f06f40f0780bd556ba879c8b983f62ff7caee4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
getWebScrollEnd
检测web组件是否滚动到边界 isWebAtEnd:true 滚动到Web底部 isWebAtEnd:false 还未滚动到Web底部
getWebScrollEnd() { // 检测web组件是否滚动到边界,isWebAtEnd的值为ture:滚动到Web底部,false还未到底部。 try { this.webviewController.runJavaScriptExt('document.documentElement.scrollTop || document.body.scrollTop', // 获取web组件滚动偏移量 (error, result) => { if (error || !result) { return; } ...
AST#method_declaration#Left getWebScrollEnd AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 检测web组件是否滚动到边界,isWebAtEnd的值为ture:滚动到Web底部,false还未到底部。 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le...
getWebScrollEnd() { try { this.webviewController.runJavaScriptExt('document.documentElement.scrollTop || document.body.scrollTop', (error, result) => { if (error || !result) { return; } let type = result.getType(); if (type === webview.JsMe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L190-L212
fa08f693b1fd3d46fb857c91db73bd983198d625
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets
arkts
sessionFlowFn
Session flow
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { // Create CaptureSession instances this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; ...
AST#method_declaration#Left async sessionFlowFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ca...
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; this.session.beginConfig(); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L307-L322
996ca99185637f363f012f3953e1ec7ee2629ab5
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets
arkts
customSegmentButton
自定义分段按钮
@Builder customSegmentButton() { Stack({ alignContent: Alignment.TopStart }) { Row() { } .width($r('app.string.calendar_switch_full_size')) .height($r('app.integer.calendar_switch_size_thirty_five')) .backgroundColor($r('app.color.calendar_switch_segment_button_row_bgcolor')) ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customSegmentButton AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_...
@Builder customSegmentButton() { Stack({ alignContent: Alignment.TopStart }) { Row() { } .width($r('app.string.calendar_switch_full_size')) .height($r('app.integer.calendar_switch_size_thirty_five')) .backgroundColor($r('app.color.calendar_switch_segment_button_row_bgcolor')) ....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L202-L246
54951746c9e0a38b2f9315d2d0ab5bf1553302ed
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/Index.ets
arkts
getUpdateTimes
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 { getUpdateTimes, getMenuInfo, getHeaderDate, getCityList, addCity, getCityListWeatherData, getHoursData, getWeekWeatherData, getAirIndexData, getLifeData, getSideBg, getBg } from './src/main/ets/mock/RequestData';
AST#export_declaration#Left export { getUpdateTimes , getMenuInfo , getHeaderDate , getCityList , addCity , getCityListWeatherData , getHoursData , getWeekWeatherData , getAirIndexData , getLifeData , getSideBg , getBg } from './src/main/ets/mock/RequestData' ; AST#export_declaration#Right
export { getUpdateTimes, getMenuInfo, getHeaderDate, getCityList, addCity, getCityListWeatherData, getHoursData, getWeekWeatherData, getAirIndexData, getLifeData, getSideBg, getBg } from './src/main/ets/mock/RequestData';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/Index.ets#L16-L29
c5d502bf619a3e290f5785ba27da24906a8ad4f7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/ToolTouchInterface.ets
arkts
悬浮球UI入参
export interface ToolTouchInterface { // 悬浮球是否禁用标志 isDisable: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolTouchInterface AST#object_type#Left { // 悬浮球是否禁用标志 AST#type_member#Left isDisable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#...
export interface ToolTouchInterface { isDisable: boolean; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/ToolTouchInterface.ets#L20-L23
79e96adee98a2796ae14d183b06f564ce613c652
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM3.ets
arkts
TODO SM3工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class SM3 { private static symKey = CryptoUtil.generateSymKeySync('HMAC|SM3'); //对称密钥SymKey /** * SM3摘要,同步 * @param data 待摘要的数据 * @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 * @returns */ static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { ...
AST#export_declaration#Left export AST#class_declaration#Left class SM3 AST#class_body#Left { AST#property_declaration#Left private static symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKeySync AST#mem...
export class SM3 { private static symKey = CryptoUtil.generateSymKeySync('HMAC|SM3'); static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, 'SM3', resultCoding); } static digestSync(data: string, resultCoding: crypto.BhCoding = ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L25-L122
f06bce63c9805a7bc0f8b3e91a5e265cca431dd4
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/promise_callback/promise_callback_004_F.ets
arkts
Introduction 异步-Promise-catch
export function promise_callback_004_F(taint_src : string) { let _t = taint_src; let clean = "clean"; let p = f(clean); p.then((result) => {}).catch((error : string) => { taint.Sink(error); }) }
AST#export_declaration#Left export AST#function_declaration#Left function promise_callback_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function promise_callback_004_F(taint_src : string) { let _t = taint_src; let clean = "clean"; let p = f(clean); p.then((result) => {}).catch((error : string) => { taint.Sink(error); }) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/promise_callback/promise_callback_004_F.ets#L6-L13
82e8fdc2cae1c22dae4d676d6cf444acd5e00115
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleData.ets
arkts
Baseclass for all Line, Bar, Scatter, Candle and Bubble data.
export default abstract class BarLineScatterCandleBubbleData< T extends IBarLineScatterCandleBubbleDataSet</*T extends */ EntryOhos> > extends ChartData<T> { constructor(sets?: JArrayList<T>) { super(sets); } }
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BarLineScatterCandleBubbleData AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IBarLineScatterCandleBubbleDataSet AST#type_arguments#Left < /*T extends *...
export default abstract class BarLineScatterCandleBubbleData< T extends IBarLineScatterCandleBubbleDataSet< EntryOhos> > extends ChartData<T> { constructor(sets?: JArrayList<T>) { super(sets); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleData.ets#L25-L31
e38020787fdf87787209653f25961aab820d08d3
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
disconnect
断开连接
async disconnect(): Promise<boolean> { // 清除重连定时器 if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); this.reconnectTimer = -1; } if (!this.mqttAsyncClient || !this.isConnected) { console.info('MQTT客户端未连接,无需断开'); this.isConnected = false; return true; ...
AST#method_declaration#Left async disconnect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async disconnect(): Promise<boolean> { if (this.reconnectTimer !== -1) { clearTimeout(this.reconnectTimer); this.reconnectTimer = -1; } if (!this.mqttAsyncClient || !this.isConnected) { console.info('MQTT客户端未连接,无需断开'); this.isConnected = false; return true; } ...
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L258-L272
7c27eee446581cb1af1bdd50e5f7bb1280c4907c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets
arkts
orders
自定义构建函数。此处样式为在Row组件中横向排列订单相关的标签:待支付,待收货,待评价,更多
@Builder orders() { Row() { // 性能知识点:此处在Row中横向排列组件,列表项确定、数量较少,且需要一次性加载,因此使用ForEach。在列表项多的情况下,推荐使用LazyForEach ForEach(this.ordersInfo, (item: IconAndDescription) => { Column() { this.iconAndDescription(item.icon, item.description, undefined, 0, () => { }) } ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right orders AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 性能知识点:此处在Row中横向排列组件,列表...
@Builder orders() { Row() { ForEach(this.ordersInfo, (item: IconAndDescription) => { Column() { this.iconAndDescription(item.icon, item.description, undefined, 0, () => { }) } .width($r("app.string.slidetohideanddisplace_width_of_elements_in_orders")) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets#L124-L138
cb32e2ab5f993d8aae35480de692fc3124c0cb5e
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/JumpSearch.ets
arkts
跳跃查找算法实现 该算法适用于已排序的数组,通过跳跃固定步长来减少比较次数
export class JumpSearch { /** * 标准跳跃查找 * @param arr 已排序的数组 * @param target 目标值 * @returns 目标值在数组中的索引,如果不存在则返回-1 */ public static search(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } const n = arr.length; let step = Math.floor(Math.sqrt(n)...
AST#export_declaration#Left export AST#class_declaration#Left class JumpSearch AST#class_body#Left { /** * 标准跳跃查找 * @param arr 已排序的数组 * @param target 目标值 * @returns 目标值在数组中的索引,如果不存在则返回-1 */ AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annota...
export class JumpSearch { public static search(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } const n = arr.length; let step = Math.floor(Math.sqrt(n)); let prev = 0; while (arr[Math.min(step, n) - 1] < target) { prev = step; s...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/JumpSearch.ets#L5-L161
2277b4f4dd795cc92c37b8c7e71ebe0ec100a1ae
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/CommentComponent.ets
arkts
useReply
@author: wuwenqiang @description: 点击弹出评论框 @date: 2024-05-26 14:26
useReply(item: CommentInterface, index: number) { if (this.commentListStr) { this.openInputDialog(); } this.focusableInput = true; this.replyIndex = index; if (item.topId) { this.replyComment = item; // 二级评论,即回复的内容 this.firstComment = this.commentList.find(aItem => aItem.id === ite...
AST#method_declaration#Left useReply AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommentInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
useReply(item: CommentInterface, index: number) { if (this.commentListStr) { this.openInputDialog(); } this.focusableInput = true; this.replyIndex = index; if (item.topId) { this.replyComment = item; this.firstComment = this.commentList.find(aItem => aItem.id === item.topId) }...
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/CommentComponent.ets#L149-L161
3f2c5990b87ef6e7882f0d8a8e17b2c96aa3a0b7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets
arkts
hideHalfModule
隐藏半模态页面
hideHalfModule() { this.isShow = false; animateTo({ curve: Curve.Friction, duration: DURATION }, () => { this.translateY = 0; }) }
AST#method_declaration#Left hideHalfModule 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 . isShow AST#member_expr...
hideHalfModule() { this.isShow = false; animateTo({ curve: Curve.Friction, duration: DURATION }, () => { this.translateY = 0; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets#L94-L99
6d072e7deffd4fbd22e3b43a88e7c4285ab9e55e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template8/Index.ets
arkts
PageOneBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function PageOneBuilder(name: string, param: Object) { PageOneComponent(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PageOneBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ...
@Builder export function PageOneBuilder(name: string, param: Object) { PageOneComponent(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template8/Index.ets#L15-L18
469fdf02fa26a0bedde9e1487749331b2488bd1e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/entryability/EntryAbility.ets
arkts
Lift cycle management of Ability.
export default class EntryAbility extends UIAbility { onCreate(want: Want, param: AbilityConstant.LaunchParam): void { GlobalContext.getContext().setObject('abilityWant', want); GlobalContext.getContext().setObject('abilityParam', param); DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object |...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty...
export default class EntryAbility extends UIAbility { onCreate(want: Want, param: AbilityConstant.LaunchParam): void { GlobalContext.getContext().setObject('abilityWant', want); GlobalContext.getContext().setObject('abilityParam', param); DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object |...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/entryability/EntryAbility.ets#L29-L50
258264c2b06f99a2580319175d0bc487d6faae88
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
getGeoAddressFromLocation
逆地理编码,将坐标转换为地理描述集合(无需申请定位权限) @param latitude 纬度 @param longitude 经度 @returns 逆编码后集合
static async getGeoAddressFromLocation(latitude: number, longitude: number, maxItems: number = 1): Promise<Array<geoLocationManager.GeoAddress>> { const reverseGeocodeRequest: geoLocationManager.ReverseGeoCodeRequest = { latitude: latitude, longitude: longitude, maxItems: maxItems, local...
AST#method_declaration#Left static async getGeoAddressFromLocation AST#parameter_list#Left ( AST#parameter#Left latitude : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left longitude : AST#type_annotation#Left AST#primary_type...
static async getGeoAddressFromLocation(latitude: number, longitude: number, maxItems: number = 1): Promise<Array<geoLocationManager.GeoAddress>> { const reverseGeocodeRequest: geoLocationManager.ReverseGeoCodeRequest = { latitude: latitude, longitude: longitude, maxItems: maxItems, local...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L242-L256
4186ce7f77077025c2424ea999d84c8701c902ef
gitee
Glace-Dev/Harmony_Projects.git
845cef3c5fdf5d049c942fe62cbf083c2c78e84a
basis/entry/src/main/ets/views/ShopItem.ets
arkts
ellipsisTextOverFlow
文本超出时的统一样式处理
@Extend(Text) function ellipsisTextOverFlow(line: number = 1){ .textOverflow({overflow: TextOverflow.Ellipsis}) .maxLines(line) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function ellipsisTextOverFlow AST#parameter_list#Left ( AST#parameter#Left line : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Rig...
@Extend(Text) function ellipsisTextOverFlow(line: number = 1){ .textOverflow({overflow: TextOverflow.Ellipsis}) .maxLines(line) }
https://github.com/Glace-Dev/Harmony_Projects.git/blob/845cef3c5fdf5d049c942fe62cbf083c2c78e84a/basis/entry/src/main/ets/views/ShopItem.ets#L54-L58
949e2e04dfbf188dfabdd2fd4012491658f498cc
github
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/globals/event.ets
arkts
queryUserMessages
UserMessage
public async queryUserMessages() { logger.info('AppEvent.queryUserMessages is called') const newMessages = await UserDatabaser.queryUserMessages() await store.storeMessages(newMessages) return newMessages }
AST#method_declaration#Left public async queryUserMessages AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expressio...
public async queryUserMessages() { logger.info('AppEvent.queryUserMessages is called') const newMessages = await UserDatabaser.queryUserMessages() await store.storeMessages(newMessages) return newMessages }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L104-L109
9963028142b29d448a289787f377f4aae264a002
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/dowhile_body_001_T.ets
arkts
Introduction 循环结构-dowhile
export function dowhile_body_001_T(taint_src : string) { let t = "" let i = 2; do { t = t + taint_src i--; }
AST#export_declaration#Left export AST#function_declaration#Left function dowhile_body_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function dowhile_body_001_T(taint_src : string) { let t = "" let i = 2; do { t = t + taint_src i--; }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/dowhile_body_001_T.ets#L6-L12
cc2a289676001c2c689fef7f6cd6815c5f5bec79
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/KvUtil.ets
arkts
构造函数 @param ctx
constructor(ctx: common.Context) { this.init(ctx); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state...
constructor(ctx: common.Context) { this.init(ctx); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L41-L43
a31e3e42d972963d39f1fc0389acde127c56bd8d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/SecondFloorLoadAnimation.ets
arkts
SecondFloorLoadAnimationComponent
使用进入二楼隐藏界面组件样例 核心组件: 1. SecondFloor 实现步骤: 1. 将一楼页面二楼页面固定在相应位置,实时监听二楼Y轴大小用以达到页面可以正常移动 2. 实时监听二楼Y轴大小,用二楼高度减去Y轴的绝对值计算出移动距离,用该距离来充当蒙层高度 3. 用移动距离除以动效展示或消失高度获得相应的百分比,该百分比可用来展示动效缩放,用百分比乘以动效之间的距离,可以达到在X轴上移动效果
@Component export struct SecondFloorLoadAnimationComponent { aboutToAppear() { if (!windowStage) { return; } // 当前主窗口开启沉浸模式 windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { return; } try { let promise = windowClass.setWindowLayout...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SecondFloorLoadAnimationComponent AST#component_body#Left { AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement...
@Component export struct SecondFloorLoadAnimationComponent { aboutToAppear() { if (!windowStage) { return; } windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { return; } try { let promise = windowClass.setWindowLayoutFullScreen(tru...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/SecondFloorLoadAnimation.ets#L48-L87
278fee591b69b158fbd6373f6a4e1d995f74d82a
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
梦想统计数据
export interface DreamStats { userId: number; totalDreams: number; inProgressDreams: number; completedDreams: number; abandonedDreams: number; dreamCompletionRate: number; totalTasks: number; completedTasks: number; taskCompletionRate: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DreamStats AST#object_type#Left { AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalDreams : AST#type_annotatio...
export interface DreamStats { userId: number; totalDreams: number; inProgressDreams: number; completedDreams: number; abandonedDreams: number; dreamCompletionRate: number; totalTasks: number; completedTasks: number; taskCompletionRate: number; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L228-L238
7c2a3881969d101393035c5440fd50c5d70cc0cf
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets
arkts
getOrientation
获取屏幕方向
public getOrientation() { let displayClass: display.Display | null = this.getDisplay(); if (displayClass !== null) { this.deviceStatus.orientation = displayClass.orientation; if (this.deviceStatus.orientation === display.Orientation.LANDSCAPE || this.deviceStatus.orientation === display.Orie...
AST#method_declaration#Left public getOrientation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left displayClass : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left di...
public getOrientation() { let displayClass: display.Display | null = this.getDisplay(); if (displayClass !== null) { this.deviceStatus.orientation = displayClass.orientation; if (this.deviceStatus.orientation === display.Orientation.LANDSCAPE || this.deviceStatus.orientation === display.Orie...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L123-L135
e49d6245414754dc83bf2da85a937104aff00b50
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
createLunarDate
创建农历日期对象
private static createLunarDate(year: number, month: number, day: number, isLeapMonth: boolean): LunarDate { const monthName = isLeapMonth ? `闰${LunarCalendar.monthNames[month]}` : LunarCalendar.monthNames[month]; const dayName = LunarCalendar.dayNames[day]; const zodiac = LunarCalendar.zodiacNames[(year - 4...
AST#method_declaration#Left private static createLunarDate 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...
private static createLunarDate(year: number, month: number, day: number, isLeapMonth: boolean): LunarDate { const monthName = isLeapMonth ? `闰${LunarCalendar.monthNames[month]}` : LunarCalendar.monthNames[month]; const dayName = LunarCalendar.dayNames[day]; const zodiac = LunarCalendar.zodiacNames[(year - 4...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L304-L324
de11ea148c8232efd61bfcf39b24b84494af52ef
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/LoginPage.ets
arkts
doResetPassword
执行重置密码
async doResetPassword() { if (this.isLoading) return; if (!this.account || !this.newPassword) { promptAction.showToast({ message: '请输入用户名和新密码', duration: 2000 }); return; } this.isLoading = true; try { Logger.info(`正在重置密码: ${this.account}`); let ...
AST#method_declaration#Left async doResetPassword 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 this AST#expression#Right . isLoading AST#member_expression#Right AST#express...
async doResetPassword() { if (this.isLoading) return; if (!this.account || !this.newPassword) { promptAction.showToast({ message: '请输入用户名和新密码', duration: 2000 }); return; } this.isLoading = true; try { Logger.info(`正在重置密码: ${this.account}`); let ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/LoginPage.ets#L200-L244
a0d4356396b842df1875ce623b923c51b7a43b07
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets
arkts
head_onclick
读过点击事件
head_onclick(value:number){ console.log("点击了"+value) if(value==3){ //勋章 }else{ router.pushUrl({ url:"pages/view/myCenter/readStatistics", params:{ value:value } }) } }
AST#method_declaration#Left head_onclick AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio...
head_onclick(value:number){ console.log("点击了"+value) if(value==3){ }else{ router.pushUrl({ url:"pages/view/myCenter/readStatistics", params:{ value:value } }) } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets#L170-L182
e4d62094ee7e3c0dce9df27e9dcc32c915cfffbf
github
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
common/base/src/main/ets/constants/BaseConstants.ets
arkts
Current page home,chat or socialCircle
export enum CurrentPage { LOGIN = -1, HOME = 0, CHAT = 1, SOCIAL_CIRCLE = 2, ME = 3 }
AST#export_declaration#Left export AST#enum_declaration#Left enum CurrentPage AST#enum_body#Left { AST#enum_member#Left LOGIN = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#enum_member#Right , AST#enum_member#Left HOME = A...
export enum CurrentPage { LOGIN = -1, HOME = 0, CHAT = 1, SOCIAL_CIRCLE = 2, ME = 3 }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/common/base/src/main/ets/constants/BaseConstants.ets#L142-L148
c9649d950b1592228e8cb5685616b33a2d164707
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
unRegisterListener
注销AVSession实例事件 @returns {void}
unRegisterListener(): void { this.session?.off('play'); this.session?.off('pause'); this.session?.off('stop'); this.session?.off('playNext'); this.session?.off('playPrevious'); this.session?.off('fastForward'); this.session?.off('rewind'); this.session?.off('seek'); this.session?.off...
AST#method_declaration#Left unRegisterListener AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expre...
unRegisterListener(): void { this.session?.off('play'); this.session?.off('pause'); this.session?.off('stop'); this.session?.off('playNext'); this.session?.off('playPrevious'); this.session?.off('fastForward'); this.session?.off('rewind'); this.session?.off('seek'); this.session?.off...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L168-L179
d58834d0947d61681cbdfee9966a936b241a191e
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/popup/AdvancedPopup.ets
arkts
PopupBuilder_Options_Msg_Title
入参属性title和message
@Builder PopupBuilder_Options_Msg_Title() { Popup({ title: this.popupOptionsList[this.index[0]].title as PopupTextOptions, message: this.popupOptionsList[this.index[0]].message as PopupTextOptions, showClose: this.popupOptionsList[this.index[0]].showClose, onClose: this.popupOptionsList[t...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right PopupBuilder_Options_Msg_Title 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 Popup ( AST#component_parameters#Left { AST...
@Builder PopupBuilder_Options_Msg_Title() { Popup({ title: this.popupOptionsList[this.index[0]].title as PopupTextOptions, message: this.popupOptionsList[this.index[0]].message as PopupTextOptions, showClose: this.popupOptionsList[this.index[0]].showClose, onClose: this.popupOptionsList[t...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/popup/AdvancedPopup.ets#L349-L365
553ac6d542f693363d06a5ce4e5df13681215b50
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
MainContent
构建底部导航栏标签
@Builder TabBuilder(index: number, normalIcon: Resource, selectedIcon: Resource, text: Resource) { Column() { Image(this.currentIndex === index ? selectedIcon : normalIcon) .width(StyleConstants.INDEX_TAB_ICON_SIZE) .height(StyleConstants.INDEX_TAB_ICON_SIZE) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left TabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left normalIcon : AST#typ...
@Builder TabBuilder(index: number, normalIcon: Resource, selectedIcon: Resource, text: Resource) { Column() { Image(this.currentIndex === index ? selectedIcon : normalIcon) .width(StyleConstants.INDEX_TAB_ICON_SIZE) .height(StyleConstants.INDEX_TAB_ICON_SIZE) ...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L353-L432
0e23e9a54e72ec5831d988618244b1b7baf38a4a
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PickerUtils.ets
arkts
selectPhoto
通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。 @param options @returns
static async selectPhoto(options?: PhotoSelectOptions): Promise<Array<string>> { try { if (!options) { options = new PhotoSelectOptions(); } if (!options.MIMEType) { //可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。 options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; } if...
AST#method_declaration#Left static async selectPhoto AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left PhotoSelectOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left...
static async selectPhoto(options?: PhotoSelectOptions): Promise<Array<string>> { try { if (!options) { options = new PhotoSelectOptions(); } if (!options.MIMEType) { options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; } if (!options.maxSelectNumber) { ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L58-L100
366113c567ad881500422ba9bf778978b6368a51
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
stop
停止动画 @since 8 @design
stop() { this.animationItem?.stop() }
AST#method_declaration#Left stop AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#exp...
stop() { this.animationItem?.stop() }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L159-L161
582b10424c39e24983ef42633d1a2d7339b8a189
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
parseStreamResponse
解析流式响应
private async parseStreamResponse(responseBody: string, provider: string): Promise<string> { try { let fullResponse = ''; const lines = responseBody.split('\n'); if (provider === 'anthropic') { // Anthropic流式格式:event: message_delta\ndata: {"delta":{"type":"text_delta","text":"内容"}} ...
AST#method_declaration#Left private async parseStreamResponse AST#parameter_list#Left ( AST#parameter#Left responseBody : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left provider : AST#type_annotation#Left AST#primary_type#L...
private async parseStreamResponse(responseBody: string, provider: string): Promise<string> { try { let fullResponse = ''; const lines = responseBody.split('\n'); if (provider === 'anthropic') { for (const line of lines) { if (line.startsWith('data: ')) { con...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L589-L649
03f07582d96e4e46c283c6ea6cd46ca3666e16bb
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
getEfficiencyLabel
获取效率标签
static getEfficiencyLabel(task: TaskItem): string { if (!task.actualTime) return '未知'; const ratio = task.estimatedTime / task.actualTime; if (ratio >= 0.9 && ratio <= 1.1) return '准时'; if (ratio < 0.9) return '延时'; return '提前'; }
AST#method_declaration#Left static getEfficiencyLabel AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem 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#pr...
static getEfficiencyLabel(task: TaskItem): string { if (!task.actualTime) return '未知'; const ratio = task.estimatedTime / task.actualTime; if (ratio >= 0.9 && ratio <= 1.1) return '准时'; if (ratio < 0.9) return '延时'; return '提前'; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L142-L148
ad2d04a53941348d61cd06cd67aa938fc4455cb7
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.mediaquery.d.ets
arkts
Defines the Listener of mediaquery. @interface MediaQueryListener @extends MediaQueryResult @syscap SystemCapability.ArkUI.ArkUI.Full @since 7 Defines the Listener of mediaquery. @interface MediaQueryListener @extends MediaQueryResult @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 10 Defines the ...
export interface MediaQueryListener extends MediaQueryResult { /** * Registers a callback with the corresponding query condition by using the handle. * This callback is triggered when the media attributes change. * * @param { 'change' } type * @param { Callback<MediaQueryResult> } callback ...
AST#export_declaration#Left export AST#interface_declaration#Left interface MediaQueryListener AST#extends_clause#Left extends MediaQueryResult AST#extends_clause#Right AST#object_type#Left { /** * Registers a callback with the corresponding query condition by using the handle. * This callback is triggered wh...
export interface MediaQueryListener extends MediaQueryResult { on(type: 'change', callback: Callback<MediaQueryResult>): void; off(type: 'change', callback?: Callback<MediaQueryResult>): void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.mediaquery.d.ets#L213-L301
1edb3e61d28491615d1ce019422edf27076264ff
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
backupData
备份数据
private backupData(): void { this.showBackupProgress = true; setTimeout(() => { this.showBackupProgress = false; promptAction.showToast({ message: '数据备份完成', duration: 2000 }); }, 2000); }
AST#method_declaration#Left private backupData 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...
private backupData(): void { this.showBackupProgress = true; setTimeout(() => { this.showBackupProgress = false; promptAction.showToast({ message: '数据备份完成', duration: 2000 }); }, 2000); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6175-L6184
726cf0697ee9ec2e8bd5c6939cf5f0623c7f8ff9
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getAbiList
应用二进制接口(Abi)。示例:arm64-v8a
static getAbiList(): string { return deviceInfo.abiList; }
AST#method_declaration#Left static getAbiList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
static getAbiList(): string { return deviceInfo.abiList; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L230-L232
5f73d00b263032088edec1f39be906512fae1522
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
onChange
订阅数据变更,订阅的Key的值发生变更后,在执行flush方法后,触发callback回调。 @param callback 回调函数 @param preferenceName 实例的名称。
static onChange(callback: Callback<string>, preferenceName: string = PreferencesUtil.defaultPreferenceName) { let preferences = PreferencesUtil.getPreferencesSync(preferenceName); //获取实例 preferences.on('change', callback); }
AST#method_declaration#Left static onChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
static onChange(callback: Callback<string>, preferenceName: string = PreferencesUtil.defaultPreferenceName) { let preferences = PreferencesUtil.getPreferencesSync(preferenceName); preferences.on('change', callback); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L273-L276
25091675a6fa84b785feb420fc0a7aa77cc8965f
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets
arkts
Default constructor.
constructor(label?: string) { this.mColors = new JArrayList<Number>(); this.mValueColors = new JArrayList<Number>(); // default color this.mColors.add(0x8ceaff); this.mValueColors.add(0x000000); this.mLabel = label; }
AST#constructor_declaration#Left constructor 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#block_statement#Left { AST#statement#Left AST#expression_statement...
constructor(label?: string) { this.mColors = new JArrayList<Number>(); this.mValueColors = new JArrayList<Number>(); this.mColors.add(0x8ceaff); this.mValueColors.add(0x000000); this.mLabel = label; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L101-L108
89f34532f34ac68c0ae1ddd601c2cde5c38163b7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福场合枚举
export enum GreetingOccasion { BIRTHDAY = 'birthday', // 生日 ANNIVERSARY = 'anniversary', // 纪念日 NEW_YEAR = 'new_year', // 新年 SPRING_FESTIVAL = 'spring_festival', // 春节 VALENTINE = 'valentine', // 情人节 MOTHER_DAY = 'mother_day', // 母亲节 FATHER_DAY = 'father_day', //...
AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingOccasion AST#enum_body#Left { AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , // 生日 AST#enum_member#Left ANNIVERSARY = AST#expression#Left 'anniversary' AST#expression#Right AST#enum_mem...
export enum GreetingOccasion { BIRTHDAY = 'birthday', ANNIVERSARY = 'anniversary', NEW_YEAR = 'new_year', SPRING_FESTIVAL = 'spring_festival', VALENTINE = 'valentine', MOTHER_DAY = 'mother_day', FATHER_DAY = 'father_day', CHRISTMAS = 'christmas', ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L65-L77
585a49ad61e6cea920449cd801a2d30a1b8b258a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DisplayUtil.ets
arkts
getPrimaryDisplaySync
获取主屏信息。除2in1之外的设备获取的是设备自带屏幕的Display对象;2in1设备外接屏幕时获取的是当前主屏幕的Display对象;2in1设备没有外接屏幕时获取的是自带屏幕的Display对象。<API14+> @returns
static getPrimaryDisplaySync(): display.Display { if (AppUtil.isApiSupported(14)) { return display.getPrimaryDisplaySync() } else { return display.getDefaultDisplaySync() } }
AST#method_declaration#Left static getPrimaryDisplaySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left...
static getPrimaryDisplaySync(): display.Display { if (AppUtil.isApiSupported(14)) { return display.getPrimaryDisplaySync() } else { return display.getDefaultDisplaySync() } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L41-L47
cd59a6a0fbded1d21cbe873a85f54d1afaa05f0b
gitee