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
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
isAxisMaxCustom
Returns true if the axis max value has been customized (and is not calculated automatically) @return
public isAxisMaxCustom(): boolean { return this.mCustomAxisMax; }
AST#method_declaration#Left public isAxisMaxCustom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
public isAxisMaxCustom(): boolean { return this.mCustomAxisMax; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L702-L704
488b19300774dc5a9927794edadcf0774ba4b2fa
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDeleteBulk.ets
arkts
应用约束:使用ES6导出(错误60)
export default MessageDeleteBulkAction;
AST#export_declaration#Left export default AST#expression#Left MessageDeleteBulkAction AST#expression#Right ; AST#export_declaration#Right
export default MessageDeleteBulkAction;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDeleteBulk.ets#L36-L36
b6dc3a8275e9e51e81599ba0feca1476e0439f2d
github
hackeris/HiSH
6485c7b24ee47727fe464dc3a69484f44689e85b
entry/src/main/ets/pages/VncPage.ets
arkts
aboutToAppear
默认值,实际应从参数获取
aboutToAppear() { const params = router.getParams() as VncPageParams; if (params && params.vncPort) { this.vncPort = params.vncPort; } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Le...
aboutToAppear() { const params = router.getParams() as VncPageParams; if (params && params.vncPort) { this.vncPort = params.vncPort; } }
https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/pages/VncPage.ets#L17-L22
cf59a5e043fed214d4e0544416b7f0bb390a7721
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getDateInfo
获取日期信息
private getDateInfo(week: number, dayOfWeek: number): DateInfo { const daysInMonth: number = new Date(this.currentYear, this.currentMonth, 0).getDate(); const firstDayWeekday: number = new Date(this.currentYear, this.currentMonth - 1, 1).getDay(); const today: Date = new Date(); const isCurrentMonth: bo...
AST#method_declaration#Left private getDateInfo AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOfWeek : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
private getDateInfo(week: number, dayOfWeek: number): DateInfo { const daysInMonth: number = new Date(this.currentYear, this.currentMonth, 0).getDate(); const firstDayWeekday: number = new Date(this.currentYear, this.currentMonth - 1, 1).getDay(); const today: Date = new Date(); const isCurrentMonth: bo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4156-L4175
6fef101d6c0b1303f01a0a6c6914791fa1ebb31d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LRUCacheUtil.ets
arkts
updateCapacity
重新设置lruCache的容量 @param newCapacity
public updateCapacity(newCapacity: number) { this.lruCache.updateCapacity(newCapacity); }
AST#method_declaration#Left public updateCapacity AST#parameter_list#Left ( AST#parameter#Left newCapacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Lef...
public updateCapacity(newCapacity: number) { this.lruCache.updateCapacity(newCapacity); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L99-L101
abbb7b89f19cbcad6f64cd373ed839594b669b27
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieDataSet.ets
arkts
private entry:JArrayList<PieEntry> = new JArrayList<PieEntry>()
constructor(yVals: JArrayList<PieEntry>, label: string) { super(yVals, label); // mShift = Utils.convertDpToPixel(12f); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieEntry AST#primary_type#Right AST#type_annotation#Right > AST#type_...
constructor(yVals: JArrayList<PieEntry>, label: string) { super(yVals, label); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L45-L48
01f251867fb0f930b72aeb3550a710fadf8d017d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/network/NetworkResponse.ets
arkts
构造函数,对接口返回做空值兜底 @param {Partial<NetworkResponse<T>>} payload - 接口原始数据
constructor(payload?: Partial<NetworkResponse<T>>) { this.data = payload?.data ?? null; this.code = payload?.code !== undefined ? Number(payload.code) : 1000; this.message = payload?.message ?? null; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left payload ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#...
constructor(payload?: Partial<NetworkResponse<T>>) { this.data = payload?.data ?? null; this.code = payload?.code !== undefined ? Number(payload.code) : 1000; this.message = payload?.message ?? null; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkResponse.ets#L23-L27
46a3e4e6b8459b85e0d7faab51a47ff3485b1a36
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
条件判断函数类型
export type Predicate<T> = (item: T) => boolean;
AST#export_declaration#Left export AST#type_declaration#Left type Predicate AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary...
export type Predicate<T> = (item: T) => boolean;
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L258-L258
52820b166f8acc8f3154318b969d0ee3a53ea1b9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationUtil.ets
arkts
cancelAllNotifications
cancel all notification
async cancelAllNotifications() { try { await notificationManager.cancelAll(); Logger.info(TAG, `cancel all success`); } catch (err) { if (err) { Logger.info(TAG, `cancel all err ${JSON.stringify(err)}`); } } }
AST#method_declaration#Left async cancelAllNotifications 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#call_expression#Left AST#expression#L...
async cancelAllNotifications() { try { await notificationManager.cancelAll(); Logger.info(TAG, `cancel all success`); } catch (err) { if (err) { Logger.info(TAG, `cancel all err ${JSON.stringify(err)}`); } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationUtil.ets#L84-L93
1b595c000271f221a50895ebb71cb42470962078
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
buildAnimationSection
构建动画设置
@Builder buildAnimationSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('动画设置') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) this.buildSwitchItem('启用动画', this.animatio...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAnimationSection 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 Card ( ) AST#container_content_body#Left { AST#arkts...
@Builder buildAnimationSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('动画设置') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) this.buildSwitchItem('启用动画', this.animatio...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L628-L674
bdc814ac999f1fb184427b2d0ef05bd451a097ac
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
refreshUserInfo
从网络刷新用户信息 @returns {void} 无返回值 @example getUserState().refreshUserInfo();
refreshUserInfo(): void { if (!this.isLoggedIn()) { return; } RequestHelper.repository(new UserInfoRepository().getPersonInfo()) .execute() .then((userInfo: User): void => { this.updateUserInfo(userInfo); }); }
AST#method_declaration#Left refreshUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AS...
refreshUserInfo(): void { if (!this.isLoggedIn()) { return; } RequestHelper.repository(new UserInfoRepository().getPersonInfo()) .execute() .then((userInfo: User): void => { this.updateUserInfo(userInfo); }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L107-L116
42bab54a9bf5351025b911c196aa880f6e167909
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getDistrictByNameSync
根据市名获取下面的区县 @param cityName 市名 @returns
static getDistrictByNameSync(cityName: string): Array<AreaEntity> { let list = AreaHelper.getAreaSync(); for (let index = 0; index < list.length; index++) { let cityList = list[index].children ?? []; for (let i = 0; i < cityList.length; i++) { if (cityName == cityList[i].text) { re...
AST#method_declaration#Left static getDistrictByNameSync 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 getDistrictByNameSync(cityName: string): Array<AreaEntity> { let list = AreaHelper.getAreaSync(); for (let index = 0; index < list.length; index++) { let cityList = list[index].children ?? []; for (let i = 0; i < cityList.length; i++) { if (cityName == cityList[i].text) { re...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L109-L120
beadc9c2aa775155ce18be19508f2c92bfc6f772
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/ImageDialogView.ets
arkts
ImageDialogView
图片弹窗组件 @author pll @create 2025-05-20 @modify 2025-05-28
@ComponentV2 export struct ImageDialogView { @Require @Param options: IImageDialogOptions; build() { this.buildContent() } @Builder buildContent() { Image(this.options.imageURI) .width(this.options.style?.width ?? '100%') .height(this.options.style?.height ?? 'auto') .draggable(fal...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ImageDialogView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#primary_...
@ComponentV2 export struct ImageDialogView { @Require @Param options: IImageDialogOptions; build() { this.buildContent() } @Builder buildContent() { Image(this.options.imageURI) .width(this.options.style?.width ?? '100%') .height(this.options.style?.height ?? 'auto') .draggable(fal...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ImageDialogView.ets#L9-L29
4354f083e2d5f13cf728f25fac6dbc4350dac5ec
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/userdata/UserData.ets
arkts
/ 用于服务器上备份和恢复用户数据
export class UserData { userId: number | null = null; bookId: number | null = null; userDataAddr: string | null = null; createDate: Date | null = null; updateDate: Date | null = null; constructor() {} // 从JSON对象解析的静态方法 static fromJson(json: UserDataJson): UserData { const data = new UserDa...
AST#export_declaration#Left export AST#class_declaration#Left class UserData AST#class_body#Left { AST#property_declaration#Left userId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_ann...
export class UserData { userId: number | null = null; bookId: number | null = null; userDataAddr: string | null = null; createDate: Date | null = null; updateDate: Date | null = null; constructor() {} static fromJson(json: UserDataJson): UserData { const data = new UserData(); d...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/userdata/UserData.ets#L23-L52
063e09417456c3376e53ce541ae98df62b23444d
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets
arkts
column统一样式类
export class ColumnModifier implements AttributeModifier<ColumnAttribute> { private paddingNumber: Padding = { left: 20, right: 20 }; private marginNumber: Margin | Length = 0 private topRectHeight = AppStorage.get("topRectHeight") as number private bottomRectHeight = AppStorage.get("bottomRectHeight") as numbe...
AST#export_declaration#Left export AST#class_declaration#Left class ColumnModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
export class ColumnModifier implements AttributeModifier<ColumnAttribute> { private paddingNumber: Padding = { left: 20, right: 20 }; private marginNumber: Margin | Length = 0 private topRectHeight = AppStorage.get("topRectHeight") as number private bottomRectHeight = AppStorage.get("bottomRectHeight") as numbe...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets#L4-L17
b6548e5fe09e472ecd27f9ab8c021575ff291a34
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/EnvironmentMonitoringPage.ets
arkts
checkHumidityStatus
湿度状态判断
function checkHumidityStatus(value: number): string { if (value > HUMIDITY.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < HUMIDITY.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
AST#function_declaration#Left function checkHumidityStatus AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS...
function checkHumidityStatus(value: number): string { if (value > HUMIDITY.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < HUMIDITY.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L60-L67
fd2f4d3a99589aa9928ec6441c1ee1188fe71836
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/web/src/main/ets/WebViewOptions.ets
arkts
@author open_9527 @date 2025/5/16 @desc web 默认配置参数
export class WebViewOptions { /** * 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认开启。 */ domStorageAccess: boolean = true; /** * 设置是否允许执行JavaScript脚本,默认允许执行。 */ javaScriptAccess: boolean = true; /** * 设置是否开启应用中文件系统的访问。$rawfile(filepath/filename)中rawfile路径的文件不受该属性影响而限制访问。 * 从API version 12开始,fileAcce...
AST#export_declaration#Left export AST#class_declaration#Left class WebViewOptions AST#class_body#Left { /** * 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认开启。 */ AST#property_declaration#Left domStorageAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST...
export class WebViewOptions { domStorageAccess: boolean = true; javaScriptAccess: boolean = true; fileAccess: boolean = false; imageAccess: boolean = true; onlineImageAccess: boolean = true; overScrollMode: OverScrollMode = OverScrollMode.NEVER; mixedMode: MixedMode = MixedMode.None ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebViewOptions.ets#L6-L207
9e4638d5e71436742c84e9d1ca657f73c90de4d8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets
arkts
photoShowBuilder
全屏模态展示图片组件
@Builder photoShowBuilder(img: ResourceStr, id: string) { Column() { Image(img) .borderRadius($r('app.integer.card_swiper_photo_radius')) .geometryTransition(id, { follow: true }) .width(this.isTablet ? $r('app.string.card_swiper_tablet_preview_width') : $r('app.string.card_s...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right photoShowBuilder AST#parameter_list#Left ( AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#L...
@Builder photoShowBuilder(img: ResourceStr, id: string) { Column() { Image(img) .borderRadius($r('app.integer.card_swiper_photo_radius')) .geometryTransition(id, { follow: true }) .width(this.isTablet ? $r('app.string.card_swiper_tablet_preview_width') : $r('app.string.card_s...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets#L141-L160
a1cbe5b7c9eb3c93f592cd529ef598f2b7753e2f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
isValidCard
验证身份证号码的有效性 @param id @returns
static isValidCard(id: string): boolean { if (id.length === 18) { const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; id = id.toUpperCase(); const lastChar = id.charAt(17).toUpperCase(); let s...
AST#method_declaration#Left static isValidCard 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 boolean AST#primary_type...
static isValidCard(id: string): boolean { if (id.length === 18) { const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; id = id.toUpperCase(); const lastChar = id.charAt(17).toUpperCase(); let s...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L258-L275
86b13387f8829f1013e3b3895ec35b7ad6f7e400
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala/loader/src/ets/example_canvas.ets
arkts
Index
import { Box } from "@koalaui/arkoala-extension-component"
@Entry @Component export struct Index { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D() build() { Column() { Text("Arkoala Analog Indicator") .fontSize(16) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Index AST#component_body#Left { AST#property_declaration#Left private settings : AST#type_annotation#Left AST#primary_type#Left RenderingContextSettings AST#primary_type#...
@Entry @Component export struct Index { private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D() build() { Column() { Text("Arkoala Analog Indicator") .fontSize(16) ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala/loader/src/ets/example_canvas.ets#L17-L84
a8d26ffffd6c4bc1248636cd799d0072decff022
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/widget/utils/CaseCardUtils.ets
arkts
formatData
案例字符串格式化
public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i <= CASES_MAX_LENGTH; i++) { const cases: CASES = { name: CaseCardUtils.nameFor...
AST#method_declaration#Left public static formatData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar...
public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i <= CASES_MAX_LENGTH; i++) { const cases: CASES = { name: CaseCardUtils.nameFor...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/widget/utils/CaseCardUtils.ets#L28-L43
8baba0c7d11dd6275ecbee92bad7da60736c4ac5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
sendSingleNotification
发送单个通知
private async sendSingleNotification(contact: Contact): Promise<void> { try { const title = '🎂 生日提醒'; const content = `今天是${contact.name}的生日,记得送上祝福哦!`; promptAction.showToast({ message: content, duration: 3000 }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_...
AST#method_declaration#Left private async sendSingleNotification AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
private async sendSingleNotification(contact: Contact): Promise<void> { try { const title = '🎂 生日提醒'; const content = `今天是${contact.name}的生日,记得送上祝福哦!`; promptAction.showToast({ message: content, duration: 3000 }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L412-L426
9ad40aa66c2e9b7f33fc25b3a93b52c8f90e3b41
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/interface/VideoTimeBounds.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, softw...
export interface VideoTimeBounds { minTime: number; maxTime: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface VideoTimeBounds AST#object_type#Left { AST#type_member#Left minTime : 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 maxTime : AST#type_annotat...
export interface VideoTimeBounds { minTime: number; maxTime: number; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/interface/VideoTimeBounds.ets#L15-L20
16b630c1778e8a478c477cb55e6cd38286126df9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/ToastUtil.ets
arkts
showLong
弹出土司,时长为:10s,距离底部默认为80vp @param message 提示消息 @param options (距离屏幕底部的位置、是否显示在应用之上)
static showLong(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 2); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; if (optio...
AST#method_declaration#Left static showLong AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ,...
static showLong(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 2); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; if (optio...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L84-L95
a67514a1e767dfde09f356dcd0a4ab90db07dd19
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
isNull
判断字符串是否为空(undefined、null) @param str 被检测的字符串 @returns 是否为空
static isNull(str: string | undefined | null): boolean { return str === undefined || str === null; }
AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right ...
static isNull(str: string | undefined | null): boolean { return str === undefined || str === null; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L15-L17
9c93595e67a25383367fe624499f7de17aa517c0
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSImageCodec/entry/src/main/ets/pages/Index.ets
arkts
decode
解码
private decode(){ let uri = 'https://waylau.com/images/waylau_181_181.jpg'; // 设置创建imagesource的路径 let imageSource = image.createImageSource(uri) let options = {alphaType: 0, // 透明度 editable: false, // 是否可编辑 pixelFormat: 3, // 像素格式 scal...
AST#method_declaration#Left private decode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left 'https://waylau.com/images/waylau_181_181.jpg' AST#expression#Right AST#variable_declarat...
private decode(){ let uri = 'https://waylau.com/images/waylau_181_181.jpg'; let imageSource = image.createImageSource(uri) let options = {alphaType: 0, editable: false, pixelFormat: 3, scaleMode: 1, size:...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSImageCodec/entry/src/main/ets/pages/Index.ets#L55-L66
1f5a14de5fd919427cdac7017633a5d379e12ea4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
LogisticsInfoCard
物流信息卡片 @param {Logistics} logistics - 物流信息 @returns {void} 无返回值
@Builder private LogisticsInfoCard(logistics: Logistics): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.LogisticsInfoTitle(), ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LogisticsInfoCard AST#parameter_list#Left ( AST#parameter#Left logistics : AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#t...
@Builder private LogisticsInfoCard(logistics: Logistics): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.LogisticsInfoTitle(), ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L110-L155
555b11cb765e3f171cc972034f822b20b4062bf7
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/IToastOptions.ets
arkts
Toast吐司参数
export interface IToastOptions { //extends promptAction.ShowToastOptions { uiContext?: UIContext /** * Text to display. * * @type { string | Resource } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text to display. * * @type { string | Resource } * @syscap SystemCap...
AST#export_declaration#Left export AST#interface_declaration#Left interface IToastOptions AST#object_type#Left { //extends promptAction.ShowToastOptions { AST#type_member#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /*...
export interface IToastOptions { uiContext?: UIContext message?: string | Resource; duration?: number; bottom?: string | number; showMode?: promptAction.ToastShowMode; alignment?: Alignment; offset?: Offset; backgroundColor?: ResourceColor; textColo...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/IToastOptions.ets#L7-L202
6c8d5e30ae2947a620a055d67cf1b142d7972a78
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/Index.ets
arkts
BottomDrawerSlideCase
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 { BottomDrawerSlideCase } from './src/main/ets/view/BottomDrawerSlideCase';
AST#export_declaration#Left export { BottomDrawerSlideCase } from './src/main/ets/view/BottomDrawerSlideCase' ; AST#export_declaration#Right
export { BottomDrawerSlideCase } from './src/main/ets/view/BottomDrawerSlideCase';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/Index.ets#L15-L15
598c3857a5d6da4209625ceca05422341bb79492
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PreferencesUtils.ets
arkts
getPreferences
获取Preferences实例 @param name @returns
private static async getPreferences(name: string = defaultPreferenceName): Promise<preferences.Preferences> { return dataPreferences.getPreferences(AppUtils.getContext().getApplicationContext(), name); }
AST#method_declaration#Left private static async getPreferences 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#expression#Left defaultPreferenceName AST#expression#Right AST#parameter#Right ) AST#parameter_...
private static async getPreferences(name: string = defaultPreferenceName): Promise<preferences.Preferences> { return dataPreferences.getPreferences(AppUtils.getContext().getApplicationContext(), name); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L167-L169
a1e749c02d67ff4eb7d80693525741e0a94b95d2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
getMessagePage
分页查询消息 @param params 分页查询消息请求参数 @returns 消息分页数据
async getMessagePage(params: MessagePageRequest): Promise<NetworkResponse<NetworkPageData<CsMsg>>> { return this.networkDataSource.getMessagePage(params); }
AST#method_declaration#Left async getMessagePage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left MessagePageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge...
async getMessagePage(params: MessagePageRequest): Promise<NetworkResponse<NetworkPageData<CsMsg>>> { return this.networkDataSource.getMessagePage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L52-L54
0f389c14696643033996ced633e6bbc5efa31173
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/videomanager/AvPlayManager.ets
arkts
initPlayer
初始化视频
async initPlayer(surfaceId: string, callback: (avPlayer: media.AVPlayer) => void): Promise<void> { Logger.info(this.tag, 'initPlayer==initCamera surfaceId== ${surfaceId}'); this.surfaceID = surfaceId; Logger.info(this.tag, 'initPlayer==this.surfaceID surfaceId== ${this.surfaceID}'); try { Logger.i...
AST#method_declaration#Left async initPlayer AST#parameter_list#Left ( AST#parameter#Left surfaceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_l...
async initPlayer(surfaceId: string, callback: (avPlayer: media.AVPlayer) => void): Promise<void> { Logger.info(this.tag, 'initPlayer==initCamera surfaceId== ${surfaceId}'); this.surfaceID = surfaceId; Logger.info(this.tag, 'initPlayer==this.surfaceID surfaceId== ${this.surfaceID}'); try { Logger.i...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/videomanager/AvPlayManager.ets#L43-L62
aea758b01a210d7d76f54030caff94e90943610e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
TODO 资源工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ResUtil { /** * 获取提供访问应用资源的能力 * @returns */ static getResourceManager(): resourceManager.ResourceManager { return AppUtil.getContext().resourceManager; } /** * 获取指定资源对应的布尔结果 * @param resId 资源ID值/资源信息 * @returns */ static getBoolean(resId: number | Resource): boolean {...
AST#export_declaration#Left export AST#class_declaration#Left class ResUtil AST#class_body#Left { /** * 获取提供访问应用资源的能力 * @returns */ AST#method_declaration#Left static getResourceManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left...
export class ResUtil { static getResourceManager(): resourceManager.ResourceManager { return AppUtil.getContext().resourceManager; } static getBoolean(resId: number | Resource): boolean { if (typeof resId === 'number') { return ResUtil.getResourceManager().getBoolean(resId); } else { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L27-L571
6b308088feb6b0973c286d9e6881f208b8e658bd
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/context_sensitive/multi_invoke/multi_invoke_002_F.ets
arkts
Introduction 多次调用
export function multi_invoke_002_F(taint_src : string) { let a = f(taint_src); let b = f("_"); taint.Sink(b); }
AST#export_declaration#Left export AST#function_declaration#Left function multi_invoke_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function multi_invoke_002_F(taint_src : string) { let a = f(taint_src); let b = f("_"); taint.Sink(b); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/context_sensitive/multi_invoke/multi_invoke_002_F.ets#L6-L10
2b7ec692770d21de3728f7ddb60ee72dd9112e37
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_001_T/cross_file_001_T_a.ets
arkts
Introduction export/import
export function cross_file_001_T_a (taint_src : string) { return taint_src }
AST#export_declaration#Left export AST#function_declaration#Left function cross_file_001_T_a AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function cross_file_001_T_a (taint_src : string) { return taint_src }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_001_T/cross_file_001_T_a.ets#L5-L7
334abda67babcf179d49fdf73b7bf338073e801f
github
seasonZhu/HarmonyStudy.git
b55e58c962e9b39d5211337590bdd45f2c2349b3
entry/src/main/ets/views/InfoCell.ets
arkts
articleCell
/ 用于首页与公众号
@Builder private articleCell() { Column() { //作者和TAG、时间 Row() { Text(this.getAuthorName()) .fontSize(12) this.tagComponent() Blank() Text(this.article.niceShareDate) .fontSize(12) .margin({ left: 8, }) } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private articleCell 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#ui_component#Right AST#ERROR#Left { //作...
@Builder private articleCell() { Column() { Row() { Text(this.getAuthorName()) .fontSize(12) this.tagComponent() Blank() Text(this.article.niceShareDate) .fontSize(12) .margin({ left: 8, }) } .width('100...
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/views/InfoCell.ets#L43-L72
87bd73acbb39a61f4ae157004efbd6bcb3c22073
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets
arkts
digestSHA384
SHA384摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digestSHA384(str: string): Promise<OutDTO<string>> { return CryptoUtil.digest(str, 'SHA384'); }
AST#method_declaration#Left static async digestSHA384 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async digestSHA384(str: string): Promise<OutDTO<string>> { return CryptoUtil.digest(str, 'SHA384'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets#L60-L62
d2221626dc5d123d084df74e68e2d0c50b5bb3fe
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets
arkts
setInternetVideo
Scan the internet video. @param name Video Name. @param pixelMap pixelMap object. @param src Playback Path. @param duration Video duration. @return Network video list data.
async setInternetVideo(name: string, src: string, pixelMap?: image.PixelMap) { this.videoInternetList.push(new VideoItem(name, {} as resourceManager.RawFileDescriptor, src, pixelMap)); let videoInternetList = this.videoInternetList; GlobalContext.getContext().setObject('videoInternetList', videoInternetList...
AST#method_declaration#Left async setInternetVideo 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 src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
async setInternetVideo(name: string, src: string, pixelMap?: image.PixelMap) { this.videoInternetList.push(new VideoItem(name, {} as resourceManager.RawFileDescriptor, src, pixelMap)); let videoInternetList = this.videoInternetList; GlobalContext.getContext().setObject('videoInternetList', videoInternetList...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets#L58-L63
f028d53651982a4c1006b78b52d9eeca1ddeddf6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
closeCustomDialog
关闭已弹出的dialogContent对应的自定义弹窗 @param dialogId
static closeCustomDialog(dialogId: string) { try { const promptActionArg = DialogUtils.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext) { const promptAction = promptActionArg.uiContext.getPromptAction(); const componentContent = promptActionArg.componentContent; ...
AST#method_declaration#Left static closeCustomDialog AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_stateme...
static closeCustomDialog(dialogId: string) { try { const promptActionArg = DialogUtils.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext) { const promptAction = promptActionArg.uiContext.getPromptAction(); const componentContent = promptActionArg.componentContent; ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L112-L128
4b9d939829d67c26c3bc9c3277013b10488bc14c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
defaultConfig
默认的配置
defaultConfig() { DialogHelper.setDefaultConfig((config) => { config.autoCancel = true; //点击遮障层时,是否关闭弹窗,true表示关闭弹窗。false表示不关闭弹窗。默认值:true config.backCancel = true; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。true表示关闭弹窗。false表示不关闭弹窗。默认值:true。 config.actionCancel = true; //点击操作按钮时,是否关闭弹窗。false表示不...
AST#method_declaration#Left defaultConfig AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . setDefaultConf...
defaultConfig() { DialogHelper.setDefaultConfig((config) => { config.autoCancel = true; config.backCancel = true; config.actionCancel = true; config.alignment = DialogAlignment.Default; config.offset = { dx: 0, dy: 0 }; config.maskColor = 0x33000000; config.background...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L147-L184
969770db61f053f040a9909b640d1efb68ac4aee
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/applicationexception/Index.ets
arkts
ApplicationExceptionView
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 { ApplicationExceptionView } from './src/main/ets/view/ApplicationException';
AST#export_declaration#Left export { ApplicationExceptionView } from './src/main/ets/view/ApplicationException' ; AST#export_declaration#Right
export { ApplicationExceptionView } from './src/main/ets/view/ApplicationException';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/Index.ets#L15-L15
6485afd878a697cc54936199e0403967309fc3e0
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets
arkts
setDrawHighlightIndicators
Enables / disables both vertical and horizontal highlight-indicators. @param enabled
public setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
AST#method_declaration#Left public setDrawHighlightIndicators AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi...
public setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets#L56-L59
023331de94b65e12f6516ec8dbce9b8aff0a15a2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
locationItem
用于显示选择的省、市、区名 @param params 传入要显示的省、市、区名
@Builder locationItem(params: Location) { Text(`${params.name === '' ? '请选择' : params.name}`) .height($r('app.string.custom_address_picker_full_size')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(this.currentIndex === params.index ? Constants.FONT_WEIGHT_FIVE_HUNDRE...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right locationItem AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Location AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bod...
@Builder locationItem(params: Location) { Text(`${params.name === '' ? '请选择' : params.name}`) .height($r('app.string.custom_address_picker_full_size')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(this.currentIndex === params.index ? Constants.FONT_WEIGHT_FIVE_HUNDRE...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L198-L225
b9f66159a7a73d40c14d0ead6d7203c8429a1fb1
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
compareDate
比较指定日期相差的毫秒数 @param date1 @param date2 @param abs 是否绝对值
static compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number { const dateTime1: number = DateUtils.getFormatDate(date1).getTime(); const dateTime2: number = DateUtils.getFormatDate(date2).getTime(); const diff = dateTime2 - dateTime1; return abs ? Math.a...
AST#method_declaration#Left static compareDate AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri...
static compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number { const dateTime1: number = DateUtils.getFormatDate(date1).getTime(); const dateTime2: number = DateUtils.getFormatDate(date2).getTime(); const diff = dateTime2 - dateTime1; return abs ? Math.a...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L246-L251
f804633da3e5c1257ac94242f1e66bbfee31ec36
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/PermissionOverwrites.ets
arkts
约束61:不支持export = ...语法,改用export default
export default PermissionOverwrites;
AST#export_declaration#Left export default AST#expression#Left PermissionOverwrites AST#expression#Right ; AST#export_declaration#Right
export default PermissionOverwrites;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PermissionOverwrites.ets#L58-L58
e1db2e381f5050fb4668a5c7767cc0e11036a629
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets
arkts
buildResponse
构建响应对象 @param request 请求 @param isSecurity 是否开启证书校验 @param loading 是否临时控制Loading @returns
private static async buildResponse<E>(request: rcp.Request, cls?: ClassConstructor<E>, securityCfg?: efRcpConfig.securityCfg, loading?: boolean): Promise<EfRcpResponse<E>> { try { //是否针对当前请求开启证书加密 if (securityCfg) { if (request.configuration) { if (securityCfg) { reques...
AST#method_declaration#Left private static async buildResponse AST#type_parameters#Left < AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Request AST#qualifi...
private static async buildResponse<E>(request: rcp.Request, cls?: ClassConstructor<E>, securityCfg?: efRcpConfig.securityCfg, loading?: boolean): Promise<EfRcpResponse<E>> { try { if (securityCfg) { if (request.configuration) { if (securityCfg) { request.configuration....
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L156-L202
77a11f96fec76d8f746cacfcbfd47a66d15c4130
gitee
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/dust/DustMonitorCard.ets
arkts
getStatusText
辅助函数:根据状态返回文本
private getStatusText(status: DustStatus): string { if (status === DustStatus.WARNING) return '警告'; return '正常'; }
AST#method_declaration#Left private getStatusText AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left DustStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
private getStatusText(status: DustStatus): string { if (status === DustStatus.WARNING) return '警告'; return '正常'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L141-L144
effce5da6097f25f1fe32d4a7867ff613aeb4cee
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
通知接口
export interface Notification { id: string; userId: string; type: NotificationType; title: string; content: string; fromUserId?: string; fromUser?: UserProfile; relatedId?: string; // 相关帖子、评论等ID isRead: boolean; createdAt: string; actionUrl?: string; metadata: Record<string, any>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Notification 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 userId : AST#type_annotation#Left ...
export interface Notification { id: string; userId: string; type: NotificationType; title: string; content: string; fromUserId?: string; fromUser?: UserProfile; relatedId?: string; isRead: boolean; createdAt: string; actionUrl?: string; metadata: Record<string, any>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L187-L200
ab8ed7501d6046a9d20e88851d109ca1ac3f7cbc
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
aboutToBeDeleted
页面销毁时清理计时器 @returns {void} 无返回值
aboutToBeDeleted(): void { this.clearSideBarUnlockTimer(); }
AST#method_declaration#Left aboutToBeDeleted 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...
aboutToBeDeleted(): void { this.clearSideBarUnlockTimer(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L188-L190
7d968f8d12929a1de61fd29a6be41f2e2a060500
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
setExtensionServiceManagementListener
get extensionService data
setExtensionServiceManagementListener() { this.serviceInfoList = []; accessibility.getAccessibilityExtensionList('all', 'install').then((data) => { LogUtil.info(`${MODULE_TAG} extensionService data.length: ${data.length} data: ${JSON.stringify(data)}`); if (!data || data.length < 1) { route...
AST#method_declaration#Left setExtensionServiceManagementListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serviceInfoL...
setExtensionServiceManagementListener() { this.serviceInfoList = []; accessibility.getAccessibilityExtensionList('all', 'install').then((data) => { LogUtil.info(`${MODULE_TAG} extensionService data.length: ${data.length} data: ${JSON.stringify(data)}`); if (!data || data.length < 1) { route...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L144-L156
974ac128cdccb46bebfeb5288cc19dd975ee7eb1
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/MessageDialogBuilder.ets
arkts
MessageDialogBuilder
安装流程框构造者 @since 2022-06-05
@CustomDialog export struct MessageDialogBuilder { /** * 内容 */ message: ResourceStr; /** * 控制器 */ controller: CustomDialogController; build() { Column() { Row() { LoadingProgress() .width($r('app.float.message_dialog_loading_progress_width')) .height($r('app...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct MessageDialogBuilder AST#component_body#Left { /** * 内容 */ AST#property_declaration#Left message : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ;...
@CustomDialog export struct MessageDialogBuilder { message: ResourceStr; controller: CustomDialogController; build() { Column() { Row() { LoadingProgress() .width($r('app.float.message_dialog_loading_progress_width')) .height($r('app.float.message_dialog_loading_progr...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/MessageDialogBuilder.ets#L21-L53
e31fd02f6d050155eaa6648987b523332ab7324d
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
setDownLoadEvent
设置下载进度操作 @param uploadEvent 下载进度监听 - efRcpConfig.downloadEvent @returns
setDownLoadEvent(downloadEvent: efRcpConfig.downloadEvent): EfRcp { if (this.cfg.requestConfiguration && this.cfg.requestConfiguration.tracing) { if (this.cfg.requestConfiguration.tracing.httpEventsHandler) { this.cfg.requestConfiguration.tracing.httpEventsHandler.onDownloadProgress = (total...
AST#method_declaration#Left setDownLoadEvent AST#parameter_list#Left ( AST#parameter#Left downloadEvent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . downloadEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#...
setDownLoadEvent(downloadEvent: efRcpConfig.downloadEvent): EfRcp { if (this.cfg.requestConfiguration && this.cfg.requestConfiguration.tracing) { if (this.cfg.requestConfiguration.tracing.httpEventsHandler) { this.cfg.requestConfiguration.tracing.httpEventsHandler.onDownloadProgress = (total...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L339-L365
8bd0a83863771ac1e51a34c2a6d9aa098ab663b6
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
isDrawCustomLabels
检查是否正在使用自定义Labels @returns 当前是否使用自定义Labels的布尔值
public isDrawCustomLabels(): boolean { return this.mUseCustomLabels; }
AST#method_declaration#Left public isDrawCustomLabels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#memb...
public isDrawCustomLabels(): boolean { return this.mUseCustomLabels; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L211-L213
79764fe10963b2d9c1549dd6028ae05a4dad3699
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
startPeriodicCheck
启动定期检查
private startPeriodicCheck(): void { // 每小时检查一次 setInterval(async () => { if (this.shouldPerformPeriodicCheck()) { await this.performPeriodicTasks(); } }, 60 * 60 * 1000); // 每天上午9点发送生日提醒 this.scheduleDailyReminder(); }
AST#method_declaration#Left private startPeriodicCheck AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 每小时检查一次 AST#ui_custom_component_statement#Left setInterval ( AST#expressi...
private startPeriodicCheck(): void { setInterval(async () => { if (this.shouldPerformPeriodicCheck()) { await this.performPeriodicTasks(); } }, 60 * 60 * 1000); this.scheduleDailyReminder(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L480-L490
956e523cbe5c5381c107bd23b7384ebe44d4adc4
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/home/prefer/PreferComponent.ets
arkts
PreferComponent
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/7 20:27 @Version V1.0 @Description Prefer
@Component export struct PreferComponent { @StorageProp(AppStorageKeys.KEY_ACTIVE_INFO) activeInfo?: ActiveInfo = undefined @Builder preferItemBuilder(icon: Resource, title: ResourceStr, callback: Callback<void>) { Row({space: CommonConstants.SPACE_12}) { SymbolGlyph(icon) .fontSize(24) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PreferComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorageKeys AST#expression#Right . KEY_A...
@Component export struct PreferComponent { @StorageProp(AppStorageKeys.KEY_ACTIVE_INFO) activeInfo?: ActiveInfo = undefined @Builder preferItemBuilder(icon: Resource, title: ResourceStr, callback: Callback<void>) { Row({space: CommonConstants.SPACE_12}) { SymbolGlyph(icon) .fontSize(24) ...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/home/prefer/PreferComponent.ets#L15-L135
3b24708fe1328aa404c61515c2c947f173f902c1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/ImageUtil.ets
arkts
pack2FileFromImageSource
将ImageSource图片写入文件 @param source ImageSource图片 @param fd 文件描述符 @param format 目标格式。只支持jpeg、webp、png @returns
static async pack2FileFromImageSource(source: image.ImageSource, fd: number, format: string = 'image/png'): Promise<OutDTO<string>> { //创建图像编码ImagePacker对象 const imagePacker: image.ImagePacker = image.createImagePacker(); //打包参数 let packOpts: image.PackingOption = { format: format, quality: 98 }; ...
AST#method_declaration#Left static async pack2FileFromImageSource AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static async pack2FileFromImageSource(source: image.ImageSource, fd: number, format: string = 'image/png'): Promise<OutDTO<string>> { const imagePacker: image.ImagePacker = image.createImagePacker(); let packOpts: image.PackingOption = { format: format, quality: 98 }; await imagePacker.pa...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L299-L311
60e3355ff08105b601967bf503faee688626f26e
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/api/CommentApi.ets
arkts
排序方式
export enum SortType { RECOMMEND = 1, HOT = 2, TIME = 3, }
AST#export_declaration#Left export AST#enum_declaration#Left enum SortType AST#enum_body#Left { AST#enum_member#Left RECOMMEND = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left HOT = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TIME = AS...
export enum SortType { RECOMMEND = 1, HOT = 2, TIME = 3, }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/api/CommentApi.ets#L16-L20
f86632d31dcd901ba12e7bf7b8c0bae7e2dc2edb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
AVSession管理模块,负责以下业务功能: 1. 创建/销毁AVSession实例 2. 注册AVSession实例业务回调功能 3. 启动/关闭于AVSession共同使用的音频后台任务
export class AVSessionModel { private bindContext?: Context; private session?: AVSessionManager.AVSession; private avSessionTag: string = 'MUSIC_PLAYER'; private avSessionType: AVSessionManager.AVSessionType = 'audio'; private curState: AVSessionManager.AVPlaybackState = { state: AVSessionManager.Playback...
AST#export_declaration#Left export AST#class_declaration#Left class AVSessionModel AST#class_body#Left { AST#property_declaration#Left private bindContext ? : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration...
export class AVSessionModel { private bindContext?: Context; private session?: AVSessionManager.AVSession; private avSessionTag: string = 'MUSIC_PLAYER'; private avSessionType: AVSessionManager.AVSessionType = 'audio'; private curState: AVSessionManager.AVPlaybackState = { state: AVSessionManager.Playback...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L33-L334
af80e3ee5c369d66bd6bb626f0493491cf9fb75b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/social/UserProfilePage.ets
arkts
buildUserInfo
构建用户信息
@Builder buildUserInfo() { if (!this.userProfile) return; Column({ space: 16 }) { // 头像和基本信息 Row({ space: 16 }) { Stack() { if (this.userProfile.avatar) { Image(this.userProfile.avatar) .width('80vp') .height('80vp') .borderR...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expr...
@Builder buildUserInfo() { if (!this.userProfile) return; Column({ space: 16 }) { Row({ space: 16 }) { Stack() { if (this.userProfile.avatar) { Image(this.userProfile.avatar) .width('80vp') .height('80vp') .borderRadius(40) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/UserProfilePage.ets#L149-L196
6d97d118f0f1a9d9797b406d40ddb8e4d95b9dfb
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/special_expression/optional_chaining_operator_001_T.ets
arkts
Introduction 可选链操作符
export function optional_chaining_operator_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a?.data); }
AST#export_declaration#Left export AST#function_declaration#Left function optional_chaining_operator_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bl...
export function optional_chaining_operator_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a?.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/optional_chaining_operator_001_T.ets#L6-L10
fda269c7d0627427b260151886fea99a30410953
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets
arkts
主页路由信息
export const HOME_PAGE: AppRouterInfo = { pageModule: "entry", name: 'EntryView', registerFunction: "" }
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HOME_PAGE : AST#type_annotation#Left AST#primary_type#Left AppRouterInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Lef...
export const HOME_PAGE: AppRouterInfo = { pageModule: "entry", name: 'EntryView', registerFunction: "" }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets#L32-L36
7cd0517b842186b0dc2431b73015e5ed125b24d6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
getWebHeight
获取Web组件高度
getWebHeight() { try { this.webviewController?.runJavaScriptExt('window.innerHeight', (error, result) => { if (error || !result) { return; } if (result.getType() === webview.JsMessageType.NUMBER) { this.webHeight = result.getNumber(); // 获取Web组件高度 } }...
AST#method_declaration#Left getWebHeight 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#call_expression#Left AST#expression#Left AST#member_e...
getWebHeight() { try { this.webviewController?.runJavaScriptExt('window.innerHeight', (error, result) => { if (error || !result) { return; } if (result.getType() === webview.JsMessageType.NUMBER) { this.webHeight = result.getNumber(); } }) } catc...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L170-L183
d769e32bb7fc54d362bf2350f2a917a62495520a
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/primitives/primitives_boolean_002_F.ets
arkts
Introduction 基础数据类型-boolean
export function primitives_boolean_002_F(taint_src : boolean) : void { let _t = taint_src; let _clean = true; taint.Sink(_clean); }
AST#export_declaration#Left export AST#function_declaration#Left function primitives_boolean_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an...
export function primitives_boolean_002_F(taint_src : boolean) : void { let _t = taint_src; let _clean = true; taint.Sink(_clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/primitives/primitives_boolean_002_F.ets#L7-L11
931998242250008230bfe7f71ffc5ee61c5f1aac
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
loadContent
为当前WindowStage加载命名路由页面
private loadContent(path: string) { if (this.subWindow) { // TODO: 知识点: 用loadContentByName为当前窗口加载命名路由页面,通过LocalStorage传递状态属性给加载的页面 this.subWindow.loadContentByName(path, this.Storage, (err: BusinessError) => { if (this.subWindow) { try { this.subWindow.setWindowBackgroundCo...
AST#method_declaration#Left private loadContent AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_st...
private loadContent(path: string) { if (this.subWindow) { this.subWindow.loadContentByName(path, this.Storage, (err: BusinessError) => { if (this.subWindow) { try { this.subWindow.setWindowBackgroundColor(this.maskColor); } catch (exception) { console...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L59-L76
6808c500a0ff1af42338ac25f03342d250704a15
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
pinnedChats
ArkTS doesn't support generator so we cannot merge the iterators into one
pinnedChats(): IterableIterator<Chat> { return this.pinnedChatsMap.values(); }
AST#method_declaration#Left pinnedChats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Chat AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
pinnedChats(): IterableIterator<Chat> { return this.pinnedChatsMap.values(); }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L40-L42
1a2eecbe6a31766772b124fcbccd8133ba7b686c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/Immersive/casesfeature/immersive/src/main/ets/view/GoodsDetails.ets
arkts
GoodsDetails
column间隙
@Component export struct GoodsDetails { @State item: ProductDataModel | undefined = undefined; @Consume navPathStack: NavPathStack; aboutToAppear(): void { this.item = this.navPathStack.getParamByIndex(this.navPathStack.size() - 1) as ProductDataModel; } build() { Stack({ alignContent: Alignment.Top...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GoodsDetails AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right item : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ProductDataModel AST#primar...
@Component export struct GoodsDetails { @State item: ProductDataModel | undefined = undefined; @Consume navPathStack: NavPathStack; aboutToAppear(): void { this.item = this.navPathStack.getParamByIndex(this.navPathStack.size() - 1) as ProductDataModel; } build() { Stack({ alignContent: Alignment.Top...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/Immersive/casesfeature/immersive/src/main/ets/view/GoodsDetails.ets#L22-L105
4592269d9634f0ccedee0c786d3a91e5b143290d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/setting/SettingManager.ets
arkts
restoreSettingsForNonMember
MARK: - 会员 -> 非会员
async restoreSettingsForNonMember(): Promise<void> { this.autoPlaySound = false; this.autoPlaySoundEx = false; this.hideTranslation = false; await this.save(); }
AST#method_declaration#Left async restoreSettingsForNonMember 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...
async restoreSettingsForNonMember(): Promise<void> { this.autoPlaySound = false; this.autoPlaySoundEx = false; this.hideTranslation = false; await this.save(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/setting/SettingManager.ets#L183-L189
e546ac9470d68703a3f4418c14ea3a3f2f8d017a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
MARK: - 常量定义(类似Swift的static let或Kotlin的const val)
export class SearchConstants { // 测试结果常量 static readonly TEST_RESULT_NONE : number = 0; static readonly TEST_RESULT_CORRECT: number = 1; static readonly TEST_RESULT_WRONG : number = 2; // 收藏等级常量 static readonly FAVORITE_LEVEL_0: number = 0; static readonly FAVORITE_LEVEL_1: number = 1; stati...
AST#export_declaration#Left export AST#class_declaration#Left class SearchConstants AST#class_body#Left { // 测试结果常量 AST#property_declaration#Left static readonly TEST_RESULT_NONE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expressi...
export class SearchConstants { static readonly TEST_RESULT_NONE : number = 0; static readonly TEST_RESULT_CORRECT: number = 1; static readonly TEST_RESULT_WRONG : number = 2; static readonly FAVORITE_LEVEL_0: number = 0; static readonly FAVORITE_LEVEL_1: number = 1; static readonly FAVORIT...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L20-L50
50be2faeb2b26ae091d5c1ae6ce7656d97b4e67e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarDataSet.ets
arkts
calcEntryCountIncludingStacks
Calculates the total number of entries this DataSet represents, including stacks. All values belonging to a stack are calculated separately.
private calcEntryCountIncludingStacks(yVals: JList<BarEntry>): void { this.mEntryCountStacks = 0; for (let i = 0; i < yVals.length(); i++) { let vals: number[] | null = yVals.get(i).getYVals(); if (!vals) this.mEntryCountStacks++; else this.mEntryCountStacks += vals.length;...
AST#method_declaration#Left private calcEntryCountIncludingStacks AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#R...
private calcEntryCountIncludingStacks(yVals: JList<BarEntry>): void { this.mEntryCountStacks = 0; for (let i = 0; i < yVals.length(); i++) { let vals: number[] | null = yVals.get(i).getYVals(); if (!vals) this.mEntryCountStacks++; else this.mEntryCountStacks += vals.length;...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L143-L156
0feceeca302964d41df0aa688b813f047a4e2a07
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onDestroy
[StartExclude register_init_scheme]
onDestroy(): void { }
AST#method_declaration#Left onDestroy 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#builder_function_body#Right AST#method_declaration#Right
onDestroy(): void { }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets#L35-L37
4423430d43691482b6eb2fbb72761ea791c07ffa
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/models/index.ets
arkts
学习时间
export interface StudyTimeItem { id: string name: string total: number done: number undone: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface StudyTimeItem 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 name : AST#type_annotation#Left AST...
export interface StudyTimeItem { id: string name: string total: number done: number undone: number }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/models/index.ets#L112-L118
775b3b5afd69f664b20efd5591d88fe4ec1fba5d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * Database store configuration. */ static readonly RDB_STORE_CONFIG: relationalStore.StoreConfig = { name: 'AccountDatabase.db', securityLevel: relationalStore.SecurityLevel.S1, encrypt: false }; /** * SQL statement for creating a account. */ static ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Database store configuration. */ AST#property_declaration#Left static readonly RDB_STORE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreCo...
export default class CommonConstants { static readonly RDB_STORE_CONFIG: relationalStore.StoreConfig = { name: 'AccountDatabase.db', securityLevel: relationalStore.SecurityLevel.S1, encrypt: false }; static readonly CREATE_TABLE_ACCOUNT: string = 'CREATE TABLE IF NOT EXISTS Account ' + '(id INTEGER P...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/constants/CommonConstants.ets#L21-L54
65e404d6796b062644f88014cab0ddec2a960d7a
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/GridSample/entry/src/main/ets/common/bean/GridItemData.ets
arkts
Grid item data.
export class GridItemData { /** * Grid item image. */ image: Resource; /** * Grid item title. */ title: Resource; }
AST#export_declaration#Left export AST#class_declaration#Left class GridItemData AST#class_body#Left { /** * Grid item image. */ AST#property_declaration#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * ...
export class GridItemData { image: Resource; title: Resource; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/GridSample/entry/src/main/ets/common/bean/GridItemData.ets#L4-L14
575adc9f278078439efec53ec90911ae664080bf
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getWorkModeText
获取工作模式显示文本
getWorkModeText(): string { switch (this.workMode) { case WorkMode.ONSITE: return '现场办公'; case WorkMode.REMOTE: return '远程办公'; case WorkMode.HYBRID: return '混合办公'; default: return '未知'; } }
AST#method_declaration#Left getWorkModeText 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left sw...
getWorkModeText(): string { switch (this.workMode) { case WorkMode.ONSITE: return '现场办公'; case WorkMode.REMOTE: return '远程办公'; case WorkMode.HYBRID: return '混合办公'; default: return '未知'; } }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L126-L137
0425c5826dd1cd1f7f03cc2941df1c91c9292f0f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
arkts
GoodsGridItem
商品网格项
@Builder GoodsGridItem(goods: Goods) { Column({ space: AppDimensions.spaceSmall }) { Image(goods.mainPic) .width('100%') .aspectRatio(1) .borderRadius(AppDimensions.radiusSmall) .objectFit(ImageFit.Cover) Column({ space: AppDimensions.spaceXSmall }) { Text(good...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right GoodsGridItem AST#parameter_list#Left ( AST#parameter#Left goods : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L...
@Builder GoodsGridItem(goods: Goods) { Column({ space: AppDimensions.spaceSmall }) { Image(goods.mainPic) .width('100%') .aspectRatio(1) .borderRadius(AppDimensions.radiusSmall) .objectFit(ImageFit.Cover) Column({ space: AppDimensions.spaceXSmall }) { Text(good...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L341-L369
98ad5ac40de463adb8a2fc83bb0794d92a8bae57
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets
arkts
createAvPlayer
Creates a videoPlayer object.
createAvPlayer() { media.createAVPlayer().then((video: media.AVPlayer) => { if (video != null) { this.avPlayer = video; this.bindState(); this.url = this.homeTabModel.src; this.avPlayer.url = this.url; } else { Logger.info(`[HomeDialogModel] createAVPlayer fail`);...
AST#method_declaration#Left createAvPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#...
createAvPlayer() { media.createAVPlayer().then((video: media.AVPlayer) => { if (video != null) { this.avPlayer = video; this.bindState(); this.url = this.homeTabModel.src; this.avPlayer.url = this.url; } else { Logger.info(`[HomeDialogModel] createAVPlayer fail`);...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets#L39-L52
5f952ad475c5232cf94ccfa7b8280ca408b363ef
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSourceImpl.ets
arkts
getSessionDetail
获取会话详情 @returns {Promise<NetworkResponse<CsSession>>} 会话详情
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { const resp: AxiosResponse<NetworkResponse<CsSession>> = await NetworkClient.http.get("cs/session/detail"); return resp.data; }
AST#method_declaration#Left async getSessionDetail AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < ...
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { const resp: AxiosResponse<NetworkResponse<CsSession>> = await NetworkClient.http.get("cs/session/detail"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSourceImpl.ets#L25-L29
b79afaa637f2a213aba8531129a1e059e406231d
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/Utils.ets
arkts
truncateText
Truncate text with ellipsis @param text - Text to truncate @param maxLength - Maximum length @returns Truncated text
static truncateText(text: string, maxLength: number): string { if (text.length <= maxLength) { return text; } return text.substring(0, maxLength - 3) + '...'; }
AST#method_declaration#Left static truncateText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxLength : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
static truncateText(text: string, maxLength: number): string { if (text.length <= maxLength) { return text; } return text.substring(0, maxLength - 3) + '...'; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Utils.ets#L175-L180
05cdd9e8e566f63f149675a034beeb84e8b30d12
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
setData
存储数据 @param data
public setData(data: T[]) { this.originDataArray = data; }
AST#method_declaration#Left public setData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AS...
public setData(data: T[]) { this.originDataArray = data; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L28-L30
7ffc0bd1818e715835b63996afbe42630d34ed97
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/goods/OrderGoodsCard.ets
arkts
构建订单商品卡片 @returns {void} 无返回值
build(): void { Card() { // 商品标题 IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: this.data.goodsName, isLink: true, hasBorder: true, leftContentWidth: P80, ...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( ) AST#container_content_body#Left { // 商品标题 AST#arkts_ui_element#Left AST...
build(): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: this.data.goodsName, isLink: true, hasBorder: true, leftContentWidth: P80, onCellC...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/OrderGoodsCard.ets#L63-L112
a9773eaaa7a11a23b493ac83ffd58ec6ee0a4a4a
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/TimerPage.ets
arkts
TimerPage
==================== P1: 计时器与秒表页面 ====================
@Component export struct TimerPage { @State mode: 'stopwatch' | 'timer' = 'stopwatch'; // 秒表状态 @State stopwatchTime: number = 0; // 毫秒 @State stopwatchRunning: boolean = false; @State laps: LapRecord[] = []; private stopwatchInterval: number = -1; // 计时器状态 @State timerHours: number = 0; @State timerM...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TimerPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right mode AST#ERROR#Left : 'stopwatch' | 'timer' AST#ERROR#Right = AST#expression#Left 'stopwatch' AST#expres...
@Component export struct TimerPage { @State mode: 'stopwatch' | 'timer' = 'stopwatch'; @State stopwatchTime: number = 0; @State stopwatchRunning: boolean = false; @State laps: LapRecord[] = []; private stopwatchInterval: number = -1; @State timerHours: number = 0; @State timerMinutes: number = 0; ...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TimerPage.ets#L4-L703
556d8cd2af615818c8f55ec5037f63dabea7f13e
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/param/INavAnimationParam.ets
arkts
@author: HHBin @date: 2024-11-14 @desc: 动画转场参数
export interface INavSingleAnimationParam { // 转场动画函数参数 animateParam?: AnimateParam // 起点回调 startCallback?: (modifier: NavAnimationModifier, proxy: NavigationTransitionProxy | undefined) => void // 终点回调 endCallback?: (modifier: NavAnimationModifier, proxy: NavigationTransitionProxy | undefined) => void }
AST#export_declaration#Left export AST#interface_declaration#Left interface INavSingleAnimationParam AST#object_type#Left { // 转场动画函数参数 AST#type_member#Left animateParam ? : AST#type_annotation#Left AST#primary_type#Left AnimateParam AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 起点回调 AST#typ...
export interface INavSingleAnimationParam { animateParam?: AnimateParam startCallback?: (modifier: NavAnimationModifier, proxy: NavigationTransitionProxy | undefined) => void endCallback?: (modifier: NavAnimationModifier, proxy: NavigationTransitionProxy | undefined) => void }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/INavAnimationParam.ets#L11-L18
7fb0a6486de7cc1230d15038abf880a8d7e4e939
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/utils/Toast.ets
arkts
显示toast @param { string } message 显示的信息
export function showToast(message: string) { promptAction.showToast({ message: message || '请求错误', duration: 2000, }) }
AST#export_declaration#Left export AST#function_declaration#Left function showToast AST#parameter_list#Left ( AST#parameter#Left message : 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#...
export function showToast(message: string) { promptAction.showToast({ message: message || '请求错误', duration: 2000, }) }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/Toast.ets#L7-L12
a829808534dc47234ad39030549cfc0ba3c44b36
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/common/Constants.ets
arkts
应用常量定义
export class Constants { // 数据库常量 static readonly DB_NAME: string = 'wavecast.db'; static readonly DB_VERSION: number = 2; // 表名 static readonly TABLE_PODCAST: string = 'podcast'; static readonly TABLE_EPISODE: string = 'episode'; static readonly TABLE_QUEUE: string = 'queue'; // Preferences键名 s...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // 数据库常量 AST#property_declaration#Left static readonly DB_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'wavecast.db' AST#expression#R...
export class Constants { static readonly DB_NAME: string = 'wavecast.db'; static readonly DB_VERSION: number = 2; static readonly TABLE_PODCAST: string = 'podcast'; static readonly TABLE_EPISODE: string = 'episode'; static readonly TABLE_QUEUE: string = 'queue'; static readonly PREF_SETTINGS:...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/Constants.ets#L4-L40
066c2636be5f31ef8609f08c64c5445d7b053998
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbility/entry/src/main/ets/pages/Index.ets
arkts
startSecondAbility
TODO 启动SecondAbility
startSecondAbility() { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // UIAbilityContext let wantInfo: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.startability', // bundleName: getContext(context).applicationInfo....
AST#method_declaration#Left startSecondAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#...
startSecondAbility() { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; let wantInfo: Want = { deviceId: '', bundleName: 'com.example.startability', moduleName: 'entry', abilityName: 'SecondAbility', parameters: { ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbility/entry/src/main/ets/pages/Index.ets#L263-L278
b99eb0aabc41d423eb4b30fb0aef6021cb3796f2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
wordsWhenReview
/获取某天的复习words
wordsWhenReview(dayOf: DayOf): WordUser[] { let distances = dayOf.distances(true); return this.wordsFor(dayOf, distances); }
AST#method_declaration#Left wordsWhenReview AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordU...
wordsWhenReview(dayOf: DayOf): WordUser[] { let distances = dayOf.distances(true); return this.wordsFor(dayOf, distances); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L350-L353
543840cbc53d0d24093bc5e33e1527d356b975a4
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/BackContainer.ets
arkts
BackContainer
定义 BackContainer 组件
@Component export default struct BackContainer { // 设置标题,默认值为 "app.string.new_alarm",可以在构建时自定义 private header: string | Resource = $r('app.string.new_alarm'); // 设置返回按钮的图像资源,默认为 "app.media.ic_cancel",可以在构建时自定义 private backImgRes?: string | Resource = $r('app.media.ic_cancel'); // 定义返回按钮的点击事件,默认为空,可以在构建时自定义 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct BackContainer AST#component_body#Left { // 设置标题,默认值为 "app.string.new_alarm",可以在构建时自定义 AST#property_declaration#Left private header : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AS...
@Component export default struct BackContainer { private header: string | Resource = $r('app.string.new_alarm'); private backImgRes?: string | Resource = $r('app.media.ic_cancel'); private backFunc?: () => void; @BuilderParam closer?: () => void = () => null; build() { Row() { ...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/BackContainer.ets#L7-L64
35122acb3dcb8f11110e208ccfd4be10344f3ec5
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets
arkts
通用文件节点打开 @param path
export function fileOpen(path: string): String { if (!isAccess(path)) { return 'null'; } try { var fd = -1; fd = fileio.openSync(path, 0o0); let buf = new ArrayBuffer(BUFF_SIZE); fileio.readSync(fd, buf); var result: String = String.fromCharCode.apply(null, new Uint8Array(buf)); retur...
AST#export_declaration#Left export AST#function_declaration#Left function fileOpen AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
export function fileOpen(path: string): String { if (!isAccess(path)) { return 'null'; } try { var fd = -1; fd = fileio.openSync(path, 0o0); let buf = new ArrayBuffer(BUFF_SIZE); fileio.readSync(fd, buf); var result: String = String.fromCharCode.apply(null, new Uint8Array(buf)); retur...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets#L45-L67
60521f7e9a2c1f1626caeb717899ebdf9f928fe7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multimodaltransion/src/main/ets/model/CaptchaLogin.ets
arkts
CaptchaLogin
子元素的间距
@Component export struct CaptchaLogin { /** * isPresentInLoginView控制登录页面是否显示,通过isDefaultLogin控制两种登录组件的条件渲染:true(手机验证码登录),false(二维码登录) * 子组件中被@Link装饰的变量与其父组件中@State装饰的对应数据源建立双向数据绑定,详见: * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-link-0000001820999565 */ // 控制半模态的展示 @Link isPre...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CaptchaLogin AST#component_body#Left { /** * isPresentInLoginView控制登录页面是否显示,通过isDefaultLogin控制两种登录组件的条件渲染:true(手机验证码登录),false(二维码登录) * 子组件中被@Link装饰的变量与其父组件中@State装饰的对应数据源建立双向数据绑定,详见: * https://developer.huawe...
@Component export struct CaptchaLogin { @Link isPresent: boolean; @Link isPresentInLoginView: boolean; @State isDefaultLogin: boolean = true; @State op: number = 0.5; isConfirmed: boolean = false; @Link isShowTransition: boolean; private effect1: TransitionEffect = TransitionEf...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/src/main/ets/model/CaptchaLogin.ets#L24-L59
f86eb9635ea03ec847246cc03223a5bb46bddbd3
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/state/src/main/ets/UserState.ets
arkts
UserState
全局用户状态
@ObservedV2 export class UserState { /** * 认证信息 */ @Type(Auth) @Trace private auth: Auth = new Auth(); /** * 用户信息 */ @Type(User) @Trace private userInfo: User = new User(); /** * 更新用户登录状态(认证 + 用户信息) * @param {Auth} auth - 认证信息 * @param {User} user - 用户信息 * @returns {void} 无返回值...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class UserState AST#class_body#Left { /** * 认证信息 */ AST#property_declaration#Left AST#decorator#Left @ Type ( AST#expression#Left Auth AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Trace AST#decorato...
@ObservedV2 export class UserState { @Type(Auth) @Trace private auth: Auth = new Auth(); @Type(User) @Trace private userInfo: User = new User(); updateUserState(auth: Auth, user: User): void { this.auth = Auth.fromResponse(auth); this.userInfo = User.fromResponse(user); new TokenStor...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/state/src/main/ets/UserState.ets#L20-L173
2df683522182291f30225a8dc7112848f52de4fd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
完整农历计算引擎 (1900-2100年)
export class LunarCalendar { private static readonly monthNames = [ '', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月' ]; private static readonly dayNames = [ '', '初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十...
AST#export_declaration#Left export AST#class_declaration#Left class LunarCalendar AST#class_body#Left { AST#property_declaration#Left private static readonly monthNames = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '' AST#expression#Right , AST#expression#Left '正月' AST#expression#Right , AST#expres...
export class LunarCalendar { private static readonly monthNames = [ '', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月' ]; private static readonly dayNames = [ '', '初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L206-L678
a2b7e3d5a6da17f1a2e74cbf85f27ac2d1bf7247
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowAppSettings.ets
arkts
refresh_history_index_size
Refreshes history index size and stores the value into settings.
refresh_history_index_size() { if (this.calculating_history_index_size) { return; } this.calculating_history_index_size = true; get_sandbox_folder_size('history-index', true).then(result => { this.history_index_size = result; bunch_of_settings.set('history_index_size', this.history_ind...
AST#method_declaration#Left refresh_history_index_size AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculating_history_index_size AST#member_ex...
refresh_history_index_size() { if (this.calculating_history_index_size) { return; } this.calculating_history_index_size = true; get_sandbox_folder_size('history-index', true).then(result => { this.history_index_size = result; bunch_of_settings.set('history_index_size', this.history_ind...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowAppSettings.ets#L1705-L1715
66d10489d9da046b04922e03c04f9fcfb34f2cd6
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildFilterButton
筛选按钮
@Builder buildFilterButton(label: string, value: string, isActive: boolean) { Text(label) .fontSize(12) .fontColor(isActive ? this.COLORS.whitePrimary : this.COLORS.textSecondary) .padding({ left: 12, right: 12, top: 6, bottom: 6 }) .backgroundColor(isActive ? this.COLORS.primary : this.CO...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterButton AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#...
@Builder buildFilterButton(label: string, value: string, isActive: boolean) { Text(label) .fontSize(12) .fontColor(isActive ? this.COLORS.whitePrimary : this.COLORS.textSecondary) .padding({ left: 12, right: 12, top: 6, bottom: 6 }) .backgroundColor(isActive ? this.COLORS.primary : this.CO...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1917-L1928
0bd84f3813ee66238b2247a0a8bb42cfd8caccc1
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/dialog/ConfirmDialog.ets
arkts
initConfirm
------------------------- 保护、私有方法 protected | private methods -------------------------
private initConfirm(options: IConfirmDialogOptions): IConfirmDialogOptions { if (options.primaryButton) { options.primaryButton = this.initButton(options, options.primaryButton, false, 0) as ButtonOptions } if (options.secondaryButton) { options.secondaryButton = this.initButton(options, options...
AST#method_declaration#Left private initConfirm AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ICo...
private initConfirm(options: IConfirmDialogOptions): IConfirmDialogOptions { if (options.primaryButton) { options.primaryButton = this.initButton(options, options.primaryButton, false, 0) as ButtonOptions } if (options.secondaryButton) { options.secondaryButton = this.initButton(options, options...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/ConfirmDialog.ets#L22-L31
ebf6ee37382eedcd27a89dcaa4fc5cab9f70e49e
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets
arkts
generateTransformedValuesCandle
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the CANDLESTICKCHART. @param data @return
public generateTransformedValuesCandle( data: ICandleDataSet, phaseX: number, phaseY: number, froms: number, to: number ): number[] { const count: number = ((to - froms) * phaseX + 1) * 2; if (this.valuePointsForGenerateTransformedValuesCandle.length != count) { this.valuePointsForG...
AST#method_declaration#Left public generateTransformedValuesCandle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ICandleDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_typ...
public generateTransformedValuesCandle( data: ICandleDataSet, phaseX: number, phaseY: number, froms: number, to: number ): number[] { const count: number = ((to - froms) * phaseX + 1) * 2; if (this.valuePointsForGenerateTransformedValuesCandle.length != count) { this.valuePointsForG...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L217-L234
dc5b4494ef320918e2c70f019708557cd07c354d
gitee
wovp/weather.git
3ca685d43036b9ce79257dac3e237c9935709501
entry/src/main/ets/utils/HttpUtil.ets
arkts
Initiates an HTTP request to a given URL. @param url URL for initiating an HTTP request. @returns the result of HTTPS.
export function httpWeatherGet(url: string) { if (!url) { return undefined; } let request = http.createHttp(); let appcode = '?' let querys = "?" let options = { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'Authorization': 'APPCODE ' + appcode, }...
AST#export_declaration#Left export AST#function_declaration#Left function httpWeatherGet AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST...
export function httpWeatherGet(url: string) { if (!url) { return undefined; } let request = http.createHttp(); let appcode = '?' let querys = "?" let options = { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'Authorization': 'APPCODE ' + appcode, }...
https://github.com/wovp/weather.git/blob/3ca685d43036b9ce79257dac3e237c9935709501/entry/src/main/ets/utils/HttpUtil.ets#L24-L42
508184e1acd0e5ae251f322eacb50891a1b310e8
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/viewmodel/AccountList.ets
arkts
定义收入列表
export const EarnList: Array<AccountClassification> = [ { icon: $rawfile('income.png'), iconSelected: $rawfile('income_selected.png'), accountType: 1, typeText: '工作收入' }, { icon: $rawfile('invest.png'), iconSelected: $rawfile('invest_selected.png'), accountType: 1, typeText: '投资' ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EarnList : 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 AccountClassification AST#primary_type#Right AST#type_annotat...
export const EarnList: Array<AccountClassification> = [ { icon: $rawfile('income.png'), iconSelected: $rawfile('income_selected.png'), accountType: 1, typeText: '工作收入' }, { icon: $rawfile('invest.png'), iconSelected: $rawfile('invest_selected.png'), accountType: 1, typeText: '投资' ...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/viewmodel/AccountList.ets#L47-L60
017b4d17963189d1f4b1df60196c2c5823c519ee
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets
arkts
onLoginSuccess
登录成功处理 @param {Auth} authData - 认证数据 @returns {Promise<void>} Promise<void>
private async onLoginSuccess(authData: Auth): Promise<void> { await this.saveCredentials(this.account, this.password); this.userState.updateAuth(authData); this.userState.refreshUserInfo(); ToastUtils.showSuccess($r("app.string.login_success")); navigateBack(); navigateBack(); }
AST#method_declaration#Left private async onLoginSuccess AST#parameter_list#Left ( AST#parameter#Left authData : AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
private async onLoginSuccess(authData: Auth): Promise<void> { await this.saveCredentials(this.account, this.password); this.userState.updateAuth(authData); this.userState.refreshUserInfo(); ToastUtils.showSuccess($r("app.string.login_success")); navigateBack(); navigateBack(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L85-L92
3878bf4a0e9cd30057c80e029a542889498f7818
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
encodeAndAddSalt
先进行Base64编码再加盐 @param str 要处理的字符串 @returns 处理后的字符串或null
static encodeAndAddSalt(str: string | null): string | null { const encoded = StringEncoder.encodedToBase64(str); return encoded ? StringEncoder.addedSalt(encoded) : null; }
AST#method_declaration#Left static encodeAndAddSalt AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right )...
static encodeAndAddSalt(str: string | null): string | null { const encoded = StringEncoder.encodedToBase64(str); return encoded ? StringEncoder.addedSalt(encoded) : null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L51-L54
4d875f95593f8b1af1c305e25eaeac0a91086fe9
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
full percent
export const ALL_PERCENT: string = '100%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ALL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat...
export const ALL_PERCENT: string = '100%';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L49-L49
16c865800da666ee1c4412f07e23fb4b16e141b6
gitee