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
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_lite.ets
arkts
add_index_string
Pushes a timestamp to the end of values of str (keys). @param str the keys. @param timestamp the timestamp.
static add_index_string(str: string, timestamp: number) { const target_year: number = new Date(timestamp).getUTCFullYear(); const target_month: number = new Date(timestamp).getUTCMonth() + 1; if (index_file_name_of_month(target_year, target_month) != bunch_of_history_index_lite.this_file_name()) { // ...
AST#method_declaration#Left static add_index_string 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 timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#pri...
static add_index_string(str: string, timestamp: number) { const target_year: number = new Date(timestamp).getUTCFullYear(); const target_month: number = new Date(timestamp).getUTCMonth() + 1; if (index_file_name_of_month(target_year, target_month) != bunch_of_history_index_lite.this_file_name()) { ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L102-L132
552a0f9a4cc665b7adab92c832129d6ae0b353a2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets
arkts
RaisedSelectImageInfo
凸起中选中时 图片Y轴偏移量
@Observed export class RaisedSelectImageInfo extends CircleClass { // Y轴偏移量 @Track offsetY: number = 0; constructor(context: componentUtils.ComponentInfo) { super({ width: px2vp(context.size.width), height: px2vp(context.size.height), menuLength: 0 }); this.offsetY = px2vp(context...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class RaisedSelectImageInfo extends AST#type_annotation#Left AST#primary_type#Left CircleClass AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // Y轴偏移量 AST#property_declaration#Left AST#decorator#Left @...
@Observed export class RaisedSelectImageInfo extends CircleClass { @Track offsetY: number = 0; constructor(context: componentUtils.ComponentInfo) { super({ width: px2vp(context.size.width), height: px2vp(context.size.height), menuLength: 0 }); this.offsetY = px2vp(context.localOf...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L211-L235
4ea072ee6b3d41f16032982fe3977d0d36198982
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
getGridItems
Get grid item info. @return {Array<GridItemData>} gridData
private getGridItems() { let gridData: Array<GridItemData> = []; for (let i = 0; i < CommonConstants.GRID_ITEM_SIZE; i++) { let gridItemData = new GridItemData(); gridItemData.content = $r('app.string.grid_item_text'); gridData.push(gridItemData); } return gridData; }
AST#method_declaration#Left private getGridItems AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gridData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left...
private getGridItems() { let gridData: Array<GridItemData> = []; for (let i = 0; i < CommonConstants.GRID_ITEM_SIZE; i++) { let gridItemData = new GridItemData(); gridItemData.content = $r('app.string.grid_item_text'); gridData.push(gridItemData); } return gridData; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets#L65-L73
4c5cb2404c5d7ee12a34307639a9ab8d734b936e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets
arkts
colorTransform
[End WorkerPort]
function colorTransform(rgbValue: number): number { return Number((rgbValue / 255).toFixed(2)); }
AST#function_declaration#Left function colorTransform AST#parameter_list#Left ( AST#parameter#Left rgbValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#...
function colorTransform(rgbValue: number): number { return Number((rgbValue / 255).toFixed(2)); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets#L42-L44
abdc891110f605ecd871e097173dac07deaae459
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/mine/StatsBar.ets
arkts
StatItem
构建单个统计项
@Builder StatItem(count: number, label: string, onClick: () => void) { Column() { Text(count.toString()) .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor('#333333') .margin({ bottom: 4 }) Text(label) .fontSize(12) .fontColor('#999999') } .l...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatItem AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left label : AST#type_annotation#Left AST#...
@Builder StatItem(count: number, label: string, onClick: () => void) { Column() { Text(count.toString()) .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor('#333333') .margin({ bottom: 4 }) Text(label) .fontSize(12) .fontColor('#999999') } .l...
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/StatsBar.ets#L63-L80
9909060ef0de5e22ee0a2cd3ce4b0d764e757e09
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
getDialogAction
获取DialogAction
private static getDialogAction(action: number) { if (action == 0) { return DialogAction.ONE; } else if (action == 1) { return DialogAction.TWO; } else if (action == 2) { return DialogAction.THREE; } else if (action == 3) { return DialogAction.FOUR; } else if (action == 4) { ...
AST#method_declaration#Left private static getDialogAction AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_stat...
private static getDialogAction(action: number) { if (action == 0) { return DialogAction.ONE; } else if (action == 1) { return DialogAction.TWO; } else if (action == 2) { return DialogAction.THREE; } else if (action == 3) { return DialogAction.FOUR; } else if (action == 4) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L466-L480
970683f45a66b6580a267874793cf0e1bd48fedf
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerComponent.ets
arkts
getTimeDigits
获取时分秒的各个数字 获取时分秒的各个数字,返回明确接口类型
getTimeDigits(seconds: number) { // 处理超过59分59秒的情况 const mins = Math.floor(seconds / 60) % 60; const secs = seconds % 60; this.minTens = Math.floor(mins / 10); this.minUnits = mins % 10; this.secTens = Math.floor(secs / 10); this.secUnits = secs % 10; }
AST#method_declaration#Left getTimeDigits AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 处理超过59分59秒的情况 AST#statement#Left AST#variab...
getTimeDigits(seconds: number) { const mins = Math.floor(seconds / 60) % 60; const secs = seconds % 60; this.minTens = Math.floor(mins / 10); this.minUnits = mins % 10; this.secTens = Math.floor(secs / 10); this.secUnits = secs % 10; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L81-L89
08bdeb6965bd31bcde2554e887b3b8907ebd5ebd
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordInput.ets
arkts
getRouterParam
Get the params from router
getRouterParam() { let param = Router.getParams() if (!param) { return; } this.pageRequestCode = param.pageRequestCode as number; this.prevPageUri = param.prevPageUri as string; this.pinChallenge = param.pinChallenge as string; this.pinToken = param.pinToken as string; this.passwor...
AST#method_declaration#Left getRouterParam AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left param = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#...
getRouterParam() { let param = Router.getParams() if (!param) { return; } this.pageRequestCode = param.pageRequestCode as number; this.prevPageUri = param.prevPageUri as string; this.pinChallenge = param.pinChallenge as string; this.pinToken = param.pinToken as string; this.passwor...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordInput.ets#L104-L114
24fbf790289e38639d24a0a11b86f06e2dbe5fdd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
loadStatisticsData
加载统计数据
async loadStatisticsData() { try { this.isLoading = true; this.statisticsData = await this.analyticsService.getStatisticsData(); } catch (error) { console.error('Failed to load statistics data:', error); } finally { this.isLoading = false; } }
AST#method_declaration#Left async loadStatisticsData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_exp...
async loadStatisticsData() { try { this.isLoading = true; this.statisticsData = await this.analyticsService.getStatisticsData(); } catch (error) { console.error('Failed to load statistics data:', error); } finally { this.isLoading = false; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L27-L36
2ea28996115def741288187e31af2d203db25080
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
getNumber
获取指定键的值。 @param key 要查询数据的Key @param callback
static async getNumber(key: string, defValue: number = 0): Promise<number> { let value = await KvUtil.get(key, defValue); 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): Promise<number> { let value = await KvUtil.get(key, defValue); return value as number; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L94-L97
b73f90bef92c6d681f50a3d2ce9396ce9df1c6a7
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/CombinedChartRenderer.ets
arkts
drawValues
@Override
public drawValues(c: CanvasRenderingContext2D): void { for (let index = 0; index < this.mRenderers.length(); index++) { this.mRenderers.get(index).drawValues(c); } }
AST#method_declaration#Left public drawValues AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST...
public drawValues(c: CanvasRenderingContext2D): void { for (let index = 0; index < this.mRenderers.length(); index++) { this.mRenderers.get(index).drawValues(c); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/CombinedChartRenderer.ets#L107-L111
321456d59f1a145dfcff8b46f6dfa0799a1a3778
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiDelete.ets
arkts
handle
应用约束1:为方法参数添加明确类型(假设Emoji类型已定义)
handle(emoji: Emoji): { emoji: Emoji } { // 应用约束9:使用const代替var const client = this.client; client.dataManager.killEmoji(emoji); // 应用约束2:通过类属性修改代替动态属性添加 emoji.deleted = true; return { emoji }; }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left emoji : AST#type_annotation#Left AST#primary_type#Left Emoji AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#...
handle(emoji: Emoji): { emoji: Emoji } { const client = this.client; client.dataManager.killEmoji(emoji); emoji.deleted = true; return { emoji }; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiDelete.ets#L6-L13
793d8348c33dafbe1904f5f0b3f1d9674a00317a
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
popWithResult
@deprecated @see {ZRouter.getInstance().popWithResult} @param result @param animated
public static popWithResult(result?: Object, animated: boolean = true) { ZRouter.getRouterMgr().popWithResult(result, animated) }
AST#method_declaration#Left public static popWithResult AST#parameter_list#Left ( AST#parameter#Left result ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated : AST#type_annotation#Left AST#primary_type#Left boolea...
public static popWithResult(result?: Object, animated: boolean = true) { ZRouter.getRouterMgr().popWithResult(result, animated) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L457-L459
322535bbb289d6d606409371e2f5a1a8645e545d
gitee
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/utils/StorageUtil.ets
arkts
addFavoriteCity
添加收藏城市
static async addFavoriteCity(cityName: string): Promise<boolean> { try { const favorites = await StorageUtil.getFavoriteCities(); if (!favorites.includes(cityName)) { favorites.push(cityName); const initSuccess = await StorageUtil.init(); if (!initSuccess || !StorageUtil.prefs) ...
AST#method_declaration#Left static async addFavoriteCity AST#parameter_list#Left ( AST#parameter#Left cityName : 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#gene...
static async addFavoriteCity(cityName: string): Promise<boolean> { try { const favorites = await StorageUtil.getFavoriteCities(); if (!favorites.includes(cityName)) { favorites.push(cityName); const initSuccess = await StorageUtil.init(); if (!initSuccess || !StorageUtil.prefs) ...
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L104-L123
b354a1f6f2903acb83178412668726d24937b66f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
transitionFromLeft
左侧弹出动画 @param duration 动画时间 @returns
static transitionFromLeft(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.START).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay...
AST#method_declaration#Left static transitionFromLeft AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an...
static transitionFromLeft(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.START).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L50-L57
f84611e978128c581a75e92cf9a577a87bb92d5d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/ContactService.ets
arkts
getContactById
根据ID获取联系人
async getContactById(id: string): Promise<Contact | null> { try { // 先尝试从数据库获取 const dbContact = await this.databaseService.getContactById(Number(id)); if (dbContact) { return await this.convertDbContactToContact(dbContact); } // 如果数据库中没有,从内存缓存查找 const contact = this.con...
AST#method_declaration#Left async getContactById 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 ...
async getContactById(id: string): Promise<Contact | null> { try { const dbContact = await this.databaseService.getContactById(Number(id)); if (dbContact) { return await this.convertDbContactToContact(dbContact); } const contact = this.contacts.find(contact => contact.i...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L174-L192
1076349d76a7a5a31169d84effe88f1d71e3b9ba
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets
arkts
contains
Returns true if (x,y) is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a x,y to be contained: left <= x < right and top <= y < bottom. An empty rectangle never contains any point. @param x The X coordinate of the point being tested for conta...
public contains(x: number, y: number): boolean { return ( this.left < this.right && this.top < this.bottom && // check for empty first x >= this.left && x < this.right && y >= this.top && y < this.bottom ); }
AST#method_declaration#Left public contains AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS...
public contains(x: number, y: number): boolean { return ( this.left < this.right && this.top < this.bottom && x >= this.left && x < this.right && y >= this.top && y < this.bottom ); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets#L220-L229
695b3f2595d62954ad84a73a7683b9095a30bc40
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.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 interface Month { month: string; // 具体年月 num: number; // 月份 days: number[]; // 该月日期 }
AST#export_declaration#Left export AST#interface_declaration#Left interface Month AST#object_type#Left { AST#type_member#Left month : 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 num : AST#type_annotation#Left...
export interface Month { month: string; num: number; days: number[]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L16-L20
28afd6e96fca768851945980da640712216c22de
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_extensions.ets
arkts
get_extension
Returns the extension object of a specific ID. @param id The id. @returns The extension object if found, undefined otherwise.
get_extension(id: string) { for (let index = 0; index < this.extensions.length; index++) { if (this.extensions[index].id == id) { return this.extensions[index]; } } return undefined; }
AST#method_declaration#Left get_extension AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST...
get_extension(id: string) { for (let index = 0; index < this.extensions.length; index++) { if (this.extensions[index].id == id) { return this.extensions[index]; } } return undefined; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_extensions.ets#L20-L27
5f5d3522e0781b4a9e7d16544657a4aeefa4f792
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
getPieStartAngle
Calculate start angle for pie chart
getPieStartAngle(index: number): number { let angle = 0; for (let i = 0; i < index; i++) { angle += (this.categoryStatsList[i].percentage / 100) * 360; } return angle; }
AST#method_declaration#Left getPieStartAngle AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
getPieStartAngle(index: number): number { let angle = 0; for (let i = 0; i < index; i++) { angle += (this.categoryStatsList[i].percentage / 100) * 360; } return angle; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L221-L227
59b965eda62d957165047b326c58e845cbaba906
github
openharmony/notification_common_event_service
5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558
interfaces/kits/ani/common_event/ets/commonEvent/commonEventData.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface CommonEventData { event: string; bundleName?: string; code?: number; data?: string; parameters?: Record<string, Object>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CommonEventData AST#object_type#Left { AST#type_member#Left event : 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 bundleName ? : AST#type_anno...
export interface CommonEventData { event: string; bundleName?: string; code?: number; data?: string; parameters?: Record<string, Object>; }
https://github.com/openharmony/notification_common_event_service/blob/5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558/interfaces/kits/ani/common_event/ets/commonEvent/commonEventData.ets#L16-L22
832a6502bbf148b8d1ec92f5356212726126ed38
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
buildEpisodeItemWithDate
单集项(带日期)
@Builder buildEpisodeItemWithDate(episode: Episode) { Row() { // 封面图 Image(episode.imageUrl) .width(56) .height(56) .borderRadius(8) .objectFit(ImageFit.Cover) .alt($r('app.media.app_icon')) // 单集信息 Column() { Text(episode.title) ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEpisodeItemWithDate AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_...
@Builder buildEpisodeItemWithDate(episode: Episode) { Row() { Image(episode.imageUrl) .width(56) .height(56) .borderRadius(8) .objectFit(ImageFit.Cover) .alt($r('app.media.app_icon')) Column() { Text(episode.title) .fontSize(14) ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L657-L701
361452ba7eb8adea2e6d6523ebe2abfb9414da34
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
arkts
toEntity
将领域模型转换为数据库实体 @param {SearchHistory} history 搜索历史领域模型 @returns {SearchHistoryEntity} 数据库实体
private toEntity(history: SearchHistory): SearchHistoryEntity { const entity: SearchHistoryEntity = new SearchHistoryEntity(); entity.keyword = history.keyword.trim(); entity.searchTime = history.searchTime; return entity; }
AST#method_declaration#Left private toEntity AST#parameter_list#Left ( AST#parameter#Left history : AST#type_annotation#Left AST#primary_type#Left SearchHistory AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SearchHistoryE...
private toEntity(history: SearchHistory): SearchHistoryEntity { const entity: SearchHistoryEntity = new SearchHistoryEntity(); entity.keyword = history.keyword.trim(); entity.searchTime = history.searchTime; return entity; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L110-L115
8cdd6eab464a37fcc54f36f5377501f45f0af77b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
test
[Start original_network_connection_uses_socket] [Start monitor_default_network_change] 监控默认网络变化
async function test() { const netConnection = connection.createNetConnection(); /* 监听默认网络改变 */ netConnection.on('netAvailable', (data: connection.NetHandle) => { Logger.info(JSON.stringify(data)); }); }
AST#function_declaration#Left async function test AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left netConnection = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Lef...
async function test() { const netConnection = connection.createNetConnection(); netConnection.on('netAvailable', (data: connection.NetHandle) => { Logger.info(JSON.stringify(data)); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets#L39-L45
b9a35d518d6dc7098ae73b2606de32e9fc2e6c0f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardOne.ets
arkts
buildLearnPageInfoPanel
构建学习状态和计数布局
@Builder buildLearnPageInfoPanel() { Row(){ // Image(this.word.deleted ? $r('app.media.btn_learn_disable_1') : $r('app.media.btn_learn_1')) // .width(69) // .height(26) // .margin({left: 20}) // Blank().layoutWeight(1) Text(this.pageInfo) //页码 .fontColor(Color...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLearnPageInfoPanel 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 { // Image...
@Builder buildLearnPageInfoPanel() { Row(){ Text(this.pageInfo) .fontColor(Color.Black) .fontSize(14) .margin({right: 2}) } .width('100%') .padding(0) .margin(0) .justifyContent(FlexAlign.SpaceBetween) .height(26) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L116-L137
7f3e44d0bd59e6a6e6ed350b57ae79a2f3f14f23
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/Helper.ets
arkts
isResourceStr
判断是否是ResourceStr类型
static isResourceStr(value: Any) { return Helper.isString(value) || Helper.isResource(value); }
AST#method_declaration#Left static isResourceStr AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left...
static isResourceStr(value: Any) { return Helper.isString(value) || Helper.isResource(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L95-L97
269f687829b2a741243a48d341e553c9ad5696ad
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/common/ComponentId.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export enum ComponentId { SERVICE_ADD_STATUS = 'addService', SERVICE_REMOVE_STATUS = 'removeService', SERVICE_RESOLVE_STATUS = 'resolveService', SERVICE_DISCOVERY_STATUS = 'discoveryService', ADD_SERVICE_BTN = 'addLocal', RESOLVE_SERVICE_BTN = 'resolveLocal', REMOVE_SERVICE_BTN = 'removeLoc...
AST#export_declaration#Left export AST#enum_declaration#Left enum ComponentId AST#enum_body#Left { AST#enum_member#Left SERVICE_ADD_STATUS = AST#expression#Left 'addService' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SERVICE_REMOVE_STATUS = AST#expression#Left 'removeService' AST#expression#Right...
export enum ComponentId { SERVICE_ADD_STATUS = 'addService', SERVICE_REMOVE_STATUS = 'removeService', SERVICE_RESOLVE_STATUS = 'resolveService', SERVICE_DISCOVERY_STATUS = 'discoveryService', ADD_SERVICE_BTN = 'addLocal', RESOLVE_SERVICE_BTN = 'resolveLocal', REMOVE_SERVICE_BTN = 'removeLoc...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/common/ComponentId.ets#L16-L26
0abbbbb40d11276b9f26c96c09b9183214bc24f5
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/listener/RawDeviceMessageListener.ets
arkts
设备消息监听器,用于接收平台下发的设备消息
export interface RawDeviceMessageListener { /** * 处理平台下发的设备消息 * * @param rawDeviceMessage 原始设备消息内容, */ onRawDeviceMessage: (rawDeviceMessage: RawDeviceMessage) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RawDeviceMessageListener AST#object_type#Left { /** * 处理平台下发的设备消息 * * @param rawDeviceMessage 原始设备消息内容, */ AST#type_member#Left onRawDeviceMessage : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#param...
export interface RawDeviceMessageListener { onRawDeviceMessage: (rawDeviceMessage: RawDeviceMessage) => void; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/listener/RawDeviceMessageListener.ets#L20-L27
c2ba0bd4d4d9bf6da042fd7427f7c598c35c3fc0
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
initializeNotifications
初始化通知权限
async initializeNotifications(): Promise<boolean> { try { hilog.info(0x0000, 'SimpleNotificationManager', 'Notification permissions initialized (simplified version)'); return true; } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize notification permissions...
AST#method_declaration#Left async initializeNotifications 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 ...
async initializeNotifications(): Promise<boolean> { try { hilog.info(0x0000, 'SimpleNotificationManager', 'Notification permissions initialized (simplified version)'); return true; } catch (error) { hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize notification permissions...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L64-L72
2e958275392164757e29dfab8ebe49f3e39e68ec
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
encodeAsym
非对称加密 @param encodeStr 待加密的字符串 @param pubKey 给定秘钥规格公钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格
static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<string> { //将公钥转换 let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName); //生成加密器 let encoder = crypto.createCipher(symEncryptName); //初始化加密环境 ...
AST#method_declaration#Left static async encodeAsym AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<string> { let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName); let encoder = crypto.createCipher(symEncryptName); await encoder.init(cryp...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L220-L234
a05d2a2245414c90b34a89620ae8c4e210b22f5c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/RankingDemo/entry/src/main/ets/common/constants/Constants.ets
arkts
The Style of TitleComponent.
export const TitleBarStyle: titleBarStyle = { /** * The image size of back button. */ IMAGE_BACK_SIZE: 21, /** * The right margin of back button. */ IMAGE_BACK_MARGIN_RIGHT: 18, /** * The size of loading image. */ IMAGE_LOADING_SIZE: 22, /** * The height of TitleComponent. */ ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TitleBarStyle : AST#type_annotation#Left AST#primary_type#Left titleBarStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { /** * The image size of back button. */ ...
export const TitleBarStyle: titleBarStyle = { IMAGE_BACK_SIZE: 21, IMAGE_BACK_MARGIN_RIGHT: 18, IMAGE_LOADING_SIZE: 22, BAR_HEIGHT: 47, BAR_MARGIN_HORIZONTAL: 26, BAR_MARGIN_TOP: 10, WEIGHT: '50%', };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/common/constants/Constants.ets#L193-L228
85f64fd2be9a2d2ce42b083d912d3137a9469f38
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
txtColor
顶部省市区文字样式 @param selected
@Extend(Text) function txtColor(selected: boolean, fontSize: number | string) { .fontSize(fontSize) .fontColor(selected ? "#969799" : "#000") .fontWeight(selected ? FontWeight.Normal : FontWeight.Bold) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function txtColor AST#parameter_list#Left ( AST#parameter#Left selected : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#...
@Extend(Text) function txtColor(selected: boolean, fontSize: number | string) { .fontSize(fontSize) .fontColor(selected ? "#969799" : "#000") .fontWeight(selected ? FontWeight.Normal : FontWeight.Bold) }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L38-L43
955f76047ca366cf1e0c6d5fbccfa32790bc0c38
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
buildTabItem
构建Tab项
@Builder buildTabItem(title: string, key: string, count: number) { Column({ space: 4 }) { Text(`${title}(${count})`) .fontSize(14) .fontColor(this.activeTab === key ? '#007AFF' : '#666666') .fontWeight(this.activeTab === key ? FontWeight.Medium : FontWeight.Normal) if (t...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AS...
@Builder buildTabItem(title: string, key: string, count: number) { Column({ space: 4 }) { Text(`${title}(${count})`) .fontSize(14) .fontColor(this.activeTab === key ? '#007AFF' : '#666666') .fontWeight(this.activeTab === key ? FontWeight.Medium : FontWeight.Normal) if (t...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L281-L299
01e907d300db0cbdc5e2cc82cf6ef77d178b081f
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
The AtomicFile class provides methods for performing atomic operations on files. @syscap SystemCapability.FileManagement.File.FileIO @since 20
export class AtomicFile { /** * The AtomicFile constructor. * @param { string } path file path. * @throws { BusinessError } 401 Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 ...
AST#export_declaration#Left export AST#class_declaration#Left class AtomicFile AST#class_body#Left { /** * The AtomicFile constructor. * @param { string } path file path. * @throws { BusinessError } 401 Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. ...
export class AtomicFile { constructor(path: string); getBaseFile(): File; readFully(): ArrayBuffer; finishWrite(): void; failWrite(): void; delete(): void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L3392-L3451
b411044c04365e8bcc12b84561c1d61637615fcb
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
The callback of onCurrentAlbumDeleted event @typedef { function } CurrentAlbumDeletedCallback @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 13
export type CurrentAlbumDeletedCallback = () => void;
AST#export_declaration#Left export AST#type_declaration#Left type CurrentAlbumDeletedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#R...
export type CurrentAlbumDeletedCallback = () => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L206-L206
b471ea8a7071c1de2d83fbbca4983e047f81dccb
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ToastIconBuilderProxy.ets
arkts
duration
显示时长 @param duration 默认:2000ms @returns
duration(duration: number) { this.builderOptions.duration = duration return this }
AST#method_declaration#Left duration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left A...
duration(duration: number) { this.builderOptions.duration = duration return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ToastIconBuilderProxy.ets#L29-L32
d93db8e7b7dc2bfe5f9901f13dea65eddc10824a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/ResManager.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ResManager{ static getPic(): Resource{ return $r('app.media.pic'); } static getDesc(): Resource{ return $r('app.string.shared_desc'); } }
AST#export_declaration#Left export AST#class_declaration#Left class ResManager AST#class_body#Left { AST#method_declaration#Left static getPic AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#block_stateme...
export class ResManager{ static getPic(): Resource{ return $r('app.media.pic'); } static getDesc(): Resource{ return $r('app.string.shared_desc'); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/ResManager.ets#L16-L23
09d6f9ec718c90f6f470762ded9cb0f6f4b79afc
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/managers/SystemSizeManager.ets
arkts
get
获取单例实例
public static get shared(): SystemSizeManager { if (!SystemSizeManager.instance) { SystemSizeManager.instance = new SystemSizeManager(); } return SystemSizeManager.instance; }
AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SystemSizeManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if...
public static get shared(): SystemSizeManager { if (!SystemSizeManager.instance) { SystemSizeManager.instance = new SystemSizeManager(); } return SystemSizeManager.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/managers/SystemSizeManager.ets#L29-L34
3f5c79fe960a55323ebd7bc095034f1e4246fb27
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.NavPushPathHelper.d.ets
arkts
@file Defines provides a push method for the target page in the routing table. @kit ArkUI provides a push method for the target page in the routing table. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare class NavPushPathHelper { /** * The constructor used to create a NavPushPathHelper object. * * @param { NavPathStack } navPathStack - The stack of the route table. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ constructor(navPathSta...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class NavPushPathHelper AST#class_body#Left { /** * The constructor used to create a NavPushPathHelper object. * * @param { NavPathStack } navPathStack - The stack of the route table. * @syscap Syste...
export declare class NavPushPathHelper { constructor(navPathStack: NavPathStack); pushPath(moduleName: string, info: NavPathInfo, animated?: boolean): Promise<void>; pushPath(moduleName: string, info: NavPathInfo, options?: NavigationOptions): Promise<void>; pushDestination(moduleNam...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.NavPushPathHelper.d.ets#L26-L214
c8e06ef2b0ad577a3084b9261edb68d41bdd7066
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/TableHelper.ets
arkts
deleteTableSql
生成删除表格的sql语句
deleteTableSql(tableName: string): string { return `drop table if exists ${tableName}`; }
AST#method_declaration#Left deleteTableSql AST#parameter_list#Left ( AST#parameter#Left tableName : 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#primary_ty...
deleteTableSql(tableName: string): string { return `drop table if exists ${tableName}`; }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/TableHelper.ets#L30-L32
f0047e3d19b9f8910eadd5666f531693a2b916b2
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
getFormattedDateTime
格式化面试日期时间
getFormattedDateTime(): string { if (!this.interviewDate) return ''; const date = this.interviewDate; const time = this.interviewTime || ''; return time ? `${date} ${time}` : date; }
AST#method_declaration#Left getFormattedDateTime 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#if_statement#Left if ( AST#expression#Left AST#member_expressio...
getFormattedDateTime(): string { if (!this.interviewDate) return ''; const date = this.interviewDate; const time = this.interviewTime || ''; return time ? `${date} ${time}` : date; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L224-L229
768a7cf82629a5466978f54c02f4ebbc3abf142f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets
arkts
notifyDataReload
通知LazyForEach组件需要重载所有子组件
notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); }
AST#method_declaration#Left notifyDataReload 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#express...
notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L47-L51
a891ae54258a72cd7c30305869f7132fe8c1ed5b
gitee
PlushTz/ArkTS-Sample.git
dc02b37a00af35f368099052e7bc7898d6c176a7
entry/src/main/ets/pages/ContactPage.ets
arkts
ContactPage
Desc: @author lijt Created on 2024/3/5 Email: lijt@eetrust.com
@Component export struct ContactPage { build() { Column() { Toolbar({ title: '通讯录', titleColor:$r('app.color.white'), isShowMenu: false, titleMode:NavigationTitleMode.Mini, }).height(50).backgroundColor($r('app.color.black')) ContactListPage() } .width('10...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ContactPage AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left...
@Component export struct ContactPage { build() { Column() { Toolbar({ title: '通讯录', titleColor:$r('app.color.white'), isShowMenu: false, titleMode:NavigationTitleMode.Mini, }).height(50).backgroundColor($r('app.color.black')) ContactListPage() } .width('10...
https://github.com/PlushTz/ArkTS-Sample.git/blob/dc02b37a00af35f368099052e7bc7898d6c176a7/entry/src/main/ets/pages/ContactPage.ets#L9-L24
ede98f4bdf743c51375f91c2684f62b619dc9544
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
get2025LunarFestivalMap
获取2025年农历节日映射表(用于验证)
public static get2025LunarFestivalMap(): Map<string, string> { const map = new Map<string, string>(); map.set('春节', '2025年1月29日(农历正月初一)'); map.set('元宵节', '2025年2月12日(农历正月十五)'); map.set('龙抬头', '2025年3月1日(农历二月初二)'); map.set('端午节', '2025年5月31日(农历五月初五)'); map.set('七夕节', '2025年8月29日(农历七月初七)'); ma...
AST#method_declaration#Left public static get2025LunarFestivalMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig...
public static get2025LunarFestivalMap(): Map<string, string> { const map = new Map<string, string>(); map.set('春节', '2025年1月29日(农历正月初一)'); map.set('元宵节', '2025年2月12日(农历正月十五)'); map.set('龙抬头', '2025年3月1日(农历二月初二)'); map.set('端午节', '2025年5月31日(农历五月初五)'); map.set('七夕节', '2025年8月29日(农历七月初七)'); ma...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L374-L384
ec3f38ff40936e466ea751450cfe0d5db3cb2fdd
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/network/src/main/ets/mocks/MockRequestMap.ets
arkts
simulateDelay
模拟一个延时的 mock 方法,延迟时间为 `delay` 毫秒
function simulateDelay<T>(data: T, delay: number): Promise<T> { return new Promise<T>((resolve) => { setTimeout(() => { resolve(data); }, delay); }); }
AST#function_declaration#Left function simulateDelay AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#paramet...
function simulateDelay<T>(data: T, delay: number): Promise<T> { return new Promise<T>((resolve) => { setTimeout(() => { resolve(data); }, delay); }); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/network/src/main/ets/mocks/MockRequestMap.ets#L19-L25
49b3c59d3d81cf0656da773fcfad37b9a34d2e8b
github
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/common/mock.ets
arkts
some mock data home data list
export const homeShowList = Array(10).fill('').map((item)=>{ item = { time: "2023-09-08 12:25:36", title: "hormanyOs", hot: 20, comment: 36, like: 520, info: "登山者永垂不朽!", plate: "学习人生", stort: "ArkTs基础", img: '', } return item })
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left homeShowList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left A...
export const homeShowList = Array(10).fill('').map((item)=>{ item = { time: "2023-09-08 12:25:36", title: "hormanyOs", hot: 20, comment: 36, like: 520, info: "登山者永垂不朽!", plate: "学习人生", stort: "ArkTs基础", img: '', } return item })
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/common/mock.ets#L9-L22
1165335c51b0679c36078fbb6a3ac8e69f488486
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
entry/src/main/ets/pages/LiveEnterPage.ets
arkts
aboutToAppear
功能配置
aboutToAppear(): void { this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(createLoadingView)); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptActionClass.setOptions({ alignment: DialogAlignment.Center, isMod...
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#expression_statement#Left AST#expression#Left AST#assignment_expression#...
aboutToAppear(): void { this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(createLoadingView)); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptActionClass.setOptions({ alignment: DialogAlignment.Center, isMod...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/entry/src/main/ets/pages/LiveEnterPage.ets#L62-L91
eda1e15af6af96fe6792103bf9346fd07761bf3e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getBuildVersion
获取Build版本号,标识编译构建的版本号。
static getBuildVersion(): number { return deviceInfo.buildVersion; }
AST#method_declaration#Left static getBuildVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e...
static getBuildVersion(): number { return deviceInfo.buildVersion; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L208-L210
db59d5b9597109c1bb147f2048f17a252d3436db
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
updateDailySummary
更新每日总结
private async updateDailySummary(): Promise<void> { try { console.info(`[MainViewModel] ========== 更新每日总结 ==========`); const today = ChatLog.getTodayDateString(); console.info(`[MainViewModel] 今天日期: ${today}`); const chatLogs = await this.rdbHelper.getChatLogsForDate(today); const mo...
AST#method_declaration#Left private async updateDailySummary AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ...
private async updateDailySummary(): Promise<void> { try { console.info(`[MainViewModel] ========== 更新每日总结 ==========`); const today = ChatLog.getTodayDateString(); console.info(`[MainViewModel] 今天日期: ${today}`); const chatLogs = await this.rdbHelper.getChatLogsForDate(today); const mo...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L336-L412
38e8eef192d649122805915a2e3f2ca0fc89f29d
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
40% 百分比
export const P40: string = "40%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P40 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "40%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right...
export const P40: string = "40%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L49-L49
79e60e335ce71c1dd9bdd6eb992454eac962be21
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
getRecommendations
获取个性化推荐
async getRecommendations( type: RecommendationType, context: RecommendationContext, count: number = 10 ): Promise<RecommendationResult> { try { // 检查缓存 const cacheKey = this.generateCacheKey(type, context, count); if (this.recommendationCache.has(cacheKey)) { const cached = t...
AST#method_declaration#Left async getRecommendations AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left RecommendationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Re...
async getRecommendations( type: RecommendationType, context: RecommendationContext, count: number = 10 ): Promise<RecommendationResult> { try { const cacheKey = this.generateCacheKey(type, context, count); if (this.recommendationCache.has(cacheKey)) { const cached = this.rec...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L275-L315
ee04b5217fb8cca0be23f8dc2e2bda3d0c2b6646
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/WebAppInteropDemo/entry/src/main/ets/pages/Index.ets
arkts
getMultiplicand
获取被乘数
public getMultiplicand() { return this.multiplicand; }
AST#method_declaration#Left public getMultiplicand AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . multiplicand AST#member_expression#Right A...
public getMultiplicand() { return this.multiplicand; }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/WebAppInteropDemo/entry/src/main/ets/pages/Index.ets#L18-L20
90cace7eb4c230976e8c510de32dc4c46626fd48
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/view/PrivacyPolicyPage.ets
arkts
PrivacyPolicyContent
隐私政策页面内容视图 @returns {void} 无返回值
@Builder private PrivacyPolicyContent() { Text("隐私政策页面内容视图") }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PrivacyPolicyContent 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 Text ( AST#expression#Left "隐私政策页面内容视图" AST#e...
@Builder private PrivacyPolicyContent() { Text("隐私政策页面内容视图") }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/PrivacyPolicyPage.ets#L33-L36
e9a5f4524a86c3d97241943f6517bd9646afe7df
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
prompt message
export const SETTING_FINISHED_MESSAGE = '设置完成!!!';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SETTING_FINISHED_MESSAGE = AST#expression#Left '设置完成!!!' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const SETTING_FINISHED_MESSAGE = '设置完成!!!';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L113-L113
8314ac2d365543ff4416287eaf5d812d6cb22565
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
Compute the total covered length on the timeline: lastStart + lastDuration. @param infos Video list. @param timelineStarts Start offsets per segment. @returns Total timeline length in ms.
export function computeTimelineEndOffset(infos: VideoInfo[], timelineStarts: number[]): number { if (!infos || infos.length === 0) { return 0; } if (!timelineStarts || timelineStarts.length === 0) { return Number(infos[0]?.duration) || 0; } const lastIndex = infos.length - 1; const lastStart = timel...
AST#export_declaration#Left export AST#function_declaration#Left function computeTimelineEndOffset AST#parameter_list#Left ( AST#parameter#Left infos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VideoInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig...
export function computeTimelineEndOffset(infos: VideoInfo[], timelineStarts: number[]): number { if (!infos || infos.length === 0) { return 0; } if (!timelineStarts || timelineStarts.length === 0) { return Number(infos[0]?.duration) || 0; } const lastIndex = infos.length - 1; const lastStart = timel...
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L255-L266
2c3a9cec788d7cb07b91388ef906f5ac5d7f41e2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/DFX/FaultLogger/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
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 TitleBar { private title: string | Resource = $r('app.string.module_desc') build() { Row() { Text(this.title) .fontColor(Color.White) .fontSize(28) } .width('100%') .height('8%') .constraintSize({ minHeight: 70 }) .padding({ left: 10, right: 10...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#pr...
@Component export struct TitleBar { private title: string | Resource = $r('app.string.module_desc') build() { Row() { Text(this.title) .fontColor(Color.White) .fontSize(28) } .width('100%') .height('8%') .constraintSize({ minHeight: 70 }) .padding({ left: 10, right: 10...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DFX/FaultLogger/entry/src/main/ets/common/TitleBar.ets#L16-L32
2fc37bfb9fa274f996058fade7bb80934b8c109a
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_012_F.ets
arkts
Introduction 库函数-string_substring
export function string_lib_func_012_F(taint_src : string) { let clean = "clean"; let t = clean.substring(1,3); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_012_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_012_F(taint_src : string) { let clean = "clean"; let t = clean.substring(1,3); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_012_F.ets#L7-L11
3cffef592e103f0c67d14b4392d3a1d7fe2ce344
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
getDailyTasks
获取每日任务
getDailyTasks(): DailyTask[] { if (!this.userGameData) { return []; } return this.userGameData.dailyTasks; }
AST#method_declaration#Left getDailyTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DailyTask [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if (...
getDailyTasks(): DailyTask[] { if (!this.userGameData) { return []; } return this.userGameData.dailyTasks; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L463-L468
a05e38b44953ce9480263a819f25d7208e575592
github
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/views/Chat/ChatDetailBottomMediaSheet.ets
arkts
tab
单独的页签
@Builder tab(tabName: Resource, tabItem: number, tabIndex: number) { Row({ space: 20 }) { Text(tabName).fontSize(18) .fontColor(tabItem === this.currentIndex ? Color.Red : Color.Black) .id(tabIndex.toString()) .onAreaChange((oldValue: Area, newValue: Area) => { if (this.cur...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tab AST#parameter_list#Left ( AST#parameter#Left tabName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tabItem : AST#type_annotation#Left AST...
@Builder tab(tabName: Resource, tabItem: number, tabIndex: number) { Row({ space: 20 }) { Text(tabName).fontSize(18) .fontColor(tabItem === this.currentIndex ? Color.Red : Color.Black) .id(tabIndex.toString()) .onAreaChange((oldValue: Area, newValue: Area) => { if (this.cur...
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomMediaSheet.ets#L82-L111
dd6c79951d845de23b487f4fa414da70add6013a
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
arkts
SectionTitle
分段标题
@Builder SectionTitle(title: string) { Row() { Divider() .strokeWidth(2) .color(AppColors.primary) .width(4) .vertical(false) Text(title) .fontSize(AppTypography.fontSizeLarge) .fontWeight(AppTypography.fontWeightMedium) .fontColor(AppColors.tex...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SectionTitle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L...
@Builder SectionTitle(title: string) { Row() { Divider() .strokeWidth(2) .color(AppColors.primary) .width(4) .vertical(false) Text(title) .fontSize(AppTypography.fontSizeLarge) .fontWeight(AppTypography.fontWeightMedium) .fontColor(AppColors.tex...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L372-L388
857c9ddd8e9ff7c8464d4f09b5366e5d6afa28b9
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/History.ets
arkts
setItem
存一个关键字
setItem(keyword: string) { this.getStore().putSync(keyword, keyword) // vue:vue record:record ts:ts this.getStore().flushSync() }
AST#method_declaration#Left setItem AST#parameter_list#Left ( AST#parameter#Left keyword : 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#expression#L...
setItem(keyword: string) { this.getStore().putSync(keyword, keyword) this.getStore().flushSync() }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L23-L26
fbdb8996374645e5cd3aefdf0bd57b05871ef246
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/TCPTimeoutDemo/entry/src/main/ets/pages/Index.ets
arkts
connect2Server
连接服务端
async connect2Server(defaultTimeout: boolean, timeout: number) { //执行TCP通讯的对象 let tcpSocket = socket.constructTCPSocketInstance(); let localAddress = { address: "0.0.0.0", family: 1 } await tcpSocket.bind(localAddress) //服务端地址 let serverAddress = { address: this.serverIp, port: this.serverPor...
AST#method_declaration#Left async connect2Server AST#parameter_list#Left ( AST#parameter#Left defaultTimeout : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeout : AST#type_annotation#Left AST#primary_type#Left number ...
async connect2Server(defaultTimeout: boolean, timeout: number) { let tcpSocket = socket.constructTCPSocketInstance(); let localAddress = { address: "0.0.0.0", family: 1 } await tcpSocket.bind(localAddress) let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 } ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TCPTimeoutDemo/entry/src/main/ets/pages/Index.ets#L208-L238
4a82c9081c295c5ca8911f2f2a71117d27665d67
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/PersonalSetting.ets
arkts
logOutContent
退出登陆
@Builder logOutContent() { Column() { Row() { Text('请确认是否退出当前账户?') .fontSize(14); }; } .width('100%') .borderRadius(16) .margin({ left: '4%', right: '4%', bottom: 5, }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right logOutContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder logOutContent() { Column() { Row() { Text('请确认是否退出当前账户?') .fontSize(14); }; } .width('100%') .borderRadius(16) .margin({ left: '4%', right: '4%', bottom: 5, }); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/PersonalSetting.ets#L48-L63
b39a9cbb0b5b20fcc5cffe2e5885da4f029eeaa0
github
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
entry/src/main/ets/bridge/JsBridgeNamespace.ets
arkts
testAsync
异步模版 @param p @param handler
@JavaScriptInterface() testAsync(p: string, handler: CompleteHandler) { LogUtils.d("namespace testAsync: " + JSON.stringify(p)) this.cHandler = handler this.countdown(5, (time:number) => { if (time === 0) { handler.complete("namespace: 原生异步testAsync方法返回的数据--结束") handler.complete("nam...
AST#method_declaration#Left AST#decorator#Left @ JavaScriptInterface ( ) AST#decorator#Right testAsync AST#parameter_list#Left ( AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annot...
@JavaScriptInterface() testAsync(p: string, handler: CompleteHandler) { LogUtils.d("namespace testAsync: " + JSON.stringify(p)) this.cHandler = handler this.countdown(5, (time:number) => { if (time === 0) { handler.complete("namespace: 原生异步testAsync方法返回的数据--结束") handler.complete("nam...
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/entry/src/main/ets/bridge/JsBridgeNamespace.ets#L22-L36
99b1bd27478c7dd78f515aeb9cefc2d1cd7ae699
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/auth/UserSessionManager.ets
arkts
getPersonInfo
异步获取用户信息,保证数据加载完成
async getPersonInfo(): Promise<PersonModel | undefined> { await this.personModelLoaded; // 等待用户数据加载完成 return this.getPersonModel; }
AST#method_declaration#Left async getPersonInfo 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#union_type#Left AST#primary_type#Left PersonModel AST#primary_type#Right | AST#primar...
async getPersonInfo(): Promise<PersonModel | undefined> { await this.personModelLoaded; return this.getPersonModel; }
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/auth/UserSessionManager.ets#L68-L71
2917026191d9b86eb41ebed8552c7fc9b3d8115c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
arkts
buildNotesCard
构建备注卡片
@Builder buildNotesCard() { Column({ space: 12 }) { Text('备注') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text(this.contact!.notes!) .fontSize(14) .fontColor('#666666') .lineHeight(20) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNotesCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para...
@Builder buildNotesCard() { Column({ space: 12 }) { Text('备注') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text(this.contact!.notes!) .fontSize(14) .fontColor('#666666') .lineHeight(20) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L362-L387
c2b2f6bf3abf953e7e2e613d5efa643477e346ad
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
saveMessages
保存消息
private async saveMessages(conversationId: string): Promise<void> { try { const messages = this.messages.get(conversationId) || []; await StorageManager.setString(`${this.MESSAGES_PREFIX}${conversationId}`, JSON.stringify(messages)); } catch (error) { Logger.error('IMManager', `Failed to save ...
AST#method_declaration#Left private async saveMessages AST#parameter_list#Left ( AST#parameter#Left conversationId : 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#...
private async saveMessages(conversationId: string): Promise<void> { try { const messages = this.messages.get(conversationId) || []; await StorageManager.setString(`${this.MESSAGES_PREFIX}${conversationId}`, JSON.stringify(messages)); } catch (error) { Logger.error('IMManager', `Failed to save ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L151-L158
eab39f09973e931dddeb31b57944ce6999a71909
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
getDataWantSync
读取系统剪贴板Want内容。 @returns
static getDataWantSync(): Want { return PasteboardUtil.getDataSync().getPrimaryWant(); }
AST#method_declaration#Left static getDataWantSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expre...
static getDataWantSync(): Want { return PasteboardUtil.getDataSync().getPrimaryWant(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L248-L250
477204c271f72ea24448e2f5bce8e1a10fdc4759
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getAliveParts
获取活跃分类(包含活跃单元的分类)
getAliveParts(): Part[] { return this.parts.filter(part => part.aliveUnits.length > 0); }
AST#method_declaration#Left getAliveParts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Part [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left retur...
getAliveParts(): Part[] { return this.parts.filter(part => part.aliveUnits.length > 0); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L349-L351
7eecd7fa02b4c513d2eaf1975ecba83a3e13625a
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件函数
private notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left private notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
private notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L85-L89
1e0d43381db55bc5c18a2e4004047036effdb61b
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/applications/Applications.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const ApplicationsData: Resource [] = [ $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.strin...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ApplicationsData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#...
export const ApplicationsData: Resource [] = [ $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.strin...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/applications/Applications.ets#L16-L51
fe651f4c2ce028a10166969cf73b6a795fd61239
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/net/wanAPI/response/IBanner.ets
arkts
banner的数据类 https://www.wanandroid.com/banner/json
export interface IBanner { desc: string; id: number; imagePath: string; isVisible: number; order: number; title: string; type: number; url: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IBanner AST#object_type#Left { AST#type_member#Left desc : 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 id : AST#type_annotation#Left AST#pri...
export interface IBanner { desc: string; id: number; imagePath: string; isVisible: number; order: number; title: string; type: number; url: string; }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/response/IBanner.ets#L5-L14
99e2b1e78992357b307fc2be930231ebf9718fd5
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/models/DreamTag.ets
arkts
梦想标签实体类
export interface DreamTag { id?: number; name: string; dreamId?: number; createdAt?: string; updatedAt?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DreamTag AST#object_type#Left { AST#type_member#Left id ? : 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 name : AST#type_annotation#Left AST#...
export interface DreamTag { id?: number; name: string; dreamId?: number; createdAt?: string; updatedAt?: string; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/models/DreamTag.ets#L4-L10
db8f3c0a3ef3f6e293dd844d6546af746c93d87b
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets
arkts
News image list item info.
export class NewsFile { /** * News image list item id. */ id: number = 0; /** * News image list item url. */ url: string = ''; /** * News image list item type. */ type: number = 0; /** * News image list item newsId. */ newsId: number = 0; }
AST#export_declaration#Left export AST#class_declaration#Left class NewsFile AST#class_body#Left { /** * News image list item id. */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Righ...
export class NewsFile { id: number = 0; url: string = ''; type: number = 0; newsId: number = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets#L106-L126
e2d8cf2ce63cb1595f28cb49f6500da6e2605901
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
getBrightness
获取屏幕亮度。该参数为浮点数,可设置的亮度范围为[0.0, 1.0],其取1.0时表示最大亮度值。如果窗口没有设置亮度值,表示亮度跟随系统,此时获取到的亮度值为-1。 @param windowClass 不传该值,默认主窗口。 @returns
static getBrightness(windowClass: window.Window = AppUtil.getMainWindow()): number { return WindowUtil.getWindowProperties(windowClass).brightness; }
AST#method_declaration#Left static getBrightness AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#...
static getBrightness(windowClass: window.Window = AppUtil.getMainWindow()): number { return WindowUtil.getWindowProperties(windowClass).brightness; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L242-L244
b70ae321d77a0bfb9f9ba82826b30ad712d17353
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
takePhoto
拍摄照片 @returns
async takePhoto(): Promise<void> { // 拉起拍照功能 if (this.context) { let pickerProfile: cameraPicker.PickerProfile = { cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK }; let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(this.context, [cameraPicker.Pic...
AST#method_declaration#Left async takePhoto AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
async takePhoto(): Promise<void> { if (this.context) { let pickerProfile: cameraPicker.PickerProfile = { cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK }; let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(this.context, [cameraPicker.PickerMediaT...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L273-L289
997029753cd8a106f2f19344663a1374c9c63320
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/ECDSA.ets
arkts
verifySync
对数据进行验签,同步 @param dataBlob 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(ECC256|SHA256、ECC256|SHA512、ECC384|SHA256、等)。 @returns
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName = 'ECC256|SHA256'): boolean { return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName); }
AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signD...
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName = 'ECC256|SHA256'): boolean { return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/ECDSA.ets#L74-L77
d5a987d9168d4739b67b1a64d4075041989fcc7d
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Model/DMJSAppBundleConfig.ets
arkts
JSApp包配置信息
export class DMJSAppBundleConfig { public appId: string = ''; public versionCode: number = 0; public versionName: string = ''; public path: string = ''; public static fromJson(dictionary: DMPMap | null): DMJSAppBundleConfig | null { if (dictionary == null) { return null; } let config = new ...
AST#export_declaration#Left export AST#class_declaration#Left class DMJSAppBundleConfig AST#class_body#Left { AST#property_declaration#Left public appId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_d...
export class DMJSAppBundleConfig { public appId: string = ''; public versionCode: number = 0; public versionName: string = ''; public path: string = ''; public static fromJson(dictionary: DMPMap | null): DMJSAppBundleConfig | null { if (dictionary == null) { return null; } let config = new ...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Model/DMJSAppBundleConfig.ets#L4-L21
baf8b394ddc50deb2a80818a47fd7fb71873852a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
drawValues
Loops over all Entries and draws their values. @param c
public abstract drawValues(c: CanvasRenderingContext2D, isHorizontalFlip?: boolean): void;
AST#method_declaration#Left public abstract drawValues AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isHorizontalFlip ? : AST#type_annotation#Left AST#prim...
public abstract drawValues(c: CanvasRenderingContext2D, isHorizontalFlip?: boolean): void;
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/DataRenderer.ets#L154-L154
5c97d837a4f900035a1db96777cb1323b6583b80
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Duration of prompt. */ DURATION: number = 3000; /** * The fruit name tag. */ FRUIT_FLAG: number = 0; /** * The fruit number tag. */ NUMBER_FLAG: number = 1; /** * The tag is used to print log. */ TAG = '[PreferenceModel]'; /** * The k...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Duration of prompt. */ AST#property_declaration#Left DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3000 AST#expr...
export class CommonConstants { DURATION: number = 3000; FRUIT_FLAG: number = 0; NUMBER_FLAG: number = 1; TAG = '[PreferenceModel]'; KEY_NAME = 'todo'; PREFERENCES_NAME = 'fruit.db'; static readonly WEB_CONSTANT_FULL_WIDTH: string = '100%'; static readonly WEB_CONSTANT_FULL_HEIGHT...
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L99
bdf8c9820af9c9e56d5bd07a7c81dffe876209ac
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentEncapsulation/entry/src/main/ets/pages/BuilderParamPage.ets
arkts
ChildComponent
[Start slot]
@Component export struct ChildComponent { @Builder customBuilder() { } @BuilderParam customBuilderParam: () => void = this.customBuilder; build() { Column() { Text('Text in Child') this.customBuilderParam(); } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildComponent AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left {...
@Component export struct ChildComponent { @Builder customBuilder() { } @BuilderParam customBuilderParam: () => void = this.customBuilder; build() { Column() { Text('Text in Child') this.customBuilderParam(); } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentEncapsulation/entry/src/main/ets/pages/BuilderParamPage.ets#L16-L30
3aeb60435c7e6f2bb5dbc37481386f0c212be179
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUser.ets
arkts
get
获取裁剪后的日语文本(类似Swift的computed property)
get wordJpClippedString(): string { // return this.wordJp ? this.wordJp.split(',')[0] : ''; // return TEUtility.clipString(this.titleCn1) return this.titleCn1ClippedShort }
AST#method_declaration#Left get AST#ERROR#Left wordJpClippedStr in g AST#ERROR#Right 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 { // return this.wordJp ? this.wordJp.split(',')[0] ...
get wordJpClippedString(): string { return this.titleCn1ClippedShort }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUser.ets#L61-L65
a0ab062dcde00546b49d1239adbe6887e77ad36c
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/schedule/common/components/addScheduleSelectWeekComponents.ets
arkts
AddScheduleSelectWeekComponents
添加日程页面 底部选择日期模块
@Component export struct AddScheduleSelectWeekComponents { @Link isSelect: boolean @State week:string = "一" @State color:string = "#200A59F7" build() { Button(this.week, { type: ButtonType.Normal }) .fontSize(12) .borderRadius(10) .height(25) .width(50) .margin({ right: 16, bottom: 16 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AddScheduleSelectWeekComponents AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isSelect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#...
@Component export struct AddScheduleSelectWeekComponents { @Link isSelect: boolean @State week:string = "一" @State color:string = "#200A59F7" build() { Button(this.week, { type: ButtonType.Normal }) .fontSize(12) .borderRadius(10) .height(25) .width(50) .margin({ right: 16, bottom: 16 }) ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/common/components/addScheduleSelectWeekComponents.ets#L19-L46
c1a0b64cdbcde302eb0b21f6efcf606dacdf4cff
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
setPhotoBrowserUIElementVisibility
Sets whether other elements on the photo browser page are visible. @param { Array<PhotoBrowserUIElement> } elements - other elements on the photo browser page @param { boolean } isVisible - visible or not @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 13
setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void;
AST#method_declaration#Left setPhotoBrowserUIElementVisibility AST#parameter_list#Left ( AST#parameter#Left elements : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PhotoBrowserUIElement AST#primary_type#Right AST#type...
setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L299-L299
776c84ab5f22b5de581aaef58c602800543b861f
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets
arkts
addToCart
加入到购物车
async addToCart(): Promise<void> { try { const httpRequest = http.createHttp(); const response = await httpRequest.request( 'http://192.168.32.1:8080/api/cart/add', { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json', ...
AST#method_declaration#Left async addToCart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
async addToCart(): Promise<void> { try { const httpRequest = http.createHttp(); const response = await httpRequest.request( 'http://192.168.32.1:8080/api/cart/add', { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json', ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets#L229-L262
ec5578d526628a02cc407384c352cbe869a35227
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
postSticky
发布粘性消息 @param eventName 事件名 @param data 发送的数据
postSticky(eventName: string, data: EventAllType): void { EventBusCore.stickyData.set(eventName, data); this.post(eventName, data); }
AST#method_declaration#Left postSticky AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left EventAllType AST#primary_t...
postSticky(eventName: string, data: EventAllType): void { EventBusCore.stickyData.set(eventName, data); this.post(eventName, data); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L106-L109
90fffdc227691c9cee6b7a21e181a59bae453975
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/ContentView.ets
arkts
createMenu
创建菜单
@Builder createMenu() { Menu() { MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.create_survey') }) .onClick(() => { // 开启菜单项触感反馈 if (this.appGeneralData.isHapticMenu) { StartVibrator() } this.pageInfos.pushPath({ name: ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createMenu 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder createMenu() { Menu() { MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.create_survey') }) .onClick(() => { if (this.appGeneralData.isHapticMenu) { StartVibrator() } this.pageInfos.pushPath({ name: 'CreateSurve...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L205-L217
e291f25a0b115b057c28934e001cd3abca0fa8f4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PickerUtil.ets
arkts
selectDocument
通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。 @param options maxSelectNumber number 选择文件最大个数,上限500,有效值范围1-500(选择目录仅对具有该系统能力的设备开放。且目录选择的最大个数为1)。默认值是1。系统能力: SystemCapability.FileManagement.UserFileService defaultFilePathUri string 指定选择的文件或者目录路径 fileSuffixFilters Array<string> 选择文件的后缀类型,传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描...
static async selectDocument(options?: picker.DocumentSelectOptions): Promise<Array<string>> { if (options === undefined) { options = new picker.DocumentSelectOptions(); options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; //选择媒体文件数量的最大值,默认9。 options.selectMode = picker.DocumentSelectMode.FILE; ...
AST#method_declaration#Left static async selectDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param...
static async selectDocument(options?: picker.DocumentSelectOptions): Promise<Array<string>> { if (options === undefined) { options = new picker.DocumentSelectOptions(); options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; options.selectMode = picker.DocumentSelectMode.FILE; } const do...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L102-L110
154e721f0d5c142121d732e7b50f0748c2a1eaae
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/model/Mine.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export interface InfoItem { id: string; title: Resource; icon?: Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface InfoItem 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 title : AST#type_annotation#Left AST#p...
export interface InfoItem { id: string; title: Resource; icon?: Resource; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/Mine.ets#L16-L20
027bd3c5d9fa7d200b4e44f769cd139bbe23de82
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取用户今日任务列表 @param userId 用户ID @param page 页码 @param size 每页大小 @returns 今日任务列表
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: RequestData = { page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/today`, params as QueryParams ); } catch (error) { ...
AST#export_declaration#Left export AST#function_declaration#Left function getTodayTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AS...
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: RequestData = { page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/today`, params as QueryParams ); } catch (error) { ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L382-L394
acef03a8a0aa18bacd33dc856efbf4ecd9bc163a
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
getStatusChangeNote
生成状态变更说明
private getStatusChangeNote(oldStatus: string, newStatus: string): string { const statusMap = new Map([ ['pending→in-progress', '开始执行任务'], ['in-progress→completed', '任务完成'], ['completed→pending', '重新开放任务'], ['pending→completed', '直接完成任务'], ['in-progress→pending', '暂停任务执行'] ]); ...
AST#method_declaration#Left private getStatusChangeNote AST#parameter_list#Left ( AST#parameter#Left oldStatus : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newStatus : AST#type_annotation#Left AST#primary_type#Left stri...
private getStatusChangeNote(oldStatus: string, newStatus: string): string { const statusMap = new Map([ ['pending→in-progress', '开始执行任务'], ['in-progress→completed', '任务完成'], ['completed→pending', '重新开放任务'], ['pending→completed', '直接完成任务'], ['in-progress→pending', '暂停任务执行'] ]); ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L649-L660
261a7ca2e78e83dfda667a28c1b6ed209f32bbeb
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
addThemeChangeListener
主题监听器管理
addThemeChangeListener(listener: ThemeChangeListener): void { if (!this.listeners.includes(listener)) { this.listeners.push(listener); } }
AST#method_declaration#Left addThemeChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left ThemeChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
addThemeChangeListener(listener: ThemeChangeListener): void { if (!this.listeners.includes(listener)) { this.listeners.push(listener); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L240-L244
56b1b21a14eb0184dfce4c3a92ae3e6564248358
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
reload
Reload the data
public reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
AST#method_declaration#Left public reload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
public reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L136-L140
2352d9f7173250dcf977e155b4ececf71ff157b7
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/ConfigService.ets
arkts
hasApiKey
检查是否已配置API密钥
async hasApiKey(): Promise<boolean> { if (!this.dataPreferences) { return false; } try { const apiKey = await this.dataPreferences.get(ConfigService.KEY_API_KEY, '') as string; return apiKey.length > 0; } catch (error) { console.error('[ConfigService] 检查API密钥失败'); return f...
AST#method_declaration#Left async hasApiKey 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_arg...
async hasApiKey(): Promise<boolean> { if (!this.dataPreferences) { return false; } try { const apiKey = await this.dataPreferences.get(ConfigService.KEY_API_KEY, '') as string; return apiKey.length > 0; } catch (error) { console.error('[ConfigService] 检查API密钥失败'); return f...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L77-L89
941cad801da22c628a4dc74a19cbd899c76efbb5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets
arkts
getData
获取指定数据项
public getData(index: number): NewsCommentModel { return this.originDataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NewsCommentModel AST#prim...
public getData(index: number): NewsCommentModel { return this.originDataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L62-L64
d56d0e099374e4800d966c0e01b2a3c432c84ba7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CharUtil.ets
arkts
isBlankChar
判断是否空白符 空白符包括空格、制表符、全角空格和不间断空格 @param c @returns
static isBlankChar(c: number): boolean { return CharUtil.isWhitespace(c.toString()) || CharUtil.isSpaceChar(c.toString()) || c === 0xFEFF || c === 0x202A || c === 0x0000; }
AST#method_declaration#Left static isBlankChar AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#...
static isBlankChar(c: number): boolean { return CharUtil.isWhitespace(c.toString()) || CharUtil.isSpaceChar(c.toString()) || c === 0xFEFF || c === 0x202A || c === 0x0000; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L104-L108
f61ca6566a1d793f271e0f771e211a3d22c93aa6
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
removeMemBox
/ 在内存中删除box
removeMemBox(box: Box): void { this.boxes = this.boxes.filter((b) => !b.equals(box)); }
AST#method_declaration#Left removeMemBox AST#parameter_list#Left ( AST#parameter#Left box : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#...
removeMemBox(box: Box): void { this.boxes = this.boxes.filter((b) => !b.equals(box)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L199-L201
7699abb5926151d53b0ec5feb8408649681e92f4
github
Glace-Dev/Harmony_Projects.git
845cef3c5fdf5d049c942fe62cbf083c2c78e84a
basis/entry/src/main/ets/pages/ItemPage.ets
arkts
fillScreen
局部公开样式函数
@Styles fillScreen() { .width('100%') .height('100%') .backgroundColor('#EFEFEF') .padding(20) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right fillScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#exp...
@Styles fillScreen() { .width('100%') .height('100%') .backgroundColor('#EFEFEF') .padding(20) }
https://github.com/Glace-Dev/Harmony_Projects.git/blob/845cef3c5fdf5d049c942fe62cbf083c2c78e84a/basis/entry/src/main/ets/pages/ItemPage.ets#L131-L136
0ac66e489ff29be5e651fd6f56ad34b5b3e7fdb1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfBusinessCodeInterceptor.ets
arkts
getValueFromJsonFragment
解析 JSON 片段并提取值 @param jsonFragment 提取的json片段 @param key 待提取的key @returns
getValueFromJsonFragment(jsonFragment: string, key: string): Object | null { try { // 因为 jsonFragment 可能是键值对的一部分,需要添加大括号来形成合法的 JSON const fragmentObject: Record<string, Object> = JSON.parse(`{${jsonFragment}}`); return fragmentObject[key]; } catch (error) { console.error('提起json的key错误:',...
AST#method_declaration#Left getValueFromJsonFragment AST#parameter_list#Left ( AST#parameter#Left jsonFragment : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST...
getValueFromJsonFragment(jsonFragment: string, key: string): Object | null { try { const fragmentObject: Record<string, Object> = JSON.parse(`{${jsonFragment}}`); return fragmentObject[key]; } catch (error) { console.error('提起json的key错误:', error); return null; } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfBusinessCodeInterceptor.ets#L106-L115
09ed7c016acfdf58ef316200024f4aa13a4b6912
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/popup/popup.ets
arkts
PopupBuilder
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 PopupBuilder(name: string, param: Object) { PopupExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PopupBuilder 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 PopupBuilder(name: string, param: Object) { PopupExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/popup/popup.ets#L16-L19
cdcedd7d7d5b7cd0ccc74136d25c203549087a19
gitee