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
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/pages/music/ProfilePage.ets
arkts
gotoUserProfile
跳转到用户中心
gotoUserProfile(): void { if (!this.isLoggedIn) { // 未登录,跳转到登录页面 router.pushUrl({ url: 'pages/LoginPage' }); } else { // 已登录,跳转到用户详情页 router.pushUrl({ url: 'pages/user/UserDetailPage', params: { userId: this.userInfo.id } }); } ...
AST#method_declaration#Left gotoUserProfile 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_e...
gotoUserProfile(): void { if (!this.isLoggedIn) { router.pushUrl({ url: 'pages/LoginPage' }); } else { router.pushUrl({ url: 'pages/user/UserDetailPage', params: { userId: this.userInfo.id } }); } }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/music/ProfilePage.ets#L56-L71
d672e280059504e184cae78f1f72ae51f9e01e49
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
getDelayedCount
获取延时完成的任务数量
static getDelayedCount(completedTasks: TaskItem[]): number { return completedTasks.filter(t => { if (!t.actualTime) return false; return t.estimatedTime / t.actualTime < 0.9; }).length; }
AST#method_declaration#Left static getDelayedCount AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
static getDelayedCount(completedTasks: TaskItem[]): number { return completedTasks.filter(t => { if (!t.actualTime) return false; return t.estimatedTime / t.actualTime < 0.9; }).length; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L132-L137
65a20adea38ea563c5c9385064ce03fea4fd5413
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/PermissionManager.ets
arkts
requestNotificationPermission
请求通知权限(封装方法)
static async requestNotificationPermission( context: common.UIAbilityContext, rationale?: string | Resource ): Promise<boolean> { return await PermissionManager.requestPermissions( context, [...PermissionManager.PERMISSION_GROUP.NOTIFICATION], rationale ); }
AST#method_declaration#Left static async requestNotificationPermission AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , A...
static async requestNotificationPermission( context: common.UIAbilityContext, rationale?: string | Resource ): Promise<boolean> { return await PermissionManager.requestPermissions( context, [...PermissionManager.PERMISSION_GROUP.NOTIFICATION], rationale ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L278-L287
23ce7c3640e54d850e49827cd959acc6bc85231c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
arkts
getLunarDayColor
获取日期农历字体颜色(仅用于月视图和周视图) @param day 日期信息 @param month 月 @param currentSelectDay 当前选择的日期 @param calendarViewType 日历视图类型 @param calendarStyle 自定义日历样式 @returns 返回颜色
static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, calendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && ...
AST#method_declaration#Left static getLunarDayColor AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left Day AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, calendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L62-L80
c7483ced3aef138c8bc523cff912de493dbd628f
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/detail/index.ets
arkts
GallerySwiper
Detail 视图组件导出
export { GallerySwiper } from './GallerySwiper';
AST#export_declaration#Left export { GallerySwiper } from './GallerySwiper' ; AST#export_declaration#Right
export { GallerySwiper } from './GallerySwiper';
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/detail/index.ets#L5-L5
f394b9f4ce242ebdfbd0aeabbee9a61a6d0ee8d3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
getInstance
获取CustomScanViewModel单例实例 @returns {CustomScanViewModel} CustomScanViewModel
static getInstance(): CustomScanViewModel { if (!CustomScanViewModel.instance) { CustomScanViewModel.instance = new CustomScanViewModel(); } return CustomScanViewModel.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomScanViewModel AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression...
static getInstance(): CustomScanViewModel { if (!CustomScanViewModel.instance) { CustomScanViewModel.instance = new CustomScanViewModel(); } return CustomScanViewModel.instance; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L52-L58
ee4c3f44a62540b848cc1491d521af48a82a69e5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/PasswordInputField.ets
arkts
PasswordInputField
@file 密码输入组件 @author Joker.X
@ComponentV2 export struct PasswordInputField { /** * 密码 */ @Param password: string = ""; /** * 占位提示 */ @Param placeholder: ResourceStr = $r("app.string.password_hint"); /** * 密码变更回调 */ @Param onPasswordChange: (value: string) => void = () => { }; /** * 输入框聚焦状态 */ @Local ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PasswordInputField AST#component_body#Left { /** * 密码 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right password : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
@ComponentV2 export struct PasswordInputField { @Param password: string = ""; @Param placeholder: ResourceStr = $r("app.string.password_hint"); @Param onPasswordChange: (value: string) => void = () => { }; @Local private isFocused: boolean = false; @Local private isPasswordHidden: b...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/PasswordInputField.ets#L9-L77
a3dcef5b6760c5788a37ed0eabd998885ba7859e
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/pages/LoginPage.ets
arkts
simulateRegister
模拟注册过程
private async simulateRegister(userInfo: UserInfo): Promise<boolean> { // 这里模拟注册过程,因为原本的UserService中没有register方法 await new Promise(resolve => setTimeout(resolve, 1000)); return true; }
AST#method_declaration#Left private async simulateRegister AST#parameter_list#Left ( AST#parameter#Left userInfo : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#...
private async simulateRegister(userInfo: UserInfo): Promise<boolean> { await new Promise(resolve => setTimeout(resolve, 1000)); return true; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/LoginPage.ets#L111-L115
889b24559af4fcb06ff2cb8c277b258a62a53989
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
batchDelete
批量删除账目数据
batchDelete(accounts: Account[], callback: Function) { // 创建 RdbPredicates 对象,用于指定删除条件 let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); // 设置删除条件为账目ID在给定账目数组中 predicates.in('id', accounts.map((account) => account.id)); // 调用 Rdb 对象的删除数据方法,并传入回调函数 this....
AST#method_declaration#Left batchDelete AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Account [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Lef...
batchDelete(accounts: Account[], callback: Function) { let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); predicates.in('id', accounts.map((account) => account.id)); this.accountTable.deleteData(predicates, callback); }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/tables/AccountTable.ets#L48-L55
2ed300899bf23932f8a2f850fc199ace34ebfeea
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
convertCoordinate
坐标转换,将WGS84坐标系转换为GCJ02坐标系。 @param fromType 转换前坐标类型,当前仅支持WGS84。 @param toType 转换后坐标类型,当前仅支持GCJ02。 @param location 待转换坐标。 @returns
static async convertCoordinate(fromType: mapCommon.CoordinateType, toType: mapCommon.CoordinateType, location: mapCommon.LatLng): Promise<mapCommon.LatLng> { return map.convertCoordinate(fromType, toType, location); }
AST#method_declaration#Left static async convertCoordinate AST#parameter_list#Left ( AST#parameter#Left fromType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mapCommon . CoordinateType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramet...
static async convertCoordinate(fromType: mapCommon.CoordinateType, toType: mapCommon.CoordinateType, location: mapCommon.LatLng): Promise<mapCommon.LatLng> { return map.convertCoordinate(fromType, toType, location); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L313-L316
c23ee6aebe3fa16a1f0700450496e584ac6dd3e9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinG.ets
arkts
SpinG
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinG { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 1; @Local scale2: number = 0.5; @Local scale3: number = 0; build() { Row() { Canvas() .chunkStyle() .scale({ x: this.scale1, y: this.scale1 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinG AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinG { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 1; @Local scale2: number = 0.5; @Local scale3: number = 0; build() { Row() { Canvas() .chunkStyle() .scale({ x: this.scale1, y: this.scale1 }) ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinG.ets#L22-L134
829a195ba8a241b4f9db0b5cea94c1fc02b02222
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
hasDefaultNet
检查默认数据网络是否激活
static hasDefaultNet(): boolean { return connection.hasDefaultNetSync(); }
AST#method_declaration#Left static hasDefaultNet 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#call_expr...
static hasDefaultNet(): boolean { return connection.hasDefaultNetSync(); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L67-L69
6c5c5814bc3e8619662aa155001c4ba030b18c37
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
sendData
判断是否为UDP发送 @param message
sendData(message: string): void { if (this.socketType[this.selectAgreementIndex] !== SocketType.UDP) { this.socketController?.sendData(message); } else { oppositePort = this.userId === 1 ? 8082 : 8081; this.socketController?.udpSendData(message, oppositeAddress, oppositePort); } }
AST#method_declaration#Left sendData 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right A...
sendData(message: string): void { if (this.socketType[this.selectAgreementIndex] !== SocketType.UDP) { this.socketController?.sendData(message); } else { oppositePort = this.userId === 1 ? 8082 : 8081; this.socketController?.udpSendData(message, oppositeAddress, oppositePort); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L98-L105
cb605b1693f04d7863107a60996324e3bcb1f845
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
mime_types/src/main/ets/Mime.ets
arkts
getIconFileByFileExtension
根据文件后缀名获取对应文件类型的图标 @param fileExtention 文件后缀名,例如:html txt doc ts mp3
static getIconFileByFileExtension(fileExtention: string): string { const descriptor = Mime.getTypeDescriptorByFileExtension(fileExtention); return descriptor.iconFile; }
AST#method_declaration#Left static getIconFileByFileExtension AST#parameter_list#Left ( AST#parameter#Left fileExtention : 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#Lef...
static getIconFileByFileExtension(fileExtention: string): string { const descriptor = Mime.getTypeDescriptorByFileExtension(fileExtention); return descriptor.iconFile; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L83-L86
7301121b5a2f1bc75f9993a43323b9987d313514
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
arkts
ensureMigrated
确保足迹表完成迁移 @returns {void} 无返回
private ensureMigrated(): void { if (!FootprintLocalDataSourceImpl.migrated) { this.orm.migrate(FootprintEntity); FootprintLocalDataSourceImpl.migrated = true; } }
AST#method_declaration#Left private ensureMigrated 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#m...
private ensureMigrated(): void { if (!FootprintLocalDataSourceImpl.migrated) { this.orm.migrate(FootprintEntity); FootprintLocalDataSourceImpl.migrated = true; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L32-L37
08aab46e44857e22bf9bf3e4b29c0c72f8763f64
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
writeNewFile
向path写入数据 @param path 文件绝对路径 @param content 文件内容
static writeNewFile(path: string, content: ArrayBuffer | string) { let fd = -1; fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd; fs.truncateSync(fd); fs.writeSync(fd, content); fs.fsync(fd).then(() => { fs.close(fd).then(() => { }).catch((err: BusinessError) => { ...
AST#method_declaration#Left static writeNewFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left...
static writeNewFile(path: string, content: ArrayBuffer | string) { let fd = -1; fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd; fs.truncateSync(fd); fs.writeSync(fd, content); fs.fsync(fd).then(() => { fs.close(fd).then(() => { }).catch((err: BusinessError) => { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L58-L71
8f1debd23977e29c2a7ec07c2d65f7d8c7b2aba7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
shareBirthdayReminder
分享生日提醒
async shareBirthdayReminder(contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> { try { const shareConfig: ShareConfig = { platform: config.platform || SharePlatform.SYSTEM, contentType: ShareContentType.TEXT, title: '生日提醒', content: this.formatBirthdayRe...
AST#method_declaration#Left async shareBirthdayReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#gene...
async shareBirthdayReminder(contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> { try { const shareConfig: ShareConfig = { platform: config.platform || SharePlatform.SYSTEM, contentType: ShareContentType.TEXT, title: '生日提醒', content: this.formatBirthdayRe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L155-L185
4df1eb3043c2fc88981a955bf69ad7898404fb88
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets
arkts
placeholder
输入框的占位提示文本 @param placeholder @returns
placeholder(placeholder: ResourceStr) { this.builderOptions.placeholder = placeholder; return this }
AST#method_declaration#Left placeholder AST#parameter_list#Left ( AST#parameter#Left placeholder : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_state...
placeholder(placeholder: ResourceStr) { this.builderOptions.placeholder = placeholder; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets#L26-L29
136b1de067db283d1d82bac978f9ebde6ca188aa
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets
arkts
reminderTime
日程提醒时间菜单
@Builder reminderTimeMenu() { Column() { ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => { Column() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left reminderTimeMenu AST#parameter_list#Left ( ) AST#parameter_list#Right { Column ( ) { ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . REMINDER_TIME_OPTION AST#member_e...
@Builder reminderTimeMenu() { Column() { ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => { Column() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L159-L243
152a13c8edf08b874de6474ff78c50ddc8631677
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.3.6';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.3.6' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.3.6';
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/BuildProfile.ets#L4-L4
b3139f40b9a7a251098dd8ee06b7d379f5d6c752
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/SelfStockComponent.ets
arkts
_deleteStockFromDB
从自选列表中删除自选股票 @param code
_deleteStockFromDB(code: string) { this.selfStockTable.deleteDataByCode(code, (result) => { if (result > 0) { console.log("删除自选成功") this.dataSource.notifyItemDataDelete(code) } }) }
AST#method_declaration#Left _deleteStockFromDB AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expr...
_deleteStockFromDB(code: string) { this.selfStockTable.deleteDataByCode(code, (result) => { if (result > 0) { console.log("删除自选成功") this.dataSource.notifyItemDataDelete(code) } }) }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/SelfStockComponent.ets#L227-L234
f1a05ede8b849bc8c5f0f94feeff349ff7230975
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Texts.ets
arkts
textStyle
自定义样式:text
@Styles textStyle(){ .width(260) .height(30) .borderWidth(1) .borderColor(Color.Black) .margin({ bottom: 10 }) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right textStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 260 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#express...
@Styles textStyle(){ .width(260) .height(30) .borderWidth(1) .borderColor(Color.Black) .margin({ bottom: 10 }) }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Texts.ets#L34-L40
18e74bf39fe2c2a9a0b5f1df21e624825cdb6f67
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
键值对接口
export interface KeyValuePair<K = string, V = Object> { key: K; value: V; }
AST#export_declaration#Left export AST#interface_declaration#Left interface KeyValuePair AST#type_parameters#Left < AST#type_parameter#Left K = AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right , AST#type_parameter#Left V = AST#type_annotatio...
export interface KeyValuePair<K = string, V = Object> { key: K; value: V; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L98-L101
d6dc854297e775923783956f6639d23f9dbcde03
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
请求数据类型,支持各种基本类型的键值对
export interface RequestData { // 基本信息字段 id?: number; userId?: number; title?: string; description?: string; category?: string; content?: string; // 状态字段 priority?: number; status?: number; type?: number; completionRate?: number; // 时间相关字段 deadline?: string; createdAt?: string; upd...
AST#export_declaration#Left export AST#interface_declaration#Left interface RequestData AST#object_type#Left { // 基本信息字段 AST#type_member#Left id ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userId ? : AST#type_ann...
export interface RequestData { id?: number; userId?: number; title?: string; description?: string; category?: string; content?: string; priority?: number; status?: number; type?: number; completionRate?: number; deadline?: string; createdAt?: string; updatedAt?: string; expect...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L132-L201
5294ae9befbc20c4baf42ce2aeb130f36e02b13a
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets
arkts
download2File
下载到文件
download2File() { let localFilePath = getContext(this).tempDir + "/demo.txt" let downloadToFile: rcp.DownloadToFile = { kind: 'file', file: localFilePath, keepLocal: false } as rcp.DownloadToFile const session = rcp.createSession(); session.downloadToFile(this.downloadUrl, downlo...
AST#method_declaration#Left download2File AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localFilePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#ex...
download2File() { let localFilePath = getContext(this).tempDir + "/demo.txt" let downloadToFile: rcp.DownloadToFile = { kind: 'file', file: localFilePath, keepLocal: false } as rcp.DownloadToFile const session = rcp.createSession(); session.downloadToFile(this.downloadUrl, downlo...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets#L82-L98
390e24e06dede467a5db1da20b25200472e56baf
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.EditableTitleBar.d.ets
arkts
Declaration of the left icon type. @enum { EditableLeftIconType }. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declaration of the left icon type. @enum { EditableLeftIconType }. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare enum EditableLeftIconType { /** * The back type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The back type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ Back = 0, /** * The cancel type. * @syscap SystemCapabilit...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum EditableLeftIconType AST#enum_body#Left { /** * The back type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The back type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atom...
export declare enum EditableLeftIconType { Back = 0, Cancel = 1 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.EditableTitleBar.d.ets#L161-L187
d2cd9c6a5fc650a8366c9b73777d3ca49d2c08ad
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets
arkts
sendMessageToServer
发送数据到服务端
async sendMessageToServer(message: string): Promise<void> { sendProcessMessage("开始发送数据到服务端...", MessagePosition.Right); // 消息加密 let encryptionMessage: string = await this.encryption(message); sendProcessMessage("发送加密数据到服务端...", MessagePosition.Right); // 发送服务端 await this.server.receiveMessageFro...
AST#method_declaration#Left async sendMessageToServer 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#type_annotation#Left AST#primary_type#Left AST#generic_...
async sendMessageToServer(message: string): Promise<void> { sendProcessMessage("开始发送数据到服务端...", MessagePosition.Right); let encryptionMessage: string = await this.encryption(message); sendProcessMessage("发送加密数据到服务端...", MessagePosition.Right); await this.server.receiveMessageFromClient(encrypt...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets#L52-L59
d2715913333fd90cbe896413b5bd2c6e60b4d875
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement2.ets
arkts
ConcurrentTaskManagement2
[End updatesab]
@Component export struct ConcurrentTaskManagement2 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.tree_like_dependency_title')) .buttonStyles() .margin({ bottom: 16 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConcurrentTaskManagement2 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_bod...
@Component export struct ConcurrentTaskManagement2 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.tree_like_dependency_title')) .buttonStyles() .margin({ bottom: 16 }) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement2.ets#L78-L109
c2ae259e30f7eded841667e65b4c2427ae1c27a6
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/ActionSheetDialogView.ets
arkts
aboutToAppear
ActionSheet选项长度 @Local themeColorMode: ThemeColorMode = DialogHub.getThemeColorMode();
aboutToAppear(): void { if (this.options.sheets && this.options.sheets.length >= 1) { this.length = this.options.sheets.length; let fontSize = (this.options.sheets[0] as ActionSheetItemOptions).fontSize; if (fontSize) { this.fontSize = fontSize; } } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AS...
aboutToAppear(): void { if (this.options.sheets && this.options.sheets.length >= 1) { this.length = this.options.sheets.length; let fontSize = (this.options.sheets[0] as ActionSheetItemOptions).fontSize; if (fontSize) { this.fontSize = fontSize; } } }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ActionSheetDialogView.ets#L19-L27
accd606fdd97bca31114012b9a54223f55e16981
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/foreach_001_T.ets
arkts
Introduction 循环结构-循环体-foreach
export function foreach_001_T(taint_src : string) { let arr = ["a", "b", taint_src]; arr.forEach(item => { taint.Sink(item); }) }
AST#export_declaration#Left export AST#function_declaration#Left function foreach_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left ...
export function foreach_001_T(taint_src : string) { let arr = ["a", "b", taint_src]; arr.forEach(item => { taint.Sink(item); }) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/foreach_001_T.ets#L6-L11
89e57a90bb2d806f16361f50f7f9c7bc39041a00
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
goSearch
跳转到搜索页面 @param searchType 搜索类型
async goSearch(searchType?: string): Promise<void> { await this.push(RoutePaths.SEARCH, { params: { searchType } }); }
AST#method_declaration#Left async goSearch AST#parameter_list#Left ( AST#parameter#Left searchType ? : 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#L...
async goSearch(searchType?: string): Promise<void> { await this.push(RoutePaths.SEARCH, { params: { searchType } }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L300-L304
969acad4676eb735211b3551e2dad96f07d97845
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/util/VersionUtils.ets
arkts
获取当前版本号 @return 当前版本号
export function getCurrentDisplayVersion(): string { return DeviceUtils.getDisplayVersion(); }
AST#export_declaration#Left export AST#function_declaration#Left function getCurrentDisplayVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statem...
export function getCurrentDisplayVersion(): string { return DeviceUtils.getDisplayVersion(); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/util/VersionUtils.ets#L64-L66
07e6330d53a56ab37f2178887b0f4207cfa2ad1f
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
Defines position of exchange data. @interface ExchangeIndex @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export interface ExchangeIndex { /** * Index of the first exchange data. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ start: number; /** * Index of the second exchange data. * * @type ...
AST#export_declaration#Left export AST#interface_declaration#Left interface ExchangeIndex AST#object_type#Left { /** * Index of the first exchange data. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ AST#type_memb...
export interface ExchangeIndex { start: number; end: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L274-L295
eabe5cb0424d7d286311f2f0d29b0f81c018c94c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets
arkts
checkNameNull
Check whether the name is empty.
checkNameNull(): boolean { if (this.isLoading) { return false; } if (this.homeTabModel.name.trim() === '') { prompt.showToast({ duration: HomeConstants.DURATION, message: $r('app.string.place_holder_name') }); return false; } return true; }
AST#method_declaration#Left checkNameNull 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left...
checkNameNull(): boolean { if (this.isLoading) { return false; } if (this.homeTabModel.name.trim() === '') { prompt.showToast({ duration: HomeConstants.DURATION, message: $r('app.string.place_holder_name') }); return false; } return true; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets#L167-L179
7ec709fc32d206edb68e861a743c75db1b94476d
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Render/SameLayer/DMPAvPlayer.ets
arkts
setSurfaceID
用于区分模式是否支持seek操作。
setSurfaceID(surface_id: string) { console.log('setSurfaceID : ' + surface_id); this.surfaceID = surface_id; }
AST#method_declaration#Left setSurfaceID AST#parameter_list#Left ( AST#parameter#Left surface_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#builder_function_body#Left { AST#expression_statement#Left AST#expr...
setSurfaceID(surface_id: string) { console.log('setSurfaceID : ' + surface_id); this.surfaceID = surface_id; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Render/SameLayer/DMPAvPlayer.ets#L9-L12
c75347efd131435432d284d6757018cc1f43ca6c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
hasDirPath
判断是否是完整路径 @param path 文件路径
static hasDirPath(path: string): boolean { let filesDir = getContext().filesDir; //根目录 let cacheDir = getContext().cacheDir; //根目录 let tempDir = getContext().tempDir; //根目录 return StrUtil.startsWith(path, filesDir) || StrUtil.startsWith(path, cacheDir) || StrUtil.startsWith(path, tempDir); }
AST#method_declaration#Left static hasDirPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
static hasDirPath(path: string): boolean { let filesDir = getContext().filesDir; let cacheDir = getContext().cacheDir; let tempDir = getContext().tempDir; return StrUtil.startsWith(path, filesDir) || StrUtil.startsWith(path, cacheDir) || StrUtil.startsWith(path, tempDir); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L110-L116
2c0efacf1b472829da2def82a75ec5421ea28ca9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets
arkts
contains
判断数组是否包含某个对象 param 数组对象Array<Object> 含有的对象Object @returns boolean
static contains(array: Array<Object>, value: Object): boolean { try { for (let index = 0; index < array.length; index++) { const element = array[index]; if (element === value) { return true; } } } catch (err) { logger.error('Failed ' + JSON.stringify(err)) ...
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left array : 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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type_argument...
static contains(array: Array<Object>, value: Object): boolean { try { for (let index = 0; index < array.length; index++) { const element = array[index]; if (element === value) { return true; } } } catch (err) { logger.error('Failed ' + JSON.stringify(err)) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets#L56-L69
c71262d32beb96cf53e57fd2bc6c2490a33bf78f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
updateCameraCompSize
更新相机流展示组件(XComponent)的尺寸 @returns {void}
async updateCameraCompSize(): Promise<void> { // 通过窗口属性修改组件宽高 let windowSize: window.Size | null = this.scanSize.setWindowSize(); if (windowSize) { this.scanSize.setScanXComponentSize(true, windowSize) this.cameraCompWidth = this.scanSize.xComponentSize.width; this.cameraCompHeight = this...
AST#method_declaration#Left async updateCameraCompSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#...
async updateCameraCompSize(): Promise<void> { let windowSize: window.Size | null = this.scanSize.setWindowSize(); if (windowSize) { this.scanSize.setScanXComponentSize(true, windowSize) this.cameraCompWidth = this.scanSize.xComponentSize.width; this.cameraCompHeight = this.scanSize.xComp...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L164-L177
7eeff34ea4e8f7f5639e5d661b83a66a3cedface
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
changeColor
修改动画颜色 @param color 颜色数组RGBA @param layer 层次的下标值 @param index 对应层次里面的elements的下标值
changeColor(color: number[], layer?: number, index?: number) { this.animationItem?.changeColor(color, layer, index) }
AST#method_declaration#Left changeColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left layer ? : AST#type_annotation#Left AST...
changeColor(color: number[], layer?: number, index?: number) { this.animationItem?.changeColor(color, layer, index) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L335-L337
214636e364c6a91301ec10985e2d4fb8ea867a50
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/debug/DebugFlg.ets
arkts
DebugFlg.ets
export class DebugFlg { //private static readonly isDebug: boolean = true; // 编译时配置 static isDebugMode(): boolean { // return DebugFlg.isDebug; // 获取应用是否为Release环境 let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION; let mBundleInfo = bundleManager.getBundleInfoForSelfSync...
AST#export_declaration#Left export AST#class_declaration#Left class DebugFlg AST#class_body#Left { //private static readonly isDebug: boolean = true; // 编译时配置 AST#method_declaration#Left static isDebugMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#...
export class DebugFlg { static isDebugMode(): boolean { let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION; let mBundleInfo = bundleManager.getBundleInfoForSelfSync(bundleFlags); let isRelease = !mBundleInfo.appInfo.debug; return !isRelease } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/debug/DebugFlg.ets#L4-L19
03417f7a1e382e010f59b94d4bda542dba83568d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
entry/src/main/ets/pages/Welcome.ets
arkts
aboutToAppear
初始化请求参数
aboutToAppear(): void { //请求地址前缀 // efAxiosParams.baseURL = 'http://aliyunmr.com:18088'; //是否开启传输整体加密 // efAxiosParams.isAllEncrypt = true; //加密的SM2key // efAxiosParams.sm2PubKey = // '04ba3bc3c5834d9ad1a7d81c4b49cf1209d2f28e4a97c73b75d6561792a2bfafe811e0284692006b0ce1b51f8aadfd65241d80eb9...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //请求地址前缀 // efAxiosParams.baseURL = 'http://aliyunmr.com:18088'; //是否开启传输整体加密 // efAxiosP...
aboutToAppear(): void { }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/entry/src/main/ets/pages/Welcome.ets#L110-L118
80cdf25c5151b7bfc1c5099ed9597466f239102c
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarData.ets
arkts
Data container for the RadarChart.
export default class RadarData extends ChartData<IRadarDataSet> { private mLabels: JArrayList<string>; constructor(dataSets?: JArrayList<IRadarDataSet>) { super(dataSets); } /** * Sets the labels that should be drawn around the RadarChart at the end of each web line. * * @param ...
AST#export_declaration#Left export default AST#class_declaration#Left class RadarData extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ChartData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IRadarDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_...
export default class RadarData extends ChartData<IRadarDataSet> { private mLabels: JArrayList<string>; constructor(dataSets?: JArrayList<IRadarDataSet>) { super(dataSets); } public setLabels(labels: JArrayList<string>): void { this.mLabels = labels; } public getLabels(): ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarData.ets#L25-L49
96b0709815ec53636ce08104135e993fa53c4bf5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets
arkts
给 Canvas 切割悬浮槽 TODO: 知识点:通过 clip 来实现切割后保留的圆弧实现平滑过渡 @param { CanvasClipGrooveType } canvasInfo - canvas一些信息详见 CanvasClipGrooveType
export function CanvasClipGroove(canvasInfo: CanvasClipGrooveType) { // CanvasRenderingContext2D let ctx = canvasInfo.context; // canvas 宽度 let cW = ctx.width; // canvas 高度 let cH = ctx.height; // 半径 let radius = getMinWidth(cW, cH, canvasInfo.menuLength) / 2; // 中间圆的中心点 let Center = canvasInfo.cent...
AST#export_declaration#Left export AST#function_declaration#Left function CanvasClipGroove AST#parameter_list#Left ( AST#parameter#Left canvasInfo : AST#type_annotation#Left AST#primary_type#Left CanvasClipGrooveType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#blo...
export function CanvasClipGroove(canvasInfo: CanvasClipGrooveType) { let ctx = canvasInfo.context; let cW = ctx.width; let cH = ctx.height; let radius = getMinWidth(cW, cH, canvasInfo.menuLength) / 2; let Center = canvasInfo.center || cW / 2; let aroundCenter = Math.sqrt(Math.pow(radius * ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets#L99-L140
b780954bedc2e5a5492e13091a0727189620f2f8
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/common/PreferencesUtil.ets
arkts
Preferences 工具类 用于存储和读取应用的轻量级数据(键值对)
export class PreferencesUtil { // 存储文件名,可以按需修改成你的业务名称 private static readonly PREFERENCES_NAME: string = 'app_preferences'; /** * 获取 Preferences 实例 * @param context 应用上下文 * @returns Preferences 实例 */ private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferen...
AST#export_declaration#Left export AST#class_declaration#Left class PreferencesUtil AST#class_body#Left { // 存储文件名,可以按需修改成你的业务名称 AST#property_declaration#Left private static readonly PREFERENCES_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export class PreferencesUtil { private static readonly PREFERENCES_NAME: string = 'app_preferences'; private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferences> { if (!context) { const error = new Error('Context is null or undefined'); console.error...
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L8-L131
d23fd64b068a07a506c00fa71c88c2ab72fffb4b
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/pages/Register.ets
arkts
navigateToLogin
返回登录页
navigateToLogin(): void { Router.back(); }
AST#method_declaration#Left navigateToLogin 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#expressi...
navigateToLogin(): void { Router.back(); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/pages/Register.ets#L68-L70
d01b0b732886dd5ccd9be077aa69df8cbb554c8e
github
meltsama/Arkts_HarmonyOS_App.git
546adabde1c0f2e9abb988dd26c5722f4f0e2514
version_1/entry/src/main/ets/pages/qiud/DqsPage.ets
arkts
buildText2
自定义弹窗 内部文本按钮等
@Builder function buildText2(params: Params2) { Column() { //标题文本 Text(params.text) .fontSize(18) .padding({top: 20}) //内容文本 Text('5633') .fontSize(40) .fontWeight(FontWeight.Bold) .margin(30) .fontColor('#0468FF') //两个按钮的实现 Row(){ Button({type:ButtonT...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildText2 AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Params2 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bu...
@Builder function buildText2(params: Params2) { Column() { Text(params.text) .fontSize(18) .padding({top: 20}) Text('5633') .fontSize(40) .fontWeight(FontWeight.Bold) .margin(30) .fontColor('#0468FF') Row(){ Button({type:ButtonType.Normal}){ ...
https://github.com/meltsama/Arkts_HarmonyOS_App.git/blob/546adabde1c0f2e9abb988dd26c5722f4f0e2514/version_1/entry/src/main/ets/pages/qiud/DqsPage.ets#L11-L46
467f3f6dad5dc20654a8c96a415a85585c358522
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
base64ToStr
Base64字符串转字符串 @param base64Str Base64字符串 @returns
static base64ToStr(base64Str: string): string { const uint8Array = Base64Util.decodeSync(base64Str); const result = StrUtil.unit8ArrayToStr(uint8Array); return result; }
AST#method_declaration#Left static base64ToStr AST#parameter_list#Left ( AST#parameter#Left base64Str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static base64ToStr(base64Str: string): string { const uint8Array = Base64Util.decodeSync(base64Str); const result = StrUtil.unit8ArrayToStr(uint8Array); return result; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L324-L328
148c947bbf60f968d2952ed3e9bc4e9d58c437d9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
convertCoordinateSync
坐标转换,将WGS84坐标系转换为GCJ02坐标系。 @param fromType 转换前坐标类型,当前仅支持WGS84。 @param toType 转换后坐标类型,当前仅支持GCJ02。 @param location 待转换坐标。 @returns
static convertCoordinateSync(fromType: mapCommon.CoordinateType, toType: mapCommon.CoordinateType, location: mapCommon.LatLng): mapCommon.LatLng { return map.convertCoordinateSync(fromType, toType, location); }
AST#method_declaration#Left static convertCoordinateSync AST#parameter_list#Left ( AST#parameter#Left fromType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mapCommon . CoordinateType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static convertCoordinateSync(fromType: mapCommon.CoordinateType, toType: mapCommon.CoordinateType, location: mapCommon.LatLng): mapCommon.LatLng { return map.convertCoordinateSync(fromType, toType, location); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L325-L328
af8afb6c4c3254687a2fc910cf57a618d7fe077e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Unlink (delete) a file in a sync way. @param file_name A string, the path of the file.
export function sandbox_unlink_sync(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlinkSync(full_file_directory); console.info('[storage_tools][sandbox_unlink_sync][' + file...
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_unlink_sync AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : AST#...
export function sandbox_unlink_sync(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlinkSync(full_file_directory); console.info('[storage_tools][sandbox_unlink_sync][' + file...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L358-L369
e08c492239fd2aa5a9cc0afc72d070a54468bb3d
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets
arkts
enableAutoReport
开启自动周期上报属性 @param reportInterval 上报周期,单位ms
public enableAutoReport(reportInterval: number): void { if (this.timer != null) { LogUtil.error("timer is already enabled"); return; } this.timer = setInterval(() => { this.firePropertiesChanged() }, reportInterval) }
AST#method_declaration#Left public enableAutoReport AST#parameter_list#Left ( AST#parameter#Left reportInterval : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
public enableAutoReport(reportInterval: number): void { if (this.timer != null) { LogUtil.error("timer is already enabled"); return; } this.timer = setInterval(() => { this.firePropertiesChanged() }, reportInterval) }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets#L89-L98
4e7007f6101b125cf56da40cae9dccf53b4798c1
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/readStatisticsDataList.ets
arkts
bookTime
时间及进度
@Builder bookTime(status:boolean,dateTime:Date,schedule:number,index:number){ Column({space:30}){ if(this.delStatus){ Checkbox({ name: 'checkbox1'+index, group: 'checkboxGroup' }) .select(status) .selectedColor(0xed6f21) .shape(CheckBoxShape.CIRCLE) .onChange((v...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bookTime AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dateTime : AST#type_annotation#Left...
@Builder bookTime(status:boolean,dateTime:Date,schedule:number,index:number){ Column({space:30}){ if(this.delStatus){ Checkbox({ name: 'checkbox1'+index, group: 'checkboxGroup' }) .select(status) .selectedColor(0xed6f21) .shape(CheckBoxShape.CIRCLE) .onChange((v...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/readStatisticsDataList.ets#L52-L97
6d96116bc61a05bcc55dc2184174b99fdb91b30f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
ensureYearMapping
确保指定年份的映射数据已加载
private async ensureYearMapping(year: number): Promise<void> { if (!this.mappingCache.has(year)) { await this.generateYearMapping(year); } }
AST#method_declaration#Left private async ensureYearMapping AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
private async ensureYearMapping(year: number): Promise<void> { if (!this.mappingCache.has(year)) { await this.generateYearMapping(year); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L283-L287
d3d3498695bb45d2d4118d2b06e543e9505a9cc9
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AbilityUtils.ets
arkts
openAbility
打开外部应用 @param want @param options
static openAbility(want: Want, options?: StartOptions) { let context = getContext() as common.UIAbilityContext context.startAbility(want, options) }
AST#method_declaration#Left static openAbility AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left StartOptions AST#pri...
static openAbility(want: Want, options?: StartOptions) { let context = getContext() as common.UIAbilityContext context.startAbility(want, options) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L97-L100
d99361cd9a74244ba2ed0b8015668dacdbd0c59f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets
arkts
deletePlanTransaction
MARK: - 事务删除 Plan
async deletePlanTransaction(plan: DBPlan): Promise<void> { if (!this.db) return; if (!plan.planId || !PlanDbAccess.shared) return; const planId = plan.planId; const sqlList: string[] = []; const paramsList: ParamType[][] = []; // ====== 删除 Plan ====== sqlList.push(`DELETE FROM ${Tables.P...
AST#method_declaration#Left async deletePlanTransaction AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left DBPlan 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_t...
async deletePlanTransaction(plan: DBPlan): Promise<void> { if (!this.db) return; if (!plan.planId || !PlanDbAccess.shared) return; const planId = plan.planId; const sqlList: string[] = []; const paramsList: ParamType[][] = []; sqlList.push(`DELETE FROM ${Tables.Plan.name} WHERE ${Tables...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L285-L312
e6e12c1e508d82dddb83770502c14620e78ef897
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
getGreetingHistoryByContact
获取联系人的祝福历史 @param contactId 联系人ID
async getGreetingHistoryByContact(contactId: number): Promise<GreetingHistoryEntity[]> { this.checkInitialization(); return await this.greetingHistoryDAO.getGreetingHistoryByContactId(contactId); }
AST#method_declaration#Left async getGreetingHistoryByContact AST#parameter_list#Left ( AST#parameter#Left contactId : 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 AS...
async getGreetingHistoryByContact(contactId: number): Promise<GreetingHistoryEntity[]> { this.checkInitialization(); return await this.greetingHistoryDAO.getGreetingHistoryByContactId(contactId); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L222-L225
ca6cc48443aacc585cfb8a003b232240743cc31e
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--升级失败 @since 2022-06-10
export class InstallFailed extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.INSTALL_FAILED; this.percent = 100; this.buttonText = $r('app.string.btn_upgrade'); thi...
AST#export_declaration#Left export AST#class_declaration#Left class InstallFailed extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#...
export class InstallFailed extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.INSTALL_FAILED; this.percent = 100; this.buttonText = $r('app.string.btn_upgrade'); thi...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L561-L585
9dae7b41d30e95976a21a67e18255cc41acee795
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/ToastUtil.ets
arkts
getUIContext
获取UIContext 在 onWindowStageCreate 的 windowStage.loadContent(),之前调用showToast(),有可能会获取不到UIContext。 @returns
private static getUIContext(): UIContext | undefined { try { return AppUtil.getContext().windowStage.getMainWindowSync().getUIContext(); } catch (e) { return undefined; } }
AST#method_declaration#Left private static getUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#b...
private static getUIContext(): UIContext | undefined { try { return AppUtil.getContext().windowStage.getMainWindowSync().getUIContext(); } catch (e) { return undefined; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L129-L135
16deb868668f728770f0312b7ff6f02a0030bb7f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample7/Interceptor.ets
arkts
RequestInterceptor
Request interceptor encapsulated as sendable
@Sendable export class RequestInterceptor implements IRequestInterceptor { handle(data: InternalAxiosRequestConfig<object>): InternalAxiosRequestConfig<object> | Promise<InternalAxiosRequestConfig<object>> { return data; } handleError(error: object): object { return error; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class RequestInterceptor AST#implements_clause#Left implements IRequestInterceptor AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : AST#t...
@Sendable export class RequestInterceptor implements IRequestInterceptor { handle(data: InternalAxiosRequestConfig<object>): InternalAxiosRequestConfig<object> | Promise<InternalAxiosRequestConfig<object>> { return data; } handleError(error: object): object { return error; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/Interceptor.ets#L21-L30
573ee0b81d294a46bf939df21d2cafe5664195e6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getSdkApiVersion
获取系统软件API版本。示例:12
static getSdkApiVersion(): number { return deviceInfo.sdkApiVersion; }
AST#method_declaration#Left static getSdkApiVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
static getSdkApiVersion(): number { return deviceInfo.sdkApiVersion; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L215-L217
e6704f113c64361b6462683657ea39bf31d45735
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Info/entry/src/main/ets/pages/datapanel/DataPanelExample004.ets
arkts
buildDataPanel
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder function buildDataPanel(config: DataPanelConfiguration) { Column() { Column() { ForEach(config.values, (item: number, index: number) => { ChildItem({ item: item, index: index, max: config.maxValue }) }, (item: string) => item) }.padding(10) Column() { Line().width('100%...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildDataPanel AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left DataPanelConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramete...
@Builder function buildDataPanel(config: DataPanelConfiguration) { Column() { Column() { ForEach(config.values, (item: number, index: number) => { ChildItem({ item: item, index: index, max: config.maxValue }) }, (item: string) => item) }.padding(10) Column() { Line().width('100%...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Info/entry/src/main/ets/pages/datapanel/DataPanelExample004.ets#L16-L34
44ebbbd908aa7a33d68b8b94e0088c1500bbe018
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
用户画像接口
export interface UserDemographics { age: number; gender?: string; location: string; occupation?: string; educationLevel?: string; incomeLevel?: string; maritalStatus?: string; hasChildren?: boolean; interests: string[]; hobbies: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserDemographics AST#object_type#Left { AST#type_member#Left age : 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 gender ? : AST#type_annotatio...
export interface UserDemographics { age: number; gender?: string; location: string; occupation?: string; educationLevel?: string; incomeLevel?: string; maritalStatus?: string; hasChildren?: boolean; interests: string[]; hobbies: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L154-L165
9b6c36b6f019d2f0c084eefaad77fb28bf0d0109
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
trim
去除字符串两端的空格 @param str @returns
static trim(str: string): string { return str.trim(); }
AST#method_declaration#Left static trim 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 string AST#primary_type#Right ...
static trim(str: string): string { return str.trim(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L96-L98
3f9ea1aa847f44ef4d746eae8faf46011184c278
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
deleteLearnForPlan
/ 删除此plan的所有learn
public static async deleteLearnForPlan(plan: Plan): Promise<void> { //删除内存中的数据 plan.removeMemAllLearns(); //删除db中的数据 if (plan.planId != null) { await PlanDbAccess.shared.deleteLearn(plan.planId); } }
AST#method_declaration#Left public static async deleteLearnForPlan AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#...
public static async deleteLearnForPlan(plan: Plan): Promise<void> { plan.removeMemAllLearns(); if (plan.planId != null) { await PlanDbAccess.shared.deleteLearn(plan.planId); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L458-L466
cdf6cc19fd2620bbbea7d3d08ed0ea4031db1670
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/modalwindow/Index.ets
arkts
ModalWindowComponent
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 { ModalWindowComponent } from './src/main/ets/ModalWindow';
AST#export_declaration#Left export { ModalWindowComponent } from './src/main/ets/ModalWindow' ; AST#export_declaration#Right
export { ModalWindowComponent } from './src/main/ets/ModalWindow';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/modalwindow/Index.ets#L15-L15
0b2d8edd6bdb597907ba94bf090e2751c2850752
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
binaryToString
辅助方法:将 Uint8Array 转换为字符串(用于 Set 比较)
private static binaryToString(binary: Uint8Array): string { let result = '' for (let i = 0; i < binary.length; i++) { result += String.fromCharCode(binary[i]) } return result }
AST#method_declaration#Left private static binaryToString AST#parameter_list#Left ( AST#parameter#Left binary : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left strin...
private static binaryToString(binary: Uint8Array): string { let result = '' for (let i = 0; i < binary.length; i++) { result += String.fromCharCode(binary[i]) } return result }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L411-L417
70eb2d8555774676f284cd8c750a1e19ddedb160
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/Index.ets
arkts
TextAndSpanComponent
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 { TextAndSpanComponent } from './src/main/ets/components/TextAndSpanComponent';
AST#export_declaration#Left export { TextAndSpanComponent } from './src/main/ets/components/TextAndSpanComponent' ; AST#export_declaration#Right
export { TextAndSpanComponent } from './src/main/ets/components/TextAndSpanComponent';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/Index.ets#L15-L15
8436d639f3639873f2df9db87d3a7332030ca360
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
notifyDataMove
Notify the controller of the data location change
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }); }
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L60-L64
7c09098ab3961715367169fdf208d302ca4ea08e
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/huawei/HwSubscribeConstants.ets
arkts
Harmony OS 5, HWS 5.0 IAP 应用内支付 说明文档 https://developer.huawei.com/consumer/cn/doc/app/non-subscription-0000001959074885 https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/iap-integrate-subscription-V5 API 参考 https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References/iapclient-00000010501...
export class HwSubscribeConstants { static readonly SKU_1: string = AppSettings.TEConfigs.SKU_Member1;//'com.or.toeic.vocabulary.member1'; static readonly SKU_2: string = AppSettings.TEConfigs.SKU_Member2;//'com.or.toeic.vocabulary.member2'; static readonly SKU_3: string = AppSettings.TEConfigs.SKU_Member3;//'co...
AST#export_declaration#Left export AST#class_declaration#Left class HwSubscribeConstants AST#class_body#Left { AST#property_declaration#Left static readonly SKU_1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST...
export class HwSubscribeConstants { static readonly SKU_1: string = AppSettings.TEConfigs.SKU_Member1; static readonly SKU_2: string = AppSettings.TEConfigs.SKU_Member2; static readonly SKU_3: string = AppSettings.TEConfigs.SKU_Member3; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscribeConstants.ets#L11-L16
36f95ae1a89f27345f053592a791ebaf3fb17239
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhDialog.ets
arkts
showBottomAllCustomDialog
底部完全自定义弹框,默认高度260 @param builder @param options 可不传
public static showBottomAllCustomDialog(builder: WrappedBuilder<[JhCustomOptions]>, options?: JhCustomOptions): string { let custom: JhCustomOptions = { height: options?.height ?? 260, alignment: options?.alignment ?? DialogAlignment.Bottom, offset: options?.offset ?? { dx: 0, dy: 0 }, trans...
AST#method_declaration#Left public static showBottomAllCustomDialog AST#parameter_list#Left ( AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotatio...
public static showBottomAllCustomDialog(builder: WrappedBuilder<[JhCustomOptions]>, options?: JhCustomOptions): string { let custom: JhCustomOptions = { height: options?.height ?? 260, alignment: options?.alignment ?? DialogAlignment.Bottom, offset: options?.offset ?? { dx: 0, dy: 0 }, trans...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhDialog.ets#L312-L322
65c854e40b195bd51792cec7abf6bdb065293713
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoShow/VideoComponent/src/main/ets/components/model/LiveDataModel.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class CommentDataModel { constructor(public name: string | Resource, public comment: string | Resource) { this.name = name; this.comment = comment } }
AST#export_declaration#Left export AST#class_declaration#Left class CommentDataModel AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left public AST#ERROR#Left name AST#ERROR#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#...
export class CommentDataModel { constructor(public name: string | Resource, public comment: string | Resource) { this.name = name; this.comment = comment } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoShow/VideoComponent/src/main/ets/components/model/LiveDataModel.ets#L16-L21
ce065dbda63dee50ce97c857724cc08d5141061f
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
calAccuracyRate
计算全部答题正确率 @returns
public calAccuracyRate(): number { const rightCount = this.getCorrectCount(); const totalCount = this.getTotalCount(); if (rightCount === 0) { return 0; } return Math.ceil(rightCount / totalCount * 100); }
AST#method_declaration#Left public calAccuracyRate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ...
public calAccuracyRate(): number { const rightCount = this.getCorrectCount(); const totalCount = this.getTotalCount(); if (rightCount === 0) { return 0; } return Math.ceil(rightCount / totalCount * 100); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L132-L139
0f05f48d48b98bc98c1044df26de4b860b32e320
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
aboutToBeDeleted
页面销毁时的生命周期回调 @returns {void} 无返回值
aboutToBeDeleted(): void { this.viewModel.aboutToBeDeleted(); }
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.viewModel.aboutToBeDeleted(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L89-L91
9cb86aa7ebcd2f766992fbf51965f362c56ec8ec
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/AxiosUtil.ets
arkts
efAxios所需参数实体
export class efAxiosParams { /** * 是否整体传输加密 与关键字加密isAllEncrypt互斥 二者只能有其一为true */ static isAllEncrypt: boolean = false; /** * 是否部分关键字传输加密 与整体传输加密互斥 二者只能有其一为true */ static isPartEncrypt: boolean = false; /** * 关键字加密时的关键字集合 */ static keyWordsList: Array<string> = new Array<string>(); /** ...
AST#export_declaration#Left export AST#class_declaration#Left class efAxiosParams AST#class_body#Left { /** * 是否整体传输加密 与关键字加密isAllEncrypt互斥 二者只能有其一为true */ AST#property_declaration#Left static isAllEncrypt : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = ...
export class efAxiosParams { static isAllEncrypt: boolean = false; static isPartEncrypt: boolean = false; static keyWordsList: Array<string> = new Array<string>(); static tokenName: string = 'Authorization'; static tokenValue: string = ''; static baseURL: string = ''; static sm2PubKey...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/AxiosUtil.ets#L326-L375
68f989f92ccc29eea89f3affceaacfd183d3ce22
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
FFmpeg 命令工厂
export class FFmpegFactory { /** 硬件编解码器 */ private static readonly HW_CODEC: string = 'h264_ohosavcodec'; // ============================================================ // 零拷贝类(不需要解码,最快) // ============================================================ /** * 封装格式转换(零拷贝) */ public static remux(input...
AST#export_declaration#Left export AST#class_declaration#Left class FFmpegFactory AST#class_body#Left { /** 硬件编解码器 */ AST#property_declaration#Left private static readonly HW_CODEC : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'h264_ohosav...
export class FFmpegFactory { private static readonly HW_CODEC: string = 'h264_ohosavcodec'; public static remux(input: string, output: string, format: ContainerFormat = ContainerFormat.MP4): string[] { const audioCodec = format === ContainerFormat.FLV ? 'aac' : 'copy'; return ['ffmpeg', '-i...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L26-L352
d3ac67952e8b864d5a4b8bf0f2843783ec4cd3fc
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets
arkts
targetSetting Range
export const DRINK_STEP: number = 25;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DRINK_STEP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R...
export const DRINK_STEP: number = 25;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L79-L79
1846697ae41cfcf9e4fa136d45094bfb4e5e869e
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/WebAppInteropDemo/entry/src/main/ets/pages/Index.ets
arkts
setProduct
设置乘积
public setProduct(newProduct: number) { this.product = newProduct.toString(); }
AST#method_declaration#Left public setProduct AST#parameter_list#Left ( AST#parameter#Left newProduct : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST...
public setProduct(newProduct: number) { this.product = newProduct.toString(); }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/WebAppInteropDemo/entry/src/main/ets/pages/Index.ets#L23-L25
4a154c4b26ccb8fcb2a822b2006f0e91937c3dc1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getArea
获取省市县的数据
static async getArea(): Promise<Array<AreaEntity>> { if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) { let jsonStr = await AreaHelper.getAreaStr(); AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>; } return AreaHelper.areaList; }
AST#method_declaration#Left static async getArea 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 Array AST#type_arguments#Left < AST#type_ann...
static async getArea(): Promise<Array<AreaEntity>> { if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) { let jsonStr = await AreaHelper.getAreaStr(); AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>; } return AreaHelper.areaList; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L64-L70
efff1d706d02797ecc704e7762a0edd1f9ecca90
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/Manacher.ets
arkts
Manacher 算法实现 用于在线性时间内查找字符串中的最长回文子串
export class Manacher { /** * 查找最长回文子串 * @param str 输入字符串 * @returns 最长回文子串 */ static longestPalindrome(str: string): string { if (!str || str.length === 0) { return ''; } // 预处理字符串,在每个字符之间插入特殊字符 const processed = Manacher.preprocess(str); const n = processed.length; const...
AST#export_declaration#Left export AST#class_declaration#Left class Manacher AST#class_body#Left { /** * 查找最长回文子串 * @param str 输入字符串 * @returns 最长回文子串 */ AST#method_declaration#Left static longestPalindrome AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left str...
export class Manacher { static longestPalindrome(str: string): string { if (!str || str.length === 0) { return ''; } const processed = Manacher.preprocess(str); const n = processed.length; const p: number[] = new Array(n).fill(0); let center = 0; let rightBound = 0; l...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Manacher.ets#L5-L149
07ee58902fe27e9967aa90612a17c2d9b340ffc3
github
huazheleyoushang/harmony_template.git
9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
通用静态常量
export default class CommonConstants { // 小字号 static readonly SET_SIZE_SMALL: number = 10; // 正常字号 static readonly SET_SIZE_NORMAL: number = 12; // 大字号 static readonly SET_SIZE_LARGE: number = 16; // 超大字号 static readonly SET_SIZE_EXTRA_LARGE: number = 20; static readonly SET_SLIDER_MIN: number = 1...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 小字号 AST#property_declaration#Left static readonly SET_SIZE_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expr...
export default class CommonConstants { static readonly SET_SIZE_SMALL: number = 10; static readonly SET_SIZE_NORMAL: number = 12; static readonly SET_SIZE_LARGE: number = 16; static readonly SET_SIZE_EXTRA_LARGE: number = 20; static readonly SET_SLIDER_MIN: number = 10; static readonly SET_...
https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L84
3a01cbb09df24f19c1bf99bd4582b2d3c6b2efaa
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
save_to_disk
Saves the entire bunch_of_settings to the disk.
static save_to_disk() { sandbox_save('settings.json.browsercatsettings.txt', bunch_of_settings.toString()); }
AST#method_declaration#Left static save_to_disk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left sandbox_save ( AST#expression#Left 'settings.json.browsercatsettings.txt' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#e...
static save_to_disk() { sandbox_save('settings.json.browsercatsettings.txt', bunch_of_settings.toString()); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L231-L233
5226406324f8bca777a697ac1674423a55573e58
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
hashCode
MARK: - Hashable 哈希 获取哈希值
hashCode(): number { const str = `distance${this.distance}_num${this.num}`; return this.hashString(str); }
AST#method_declaration#Left hashCode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left str = AST#expr...
hashCode(): number { const str = `distance${this.distance}_num${this.num}`; return this.hashString(str); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L91-L94
822cb999806d875b090e160e96ba578976fe162f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mock/DetailData.ets
arkts
模拟评论数据
export function mockData(): CommentData { const commentList: CommentData = new CommentData(); commentList.pushData(new CommentModel("1", $r('app.media.user_select'), '你若安好便是晴天', '', '', '和描述相符很喜欢,做工细致,颜色好看,原装正品', new Date('2024-11-01 23:00:00'), new CommentData())) commentList.pushData(new CommentModel("2", $r('a...
AST#export_declaration#Left export AST#function_declaration#Left function mockData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
export function mockData(): CommentData { const commentList: CommentData = new CommentData(); commentList.pushData(new CommentModel("1", $r('app.media.user_select'), '你若安好便是晴天', '', '', '和描述相符很喜欢,做工细致,颜色好看,原装正品', new Date('2024-11-01 23:00:00'), new CommentData())) commentList.pushData(new CommentModel("2", $r('a...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mock/DetailData.ets#L19-L31
e4d94e8fc64e912e7d810444dbb2ebc42c868fea
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
loginOut
登出,发布登出事件
async loginOut() { if (this.loginInfo !== null) { globalVM_WanDB.updateLoginState(this.loginInfo.id, 0) } await this.updateLoginInfo(null, null, null) await this.updateUserInfo(null) EventBus.getInstance().post(WanEventId.EVENT_LOGIN_OUT) }
AST#method_declaration#Left async loginOut AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Ri...
async loginOut() { if (this.loginInfo !== null) { globalVM_WanDB.updateLoginState(this.loginInfo.id, 0) } await this.updateLoginInfo(null, null, null) await this.updateUserInfo(null) EventBus.getInstance().post(WanEventId.EVENT_LOGIN_OUT) }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L193-L200
db9d9385097367f48d22cc227b93d077553f96d4
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
Defines PanGesture. @extends Gesture @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class PanGesture extends Gesture { /** * Set the value. * * @param { function } factory * @param { PanGestureHandlerOptions } value * @returns { PanGesture } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * * @since 20 ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class PanGesture extends AST#type_annotation#Left AST#primary_type#Left Gesture AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * Set the value. * * @param { function } factory ...
export declare class PanGesture extends Gesture { static $_instantiate(factory: () => PanGesture, value?: PanGestureHandlerOptions): PanGesture; onActionStart(event: Callback<GestureEvent>): PanGesture; onActionUpdate(event: Callback<GestureEvent>): PanGesture; onActionEnd(event: Cal...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L467-L530
99e0f264ea982b333b7cd52d300a71a999a8da55
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.app.appstartup.StartupTask.d.ets
arkts
init
Initializes current startup task. A developer could override this function to init current task and return a result for other tasks. @param { AbilityStageContext } context - Indicates ability stage context. @returns { Promise<Object | void> } The result of initialization. @syscap SystemCapability.Ability.AppStartup @s...
init(context: AbilityStageContext): Promise<Object | void>;
AST#method_declaration#Left init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AbilityStageContext 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#Lef...
init(context: AbilityStageContext): Promise<Object | void>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.app.appstartup.StartupTask.d.ets#L53-L53
6236171beba4c811534febc7b82ff83d6013383a
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/live/LiveManager.ets
arkts
sendDanmaku
发送弹幕
async sendDanmaku(content: string, color?: string): Promise<boolean> { try { const danmaku: Danmaku = { id: `dm_${Date.now()}`, content, color: color || '#FFFFFF', timestamp: Date.now() }; this.danmakuList.push(danmaku); EventBus.emit('LIVE_DANMAKU_SENT...
AST#method_declaration#Left async sendDanmaku AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left color ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
async sendDanmaku(content: string, color?: string): Promise<boolean> { try { const danmaku: Danmaku = { id: `dm_${Date.now()}`, content, color: color || '#FFFFFF', timestamp: Date.now() }; this.danmakuList.push(danmaku); EventBus.emit('LIVE_DANMAKU_SENT...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L158-L175
40d756638de4db051f5b5242e36c4881ec728182
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getMediaContentBase64
获取指定资源ID对应的图片资源Base64编码/获取指定资源ID对应的默认或指定的屏幕密度图片资源Base64编码 @param resId 资源ID值/资源信息。 @param density 资源获取需要的屏幕密度,0或缺省表示默认屏幕密度。 @returns
static async getMediaContentBase64(resId: number | Resource, density?: number): Promise<string> { if (density !== undefined) { if (typeof resId === 'number') { return ResUtil.getResourceManager().getMediaContentBase64(resId, density); } else { return ResUtil.getResourceManager().getMedia...
AST#method_declaration#Left static async getMediaContentBase64 AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#...
static async getMediaContentBase64(resId: number | Resource, density?: number): Promise<string> { if (density !== undefined) { if (typeof resId === 'number') { return ResUtil.getResourceManager().getMediaContentBase64(resId, density); } else { return ResUtil.getResourceManager().getMedia...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L378-L392
7ab561e8c356b42f763b4254e7adcd171c68dab4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
权限状态接口
export interface PermissionStatus { granted: boolean; shouldShowRationale?: boolean; canRequest?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PermissionStatus AST#object_type#Left { AST#type_member#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left shouldShowRationale ? : ...
export interface PermissionStatus { granted: boolean; shouldShowRationale?: boolean; canRequest?: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L188-L192
60ce926dd7d393b71c2a57e2502862448465f253
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageresizable/src/main/ets/components/ProductItemComp.ets
arkts
ProductItemComp
商品信息组件 实现步骤: 1.商品促销标签使用Image图片的resizable设计,使用同一张资源图片,通过监听内容文本宽高变化,动态且安全地拉伸宽高 2.其他商品信息内容尽量采用扁平布局,同时使用@Builder替代自定义组件,实现高性能
@Reusable @Component export struct ProductItemComp { // 商品对象 @ObjectLink product: Product; // 促销标签背景图片宽度状态变量 @State discountTextWidth: Length = 0; // 促销标签背景图片高度状态变量 @State discountTextHeight: Length = 0; // 促销标签展示,采用resizable属性实现安全拉伸 @Builder discountCoupon(discount: string) { Stack() { Image...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ProductItemComp AST#ERROR#Left { // 商品对象 AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right product : AST#type_annotation#Left AST#prima...
@Reusable @Component export struct ProductItemComp { @ObjectLink product: Product; @State discountTextWidth: Length = 0; @State discountTextHeight: Length = 0; @Builder discountCoupon(discount: string) { Stack() { Image($r('app.media.imageresizable_border')) .width(this.discountTe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageresizable/src/main/ets/components/ProductItemComp.ets#L26-L82
146f6a086b098cde9de3563e5769e62dd841e144
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
save_web_label_to_sandbox
Saves web label (title) of a specific tab to sandbox. Reads the title from bunch_of_tabs properties. So update_title() should be called before this function to keep it up-to-date. @param index The index of tab.
save_web_label_to_sandbox(index: number, dir: string) { let label_identifier = dir + "/continue_tabs_web_state_array_" + index.toString() + '_label'; sandbox_save(label_identifier, this.Tabs[index].title); }
AST#method_declaration#Left save_web_label_to_sandbox AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dir : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
save_web_label_to_sandbox(index: number, dir: string) { let label_identifier = dir + "/continue_tabs_web_state_array_" + index.toString() + '_label'; sandbox_save(label_identifier, this.Tabs[index].title); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L687-L690
7027606ac4615ca1d4debe00ffc2e1b01bbae11a
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/pages/PasswordEnvelopePage.ets
arkts
Envelope
获取口令中奖者接口
Envelope() { VHSaaSDK.getInstance().getRedEnvelopeUserList(this.RedEnvelopeData?.room_id!, this.RedEnvelopeData?.red_packet_uuid!, { onSuccess: (data: VHRedEnvelopeUserListInfo) => { this.RedEnvelopeUserList = data.list as VHWinningUserListInfo[] console.log("查看口令红包中奖成功", data) }...
AST#method_declaration#Left Envelope 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#member...
Envelope() { VHSaaSDK.getInstance().getRedEnvelopeUserList(this.RedEnvelopeData?.room_id!, this.RedEnvelopeData?.red_packet_uuid!, { onSuccess: (data: VHRedEnvelopeUserListInfo) => { this.RedEnvelopeUserList = data.list as VHWinningUserListInfo[] console.log("查看口令红包中奖成功", data) }...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/PasswordEnvelopePage.ets#L30-L41
72b2fa55c455c68dffcee77332f49133e3e88ad9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/InputNameDialog.ets
arkts
InputNameDialog
用户输入名字的弹窗
@CustomDialog export struct InputNameDialog { controller?: CustomDialogController textController: TextInputController = new TextInputController() confirm: () => void = () => {} name: string = '' type: number = 0 aboutToAppear() { if (this.name) { AppStorage.setOrCreate('name', this.name); } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct InputNameDialog AST#component_body#Left { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#ERRO...
@CustomDialog export struct InputNameDialog { controller?: CustomDialogController textController: TextInputController = new TextInputController() confirm: () => void = () => {} name: string = '' type: number = 0 aboutToAppear() { if (this.name) { AppStorage.setOrCreate('name', this.name); } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/InputNameDialog.ets#L17-L96
6f41c0269c06a7108008bc91d2c4410c15b5584c
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/url_tools.ets
arkts
Process the search_input into a visitable address. @param search_input A string, the user input to search or visit. @returns A [string, boolean] array, string for the unified, visitable address, while the boolean for whether the input itself is an address.
export function unify_search_input_into_url(search_input: string, auto_scheme_overwrite?: string) { if (search_input == "") { // if is empty return ["", false]; } if (is_legal_ipv4(search_input)) { return [ensure_scheme(search_input, auto_scheme_overwrite ? auto_scheme_overwrite : "http") as string, ...
AST#export_declaration#Left export AST#function_declaration#Left function unify_search_input_into_url AST#parameter_list#Left ( AST#parameter#Left search_input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left auto_scheme_ov...
export function unify_search_input_into_url(search_input: string, auto_scheme_overwrite?: string) { if (search_input == "") { return ["", false]; } if (is_legal_ipv4(search_input)) { return [ensure_scheme(search_input, auto_scheme_overwrite ? auto_scheme_overwrite : "http") as string, true]; } ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L10-L30
4e4d206ffb3e2bfc61cf1a4a9214e0d24ae7cd93
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets
arkts
AdaptiveColorMode
[Start adaptive_color]
@Component export struct AdaptiveColorMode { @Consume('navPathStack') navPathStack: NavPathStack; build() { NavDestination() { Column() { Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text('Background Material Blur').fontColor('#FFFFFF') } .h...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AdaptiveColorMode AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'navPathStack' AST#expression#Right ) AST#decorator#Right navPathStack : AST#type_annotation...
@Component export struct AdaptiveColorMode { @Consume('navPathStack') navPathStack: NavPathStack; build() { NavDestination() { Column() { Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text('Background Material Blur').fontColor('#FFFFFF') } .h...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets#L17-L46
8c0c0f81000c8f6561c0d4c77c36b3400d2c252c
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showDebug
print debug level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showDebug(tag: string, log: string) { console.debug(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static showDebug(tag: string, log: string) { console.debug(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets#L38-L40
a2e39c9e78e11a484bce1e011324601c384f9b8d
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/higher_order_function/higher_order_function_001_T.ets
arkts
Introduction 高阶函数-一阶
export function higher_order_function_001_T(taint_src : string) { taint.Sink(f11()(taint_src,"a")); }
AST#export_declaration#Left export AST#function_declaration#Left function higher_order_function_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s...
export function higher_order_function_001_T(taint_src : string) { taint.Sink(f11()(taint_src,"a")); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/higher_order_function/higher_order_function_001_T.ets#L6-L8
0a041ec150a2db13e8dd7c148abe9bb946c68084
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/NavigationView.ets
arkts
NavigationView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3]; @State isActive: boolean = false; @State indexDev: number = 0; @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationView AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_a...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3]; @State isActive: boolean = false; @State indexDev: number = 0; @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/NavigationView.ets#L16-L79
8669a9b4b1ea3313945769b576b5f63515747b26
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/utils/PhotoHelperPage.ets
arkts
getPhotoAsset
读取图片/视频的信息
getPhotoAsset(){ PickerUtil.selectPhoto().then(async (uris) => { if (uris && uris.length > 0) { PhotoHelper.getPhotoAsset(uris[0]).then((photoAsset) => { try { let name = photoAsset?.get(photoAccessHelper.PhotoKeys.DISPLAY_NAME); let type = photoAsset?.get(photoAccess...
AST#method_declaration#Left getPhotoAsset 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#m...
getPhotoAsset(){ PickerUtil.selectPhoto().then(async (uris) => { if (uris && uris.length > 0) { PhotoHelper.getPhotoAsset(uris[0]).then((photoAsset) => { try { let name = photoAsset?.get(photoAccessHelper.PhotoKeys.DISPLAY_NAME); let type = photoAsset?.get(photoAccess...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L200-L233
a3111ce775bd961396de11dd5701bb20e9eff98a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/ColumnAttribute.ets
arkts
获取纵向起始 + 水平居中的 Column 对齐修饰器 @returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器 @example Column() { Text("Hi"); }.attributeModifier(columnStartCenter());
export function columnStartCenter(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Start); instance.alignItems(HorizontalAlign.Center); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function columnStartCenter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribu...
export function columnStartCenter(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Start); instance.alignItems(HorizontalAlign.Center); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L102-L109
7cca0ad3b705fd81bea25d159bbdf7cc500f6912
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getMarketName
获取外部产品系列名称。示例:HUAWEI Mate 60 Pro
static getMarketName(): string { return deviceInfo.marketName; }
AST#method_declaration#Left static getMarketName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp...
static getMarketName(): string { return deviceInfo.marketName; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L171-L173
ce15f90b5842428b35a627d3982d4212f836bebe
gitee