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
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/DataManager.ets
arkts
deleteEventsBySubscription
删除订阅源的所有事件
async deleteEventsBySubscription(subscriptionId: string): Promise<number> { const events = await this.loadEvents() console.info(`📊 总事件数: ${events.length}`) // 统计有订阅ID的事件 const eventsWithSubId = events.filter(e => e.subscriptionId) console.info(`📊 有订阅ID的事件: ${eventsWithSubId.length}`) ...
AST#method_declaration#Left async deleteEventsBySubscription AST#parameter_list#Left ( AST#parameter#Left subscriptionId : 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...
async deleteEventsBySubscription(subscriptionId: string): Promise<number> { const events = await this.loadEvents() console.info(`📊 总事件数: ${events.length}`) const eventsWithSubId = events.filter(e => e.subscriptionId) console.info(`📊 有订阅ID的事件: ${eventsWithSubId.length}`) const m...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L94-L112
97ab6618aa39ef1535c7bb721873dc5902594d20
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets
arkts
markVersionAsUpdated
/ 在更新完成后,记录当前版本
private async markVersionAsUpdated(): Promise<void> { try { const context = getAppContext() // 获取应用上下文 const prefs = await preferences.getPreferences(context, 'version_prefs'); let versionHistory: string[] = await prefs.get(this.versionListKey, []) as string[] // 确保当前版本不重复,并添加到历史记录 i...
AST#method_declaration#Left private async markVersionAsUpdated 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#Righ...
private async markVersionAsUpdated(): Promise<void> { try { const context = getAppContext() const prefs = await preferences.getPreferences(context, 'version_prefs'); let versionHistory: string[] = await prefs.get(this.versionListKey, []) as string[] if (!versionHistory.includes(thi...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L104-L129
552205c2b81d5bc5e7b0719ea538718424054183
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
isTerminal
是否升级终止 @return 是否升级终止
public isTerminal(): boolean { return this.isTerminalState(this.stateObj?.otaStatus); }
AST#method_declaration#Left public isTerminal 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_express...
public isTerminal(): boolean { return this.isTerminalState(this.stateObj?.otaStatus); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L389-L391
d5ea1128430790c77a7a558052d77117d059261c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/components/common/LoadingView.ets
arkts
LoadingButton
按钮加载状态组件
@Component export struct LoadingButton { @Prop text: string = '确定'; @Prop loadingText: string = '处理中...'; @Prop loading: boolean = false; @Prop disabled: boolean = false; @Prop type: ButtonType = ButtonType.Capsule; @Prop backgroundColor: string = '#007AFF'; @Prop fontColor: string = '#ffffff'; @Prop wi...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct LoadingButton { @Prop text: string = '确定'; @Prop loadingText: string = '处理中...'; @Prop loading: boolean = false; @Prop disabled: boolean = false; @Prop type: ButtonType = ButtonType.Capsule; @Prop backgroundColor: string = '#007AFF'; @Prop fontColor: string = '#ffffff'; @Prop wi...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/components/common/LoadingView.ets#L94-L133
d60c3c1ebb11bf066069c321e62f5f494cfc9e67
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets
arkts
showPromptAction
发布时间 点击未开发功能按钮弹出提示函数
private showPromptAction() { promptAction.showToast({ message: $r('app.string.tabcontentoverflow_toast_message'), duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION }); }
AST#method_declaration#Left private showPromptAction 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 promptAction AST#expression#Right . sho...
private showPromptAction() { promptAction.showToast({ message: $r('app.string.tabcontentoverflow_toast_message'), duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets#L214-L219
3d4fb4d4e5ba75f0825156248ad926bb72b477f4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
openPrivacyPolicy
打开隐私政策
private openPrivacyPolicy(): void { promptAction.showToast({ message: '正在打开隐私政策...', duration: 1500 }); }
AST#method_declaration#Left private openPrivacyPolicy 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 AS...
private openPrivacyPolicy(): void { promptAction.showToast({ message: '正在打开隐私政策...', duration: 1500 }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6237-L6242
a800810a89b81cbc2ffb7abfa53e2890be0b989a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/GreetingsPage.ets
arkts
getStyleLabel
获取样式标签
private getStyleLabel(style: GreetingStyle): string { const labels: Record<GreetingStyle, string> = { [GreetingStyle.WARM]: '温馨', [GreetingStyle.FORMAL]: '正式', [GreetingStyle.HUMOROUS]: '幽默', [GreetingStyle.POETIC]: '诗意', [GreetingStyle.SIMPLE]: '简洁' }; return labels[style] || ...
AST#method_declaration#Left private getStyleLabel AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle 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#...
private getStyleLabel(style: GreetingStyle): string { const labels: Record<GreetingStyle, string> = { [GreetingStyle.WARM]: '温馨', [GreetingStyle.FORMAL]: '正式', [GreetingStyle.HUMOROUS]: '幽默', [GreetingStyle.POETIC]: '诗意', [GreetingStyle.SIMPLE]: '简洁' }; return labels[style] || ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L624-L633
816c71e3545cff64d9264d1c4844ca32f65af6c9
github
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/CommonComponents/BaseComponents/HeaderNavigation.ets
arkts
HeaderNavigation
配置对象 leftIconGroup -> 左边图标及事件 middle -> 中间标题 rightIconGroup -> 右边图标及标题 最多不能超过三个
@Component export default struct HeaderNavigation { private leftIconGroup: ILeftIconGroup = { icon: '', title: '', event: (): void => { } } private middle: IMiddle = { title: '' } private rightIconGroup: IRightIconGroup[] = [ { icon: '', event: (): void => { } } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HeaderNavigation AST#component_body#Left { AST#property_declaration#Left private leftIconGroup : AST#type_annotation#Left AST#primary_type#Left ILeftIconGroup AST#primary_type#Right AST#type_annotation#Right =...
@Component export default struct HeaderNavigation { private leftIconGroup: ILeftIconGroup = { icon: '', title: '', event: (): void => { } } private middle: IMiddle = { title: '' } private rightIconGroup: IRightIconGroup[] = [ { icon: '', event: (): void => { } } ...
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/CommonComponents/BaseComponents/HeaderNavigation.ets#L27-L99
cd5349657eceaffd2891fe5710ae1c1cf69ec57c
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
头像上传文件项
export interface UploadFileItem { filename: string; type: string; uri: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UploadFileItem AST#object_type#Left { AST#type_member#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation...
export interface UploadFileItem { filename: string; type: string; uri: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L84-L88
6f0fa7f978e927ccc39623ddb35997bd9a9b140b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isToday
判断是否为今天 @param date 日期 @returns 是否为今天
static isToday(date: Date): boolean { const today = DateUtils.getToday(); return DateUtils.isSameDay(date, today); }
AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
static isToday(date: Date): boolean { const today = DateUtils.getToday(); return DateUtils.isSameDay(date, today); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L107-L110
0de7dd6e7c3dbc2ee895890cf493fa1d3c480b20
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/utils/formatTime.ets
arkts
从下载链接获取文件名。这里以简单包含文件名的下载链接为例。
export function getFileNameFromUrl(url: string): string { // 将URL字符串按照'/'字符进行分割,返回一个数组。 const segments = url.split('/'); // 使用pop方法从数组的末尾返回最后一个元素。 return segments.pop() || '未知文件名'; }
AST#export_declaration#Left export AST#function_declaration#Left function getFileNameFromUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
export function getFileNameFromUrl(url: string): string { const segments = url.split('/'); return segments.pop() || '未知文件名'; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/utils/formatTime.ets#L21-L26
6151dddc404c909f2311bb574715785efbfbfb97
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showToastShort
显示长吐司 @param message 吐司内容 @param options
static showToastShort(message: string | Resource, options?: ToastOptions) { options = options ?? {}; options.message = message; ActionParameter.initToastDefault(options, 1); ActionBaseCore.getInstance().showToast(options); }
AST#method_declaration#Left static showToastShort AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#R...
static showToastShort(message: string | Resource, options?: ToastOptions) { options = options ?? {}; options.message = message; ActionParameter.initToastDefault(options, 1); ActionBaseCore.getInstance().showToast(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L420-L425
a9e99bfacc47a36f3dde5d0ac3e57b8fa509b714
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets
arkts
aboutToDisappear
如果想退出考试重新进入后将已做题回显,去掉这个方法
aboutToDisappear(): void { this.examManager.clearSelectedOption(); }
AST#method_declaration#Left aboutToDisappear 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...
aboutToDisappear(): void { this.examManager.clearSelectedOption(); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L58-L60
8291c0b8783af58aa71e3da4965142be78b0759f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/adapter/WindowAdapter.ets
arkts
pxToVp
像素转 vp,失败时回退为原值 @param {number} valuePx - 像素值 @param {number} displayId - Display ID @returns {number} vp 值
private pxToVp(valuePx: number, displayId: number): number { try { const density = display.getDisplayByIdSync(displayId).densityPixels; return valuePx / density; } catch (err) { console.error(`getDisplayByIdSync failed: ${JSON.stringify(err)}`); return valuePx; } }
AST#method_declaration#Left private pxToVp AST#parameter_list#Left ( AST#parameter#Left valuePx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left displayId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
private pxToVp(valuePx: number, displayId: number): number { try { const density = display.getDisplayByIdSync(displayId).densityPixels; return valuePx / density; } catch (err) { console.error(`getDisplayByIdSync failed: ${JSON.stringify(err)}`); return valuePx; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L211-L219
59dfcbdee45a7c3e6ef9150497ebed69428f7c02
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsBanner.ets
arkts
GoodsBanner
@file 商品详情轮播图组件 @author Joker.X
@ComponentV2 export struct GoodsBanner { /** * 轮播图数据 */ @Param bannerList: string[] = []; /** * 是否自动轮播 */ @Param autoPlay: boolean = false; /** * 是否循环轮播 */ @Param loop: boolean = false; /** * 图片缩放模式 */ @Param imageFit: ImageFit = ImageFit.Cover; /** * 是否使用 1:1 比例 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsBanner AST#component_body#Left { /** * 轮播图数据 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bannerList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left...
@ComponentV2 export struct GoodsBanner { @Param bannerList: string[] = []; @Param autoPlay: boolean = false; @Param loop: boolean = false; @Param imageFit: ImageFit = ImageFit.Cover; @Param useSquareRatio: boolean = true; build(): void { if (this.bannerList && this.bannerLis...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsBanner.ets#L8-L77
8b86d97fb6594874dc1c930248315b121e4b3739
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets
arkts
Database account entity class.
export default class Account { /** * The name in the distributed information of the OS account. */ distributedAccountName: string = ""; /** * The ID in the distributed information of the OS account. */ distributedAccountID: string = ""; /** * The local ID of an OS account. */ localId: nu...
AST#export_declaration#Left export default AST#class_declaration#Left class Account AST#class_body#Left { /** * The name in the distributed information of the OS account. */ AST#property_declaration#Left distributedAccountName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
export default class Account { distributedAccountName: string = ""; distributedAccountID: string = ""; localId: number = 0; toValuesBucket(): DataRdb.ValuesBucket { return { distributedAccountName: this.distributedAccountName, distributedAccountID: this.distributedAccountID, ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets#L21-L49
60effba9ee3d9efe9117bbd68a0cbcee31afd845
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/DateUtil.ets
arkts
format
将日期类型的Date根据传入的format格式化成日期字符串(format必传) @param date @param formatString 格式化字符串 @returns
static format(date: Date, formatString: string): string { const year = date.getFullYear(); const month = DateUtil.padZero(date.getMonth() + 1); const day = DateUtil.padZero(date.getDate()); const hours = DateUtil.padZero(date.getHours()); const minutes = DateUtil.padZero(date.getMinutes()); cons...
AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left formatString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static format(date: Date, formatString: string): string { const year = date.getFullYear(); const month = DateUtil.padZero(date.getMonth() + 1); const day = DateUtil.padZero(date.getDate()); const hours = DateUtil.padZero(date.getHours()); const minutes = DateUtil.padZero(date.getMinutes()); cons...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/DateUtil.ets#L68-L84
9e4ea42a1c710f955cec177aaa88cd12399931ce
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/auth/src/main/ets/viewmodel/LoginViewModel.ets
arkts
login
执行登录操作 @returns {void} 无返回值
login(): void { const params: PasswordLoginRequest = new PasswordLoginRequest( "16666666666", "123456" ); RequestHelper.repository(this.authRepository.loginByPassword(params)) .start((): void => { this.isLoginLoading = true; }) .execute() .then((authData: Auth): v...
AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_a...
login(): void { const params: PasswordLoginRequest = new PasswordLoginRequest( "16666666666", "123456" ); RequestHelper.repository(this.authRepository.loginByPassword(params)) .start((): void => { this.isLoginLoading = true; }) .execute() .then((authData: Auth): v...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/viewmodel/LoginViewModel.ets#L33-L49
9beedc1c0c5c705b54eff428622de816c5b5c8e4
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets
arkts
Calls a worker thread to rebuild index for all history and saves (overwrites) the index file onto disk. This could avoid blocking the main thread. Adapted from https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-worker
export function history_index_full_rebuild_worker() { let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined; let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined; let reindexing = AppStorage.get('reindexing_history') as boolean | undefined; ...
AST#export_declaration#Left export AST#function_declaration#Left function history_index_full_rebuild_worker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left history_index_saving = AST#expression#Left AST#as_...
export function history_index_full_rebuild_worker() { let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined; let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined; let reindexing = AppStorage.get('reindexing_history') as boolean | undefined; ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L141-L188
b8467937185e02e4969b55cf8a6d1ed5bd4fab4a
gitee
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/检查登录GET
export const CHECK_LOGIN = baseUrl + '/xhr/common/checklogin.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CHECK_LOGIN = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/common/checklogin.json' AST#expression#Right AST#binary_expression#Right AST#expre...
export const CHECK_LOGIN = baseUrl + '/xhr/common/checklogin.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L64-L64
a154f80d508d2a28b0f1d0408b31071300d145bd
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Utils.ets
arkts
nextUp
Replacement for the Math.nextUp(...) method that is only available in HONEYCOMB and higher. Dat's some seeeeek sheeet. @param d @return
public static nextUp(d: number): number { if (d == Number.MAX_VALUE) return d; else { d += 0.0; return d += 0.000000001; } }
AST#method_declaration#Left public static nextUp AST#parameter_list#Left ( AST#parameter#Left d : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
public static nextUp(d: number): number { if (d == Number.MAX_VALUE) return d; else { d += 0.0; return d += 0.000000001; } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L209-L216
02de42a47e6f625adce32f2bcafbc91526e5e610
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/model/CommonModel.ets
arkts
Image and text title information.
export class TitleInfo { titlePicUrl: string = ''; title: ResourceStr = ''; constructor(titlePicUrl: string, title: ResourceStr) { this.titlePicUrl = titlePicUrl; this.title = title; } }
AST#export_declaration#Left export AST#class_declaration#Left class TitleInfo AST#class_body#Left { AST#property_declaration#Left titlePicUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#...
export class TitleInfo { titlePicUrl: string = ''; title: ResourceStr = ''; constructor(titlePicUrl: string, title: ResourceStr) { this.titlePicUrl = titlePicUrl; this.title = title; } }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/CommonModel.ets#L19-L27
b7bb32904e36298a84d67cdbdfae7323660cdd10
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
Writer
========== 底层模块 ========== 二进制写入器 用于编码 Protobuf wire format
export { Writer } from './Writer'
AST#export_declaration#Left export { Writer } from './Writer' AST#export_declaration#Right
export { Writer } from './Writer'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L85-L85
3c1d10a8825aa04ba6afde77a4b1c1248787326d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
getSlots
获取此应用程序的所有通知渠道 @returns
static async getSlots(): Promise<Array<notificationManager.NotificationSlot>> { return notificationManager.getSlots(); }
AST#method_declaration#Left static async getSlots 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_an...
static async getSlots(): Promise<Array<notificationManager.NotificationSlot>> { return notificationManager.getSlots(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L378-L380
20a9de178dafaa74e886e79360cc6b444517750b
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/variable_scope/static_variable/static_variable_002_F.ets
arkts
Introduction 类静态变量
export function static_variable_002_F(taint_src : string) { let _t = taint_src let _clean = "clean" A.data = _clean taint.Sink(A.data); }
AST#export_declaration#Left export AST#function_declaration#Left function static_variable_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function static_variable_002_F(taint_src : string) { let _t = taint_src let _clean = "clean" A.data = _clean taint.Sink(A.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/variable_scope/static_variable/static_variable_002_F.ets#L6-L11
66ea82210cd7ffbd8517e99bfbb5e342a8f246d3
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/MockDataService.ets
arkts
getProducts
获取商品列表
static getProducts(): Product[] { return [ { id: '1', name: 'iPhone 15 Pro Max 256GB 深空黑色', price: 9999, originalPrice: 10999, image: 'https://via.placeholder.com/300x300?text=iPhone', description: '最新款iPhone,A17 Pro芯片,钛金属材质', stock: 50, category...
AST#method_declaration#Left static getProducts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Product [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Le...
static getProducts(): Product[] { return [ { id: '1', name: 'iPhone 15 Pro Max 256GB 深空黑色', price: 9999, originalPrice: 10999, image: 'https://via.placeholder.com/300x300?text=iPhone', description: '最新款iPhone,A17 Pro芯片,钛金属材质', stock: 50, category...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L104-L178
020f63ed00782930af87d74b6bcf5713c5b894d5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
MARK: - Plan
export class Plan { // 用于db保存 planId : number | null; planName : string | null; startDate : Date | null; distances : number[]; // 进度: 即currentDayOf 的index process : number; // 暂时未用 // 关联的bookId bookId : number | null; // 第天多少个新字 countPerDay : number; // 将words...
AST#export_declaration#Left export AST#class_declaration#Left class Plan AST#class_body#Left { // 用于db保存 AST#property_declaration#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#ty...
export class Plan { planId : number | null; planName : string | null; startDate : Date | null; distances : number[]; process : number; bookId : number | null; countPerDay : number; pieces : Piece[]; boxes : Box[]; learns : L...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L14-L517
f5b7909acaab4aa8cec7e6f14a40047f4d2a5bf4
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
create
Replaces the original constructor to process arguments and return a textDecoder object. @param { string } [encoding] - Decoding format @param { TextDecoderOptions } [options] - Options @returns { TextDecoder } @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
static create(encoding?: string, options?: TextDecoderOptions): TextDecoder;
AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left encoding ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left TextDecoderOption...
static create(encoding?: string, options?: TextDecoderOptions): TextDecoder;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L818-L818
02d2582326aa77b7801d24d41a717a8199a6d9bd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets
arkts
trackEvent
记录用户行为事件
async trackEvent( eventType: string, eventCategory: string, properties: Record<string, string | number | boolean> = {}, userId: string = 'anonymous', duration?: number ): Promise<void> { try { if (!this.collectBehaviorData) return; const event: UserBehaviorEvent = { id: `e...
AST#method_declaration#Left async trackEvent AST#parameter_list#Left ( AST#parameter#Left eventType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventCategory : AST#type_annotation#Left AST#primary_type#Left string AST#...
async trackEvent( eventType: string, eventCategory: string, properties: Record<string, string | number | boolean> = {}, userId: string = 'anonymous', duration?: number ): Promise<void> { try { if (!this.collectBehaviorData) return; const event: UserBehaviorEvent = { id: `e...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L334-L370
984e5102c5c95aa8ad9d5e2ad3dfc06b34df13db
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/util.ets
arkts
RFC3339 serialize google.protobuf.Timestamp seconds as bigint, nanos as number (0..999,999,999)
export function timestampToJson(seconds: bigint, nanos: number): string { const ms = Number(seconds) * 1000 if (ms < Date.parse('0001-01-01T00:00:00Z') || ms > Date.parse('9999-12-31T23:59:59Z')) { throw new Error('google.protobuf.Timestamp out of range') } if (nanos < 0) throw new Error('google.protobuf.Ti...
AST#export_declaration#Left export AST#function_declaration#Left function timestampToJson AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left nanos : AST#type_annotation#Lef...
export function timestampToJson(seconds: bigint, nanos: number): string { const ms = Number(seconds) * 1000 if (ms < Date.parse('0001-01-01T00:00:00Z') || ms > Date.parse('9999-12-31T23:59:59Z')) { throw new Error('google.protobuf.Timestamp out of range') } if (nanos < 0) throw new Error('google.protobuf.Ti...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L135-L149
70840458072e2cab09f1fe4e979a6093f6f30ffd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets
arkts
draw
画心率变动图
draw() { this.context.clearRect(0, 0, this.viewWidth, this.viewHeight); this.drawCoordinate(); this.drawHeartRateLine(); }
AST#method_declaration#Left draw AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#exp...
draw() { this.context.clearRect(0, 0, this.viewWidth, this.viewHeight); this.drawCoordinate(); this.drawHeartRateLine(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets#L103-L107
768e649379e0c74840c65fa063ab99dcc91fde3f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
getWifiStatus
查询WLAN是否已使能,可以帮助用户快速了解自己是否可以使用Wi-Fi网络进行连接。 当Wi-Fi跟蜂窝同时存在时,有助于实现网络连接的无缝切换。 @returns true:已使能, false:未使能
getWifiStatus(): boolean { try { let isWifiActive: boolean = wifiManager.isWifiActive(); return isWifiActive; } catch (error) { logger.error("failed:" + JSON.stringify(error)); } return false; }
AST#method_declaration#Left getWifiStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left ...
getWifiStatus(): boolean { try { let isWifiActive: boolean = wifiManager.isWifiActive(); return isWifiActive; } catch (error) { logger.error("failed:" + JSON.stringify(error)); } return false; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L222-L230
a6ee7e1d823ccaf990ed311325412ad7819857df
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
register
用户注册 @param {Record<string, string>} params - 注册参数 @returns {Promise<NetworkResponse<Auth>>} 注册结果
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/register", params); return response.data; }
AST#method_declaration#Left async register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotat...
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/register", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L38-L42
024709e264c72e4398bae48455884c6044dc3364
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/common/Index.ets
arkts
logger
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { logger } from './src/main/ets/util/Logger';
AST#export_declaration#Left export { logger } from './src/main/ets/util/Logger' ; AST#export_declaration#Right
export { logger } from './src/main/ets/util/Logger';
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/common/Index.ets#L16-L16
e8560df950481c36c79a2af0b4f3267a52105d89
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
setXAxisLabelPosition
设置标签绘制位置 @param position - 绘制位置,可以是 LabelPosition.Left, LabelPosition.Center, LabelPosition.Right
public setXAxisLabelPosition(position: XAxisLabelPosition): void { this.xAxisLabelPosition = position; }
AST#method_declaration#Left public setXAxisLabelPosition AST#parameter_list#Left ( AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left XAxisLabelPosition AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
public setXAxisLabelPosition(position: XAxisLabelPosition): void { this.xAxisLabelPosition = position; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L171-L173
0a666954bdba5b839a0e9dcf8532dccfdf1f421d
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets
arkts
copy
@param dataSet
public copy(): DataSet<T> { return null; }
AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Rig...
public copy(): DataSet<T> { return null; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets#L182-L184
212d0085b7a374e39d2a282ef7151eb78af57b0b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
startTimer
开始计时(从初始状态)
private startTimer() { if (this.isRunning) return; // 开始是从初始状态启动,需要重置当前时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中..."; this.statusPromptColor=Color.Green; this.resumeTimer(); }
AST#method_declaration#Left private startTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRunning AST#member_expression#Right AST#expression...
private startTimer() { if (this.isRunning) return; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中..."; this.statusPromptColor=Color.Green; this.resumeTimer(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L69-L76
f2a74fd91d68c1cf02e0b1950a4213482494f725
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showLoadingProgress
显示进度条加载弹框
static showLoadingProgress(options: LoadingProgressOptions): string { ActionParameter.initLoadingDefault(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(LoadingProgressBuilder), options); CacheHelper.put(`${CacheHelper.CACHE_LABEL}${dialogId}`, options); //缓存加载框options ...
AST#method_declaration#Left static showLoadingProgress AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#...
static showLoadingProgress(options: LoadingProgressOptions): string { ActionParameter.initLoadingDefault(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(LoadingProgressBuilder), options); CacheHelper.put(`${CacheHelper.CACHE_LABEL}${dialogId}`, options); return dial...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L332-L337
a9ea6094149ececa7cca644c53e5f330c71ed1c6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/xcomponentvsync/src/main/ets/pages/XcomponentVsync.ets
arkts
XcomponentVsyncComponent
功能描述: XComponent 提供了应用在 native 侧调用 OpenGLES 图形接口的能力,本文主要介绍如何配合 Vsync 事件,完成自定义动画。在这种实现方式下,自定义动画的绘制不在 UI 主线程中完成,即使主线程卡顿,动画效果也不会受影响。 推荐场景: 自定义动画 核心组件: 1. XComponent 实现步骤: 1. CMakelists 增加 lib 依赖 2. 创建 vsync 实例 3. 创建 OH_NativeVSync_RequestFrame 回调,并在回调中使用 egl 接口进行绘制
@Component export struct XcomponentVsyncComponent { build() { Stack() { XComponent({ id: Date.now().toString(), type: XComponentType.SURFACE, libraryname: 'entry' }) .onLoad(() => { logger.info('PluginRender:: surface onLoad') }) .onDestroy(() ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct XcomponentVsyncComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_conte...
@Component export struct XcomponentVsyncComponent { build() { Stack() { XComponent({ id: Date.now().toString(), type: XComponentType.SURFACE, libraryname: 'entry' }) .onLoad(() => { logger.info('PluginRender:: surface onLoad') }) .onDestroy(() ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/xcomponentvsync/src/main/ets/pages/XcomponentVsync.ets#L32-L54
0afe6964ea1a26ddb9ab2f77b1dbcee9e876ccd8
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets
arkts
setHighlightLineWidth
Sets the width of the highlight line in dp. @param width
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.convertDpToPixel(width); }
AST#method_declaration#Left public setHighlightLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr...
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.convertDpToPixel(width); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets#L77-L79
7a102589021f2f9f2a83ff529adf9b243ee5fe72
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/model/DialogConfig.ets
arkts
TODO 弹窗工具类,默认样式参数 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class DialogConfig { //------------------------------------公共参数---promptAction.BaseDialogOptions---------------------------------------- uiAbilityContext?: common.UIAbilityContext; //设置UIAbilityContext backCancel: boolean = true; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。true表示关闭弹窗。false表示不关闭弹窗。默认值...
AST#export_declaration#Left export AST#class_declaration#Left class DialogConfig AST#class_body#Left { //------------------------------------公共参数---promptAction.BaseDialogOptions---------------------------------------- AST#property_declaration#Left uiAbilityContext ? : AST#type_annotation#Left AST#primary_type#Left AST...
export class DialogConfig { uiAbilityContext?: common.UIAbilityContext; backCancel: boolean = true; autoCancel: boolean = true; alignment: DialogAlignment = DialogAlignment.Default; offset: Offset = { dx: 0, dy: 0 }; maskRect: Rectangle = { x: 0, y: 0, width: '100%', height: '100%' }; maskColor...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/model/DialogConfig.ets#L28-L119
a762e7dcc49fafd47ab523a21dac4600ba799c11
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
removeItem
移除数据 @param key 键 @param config 存储配置 @returns 操作结果
static async removeItem(key: string, config?: StorageConfig): Promise<StorageResult<void>> { try { if (!this.isInitialized) { throw new Error('StorageManager 未初始化'); } const storageName = config?.name || AppConstants.STORAGE_NAME; const prefs = this.preferences.get(storageName); ...
AST#method_declaration#Left static async removeItem AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left StorageConfig A...
static async removeItem(key: string, config?: StorageConfig): Promise<StorageResult<void>> { try { if (!this.isInitialized) { throw new Error('StorageManager 未初始化'); } const storageName = config?.name || AppConstants.STORAGE_NAME; const prefs = this.preferences.get(storageName); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L150-L172
8147d63463171f5ba5b5397faa35428bbce4e15f
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SplitLayout.d.ets
arkts
SplitLayout
Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 @noninterop
@Component export declare struct SplitLayout { /** * Container in the user-defined splitlayout display area. * @type { container: () => void }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Container in the user-defined splitlayout display area. * @type { container: () => voi...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SplitLayout AST#component_body#Left { /** * Container in the user-defined splitlayout display area. * @type { container: () => void }. * @syscap SystemCapability.ArkUI.A...
@Component export declare struct SplitLayout { @BuilderParam container: () => void; @State mainImage: ResourceStr; @Prop primaryText: ResourceStr; @Prop secondaryText?: ResourceStr; @Prop tertiaryText?: ResourceStr; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SplitLayout.d.ets#L37-L113
aacb6bd998ff9c2c2fcd8542450dd6cf237e03b4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
arkts
toModel
将数据库实体转换为领域模型 @param {SearchHistoryEntity} entity 数据库实体 @returns {SearchHistory} 领域模型
private toModel(entity: SearchHistoryEntity): SearchHistory { const history: SearchHistory = new SearchHistory(); history.keyword = entity.keyword ?? ""; history.searchTime = entity.searchTime ?? Date.now(); return history; }
AST#method_declaration#Left private toModel AST#parameter_list#Left ( AST#parameter#Left entity : AST#type_annotation#Left AST#primary_type#Left SearchHistoryEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SearchHist...
private toModel(entity: SearchHistoryEntity): SearchHistory { const history: SearchHistory = new SearchHistory(); history.keyword = entity.keyword ?? ""; history.searchTime = entity.searchTime ?? Date.now(); return history; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L122-L127
e691c62005c64fe531c63e4e4f8e6e25a1c4e65c
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets
arkts
getRdbStore
Obtaining rdbStore.
getRdbStore() { let getPromiseRdb = dataRdb.getRdbStore(getContext(), { name: CommonConstants.DATABASE_NAME, securityLevel: dataRdb.SecurityLevel.S1 }); getPromiseRdb.then(rdbStore => { this.rdbStore = rdbStore; this.rdbStore.executeSql(this.sqlCreateTable); }).catch((err: Error) => { Logg...
AST#method_declaration#Left getRdbStore AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left getPromiseRdb = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expres...
getRdbStore() { let getPromiseRdb = dataRdb.getRdbStore(getContext(), { name: CommonConstants.DATABASE_NAME, securityLevel: dataRdb.SecurityLevel.S1 }); getPromiseRdb.then(rdbStore => { this.rdbStore = rdbStore; this.rdbStore.executeSql(this.sqlCreateTable); }).catch((err: Error) => { Logg...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets#L37-L45
5b769319aa325aee648d785e8c86ec307d86fa00
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/CameraService.ets
arkts
摄像头设备接口
export interface CameraDevice { id: string; name: string; status?: string; ip?: string; port?: number; channel?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CameraDevice AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AS...
export interface CameraDevice { id: string; name: string; status?: string; ip?: string; port?: number; channel?: number; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L6-L13
0eb293ecf4ea7ad8c63af8f5a94700e41b6a996e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
setLabelXOffset
设置标签在 X 轴上的偏移量 @param xOffset - 偏移量
public setLabelXOffset(xOffset: number): void { this.mLabelXOffset = xOffset; }
AST#method_declaration#Left public setLabelXOffset AST#parameter_list#Left ( AST#parameter#Left xOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
public setLabelXOffset(xOffset: number): void { this.mLabelXOffset = xOffset; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L155-L157
8e1ac7386485c50dea20835371ee961c504fdec2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
@Author csx @DateTime 2024/3/19 21:42 @TODO CryptoUtil 加解密工具类
export class CryptoUtil { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @returns * @returns */ static async convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number) { let symKeyBlob: crypto.DataBlob = { data: S...
AST#export_declaration#Left export AST#class_declaration#Left class CryptoUtil AST#class_body#Left { /** * 将非对称加密字符串pubKey转换为symKey对象 * @param publicKey字符串key * @param symAlgName 秘钥规格 * @param keyName 密钥长度 * @returns * @returns */ AST#method_declaration#Left static async convertPubKeyFromStr AST#pa...
export class CryptoUtil { static async convertPubKeyFromStr(publicKey: string, symAlgName: string, keyName: number) { let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.stringToByteArray(publicKey, keyName) }; let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = await aesGene...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L27-L417
adfc32c0da4a61bd1414095865844c2e85889eb7
gitee
de8gemaker/AccountApp.git
b5156cd90ac02239b39fd0f91d32851acad8ba42
entry/src/main/ets/service/account.ets
arkts
getAccountByYear
按年份获取账单记录
getAccountByYear(time: string | number) { const startMonth = dayjs(time).startOf('year').toDate().getTime(); const endMonth = dayjs(time).endOf('year').toDate().getTime(); return AccountModel.queryByDateRange(startMonth, endMonth); }
AST#method_declaration#Left getAccountByYear AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST...
getAccountByYear(time: string | number) { const startMonth = dayjs(time).startOf('year').toDate().getTime(); const endMonth = dayjs(time).endOf('year').toDate().getTime(); return AccountModel.queryByDateRange(startMonth, endMonth); }
https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/service/account.ets#L38-L42
811a697c9b8c1b1d415a62980f2848f76eaf06b5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
getCommunityEvents
获取社区活动
async getCommunityEvents(status?: string, limit: number = 20): Promise<CommunityEvent[]> { try { // TODO: 实现真实的API调用 return this.getMockEvents(limit); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get community events: ${error}`); return...
AST#method_declaration#Left async getCommunityEvents AST#parameter_list#Left ( AST#parameter#Left status ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#p...
async getCommunityEvents(status?: string, limit: number = 20): Promise<CommunityEvent[]> { try { return this.getMockEvents(limit); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get community events: ${error}`); return []; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L548-L557
dee797e5428a6992223a1f9b2d8b9c86b18185eb
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/localization/I18nManager.ets
arkts
getCurrentLanguage
获取当前语言
getCurrentLanguage(): Language { return this.currentLanguage; }
AST#method_declaration#Left getCurrentLanguage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Language 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...
getCurrentLanguage(): Language { return this.currentLanguage; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/localization/I18nManager.ets#L92-L94
ee33afd4630e7ed9175cc808b1f152b219913987
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AddressRepository.ets
arkts
构造函数 @param networkDataSource 可选的网络数据源实例
constructor(networkDataSource?: AddressNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AddressNetworkDataSourceImpl(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left AddressNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement...
constructor(networkDataSource?: AddressNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AddressNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L18-L20
819a29aad285d783d13dba7b65c5b146cd956004
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PathUtility.ets
arkts
getLastComponentName
获取路径的最后组成部分(文件或目录名) @param filePath 完整路径 @returns 最后一级名称
static getLastComponentName(filePath: string): string { if (!filePath) throw new Error('Path cannot be null'); // 处理以斜杠结尾的目录路径 if (filePath.endsWith('/')) { const trimmed = filePath.substring(0, filePath.length - 1); const lastSlash = trimmed.lastIndexOf('/'); return lastSlash >= 0 ? trim...
AST#method_declaration#Left static getLastComponentName AST#parameter_list#Left ( AST#parameter#Left filePath : 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 AS...
static getLastComponentName(filePath: string): string { if (!filePath) throw new Error('Path cannot be null'); if (filePath.endsWith('/')) { const trimmed = filePath.substring(0, filePath.length - 1); const lastSlash = trimmed.lastIndexOf('/'); return lastSlash >= 0 ? trimmed.substring(l...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L98-L111
ab4e31ca74245fa5c2ef5f8cee86e24a94ff37ef
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
DatabaseItem
渲染单条记录 @param {DemoEntity} item - 记录数据 @returns {void} 无返回值
@Builder private DatabaseItem(item: DemoEntity): void { IBestSwipeCell({ defaultContent: (): void => this.SwipeCellContent(item), rightContent: (): void => this.SwipeCellActions(item) }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private DatabaseItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DemoEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
@Builder private DatabaseItem(item: DemoEntity): void { IBestSwipeCell({ defaultContent: (): void => this.SwipeCellContent(item), rightContent: (): void => this.SwipeCellActions(item) }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L135-L141
370e5f4b10f4c20ea0dfabd81d5556dd3ba14b41
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/components/SwipeCardStack.ets
arkts
getCardRotation
获取卡片旋转
private getCardRotation(_stackIndex: number, dataIndex: number): RotateOptions { if (dataIndex === this.currentIndex) { const rotateOptions: RotateOptions = { z: this.topCardAnimation.rotation, angle: this.topCardAnimation.rotation }; return rotateOptions; } else { const ...
AST#method_declaration#Left private getCardRotation AST#parameter_list#Left ( AST#parameter#Left _stackIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataIndex : AST#type_annotation#Left AST#primary_type#Left number...
private getCardRotation(_stackIndex: number, dataIndex: number): RotateOptions { if (dataIndex === this.currentIndex) { const rotateOptions: RotateOptions = { z: this.topCardAnimation.rotation, angle: this.topCardAnimation.rotation }; return rotateOptions; } else { const ...
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L341-L355
a5dd9e636311af3dd137c2de6ca43dfb4d852461
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
TODO SHA工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class SHA { private static symKey = CryptoUtil.generateSymKeySync('HMAC|SHA256'); //对称密钥SymKey /** * SHA摘要,同步 * @param data 待摘要的数据 * @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512)。 * @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 * @returns */ static async digest(data: strin...
AST#export_declaration#Left export AST#class_declaration#Left class SHA AST#class_body#Left { AST#property_declaration#Left private static symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKeySync AST#mem...
export class SHA { private static symKey = CryptoUtil.generateSymKeySync('HMAC|SHA256'); static async digest(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex'): Promise<string> { return CryptoUtil.digest(data, algName, resultCoding); } static digestSync(data:...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L25-L134
ab5a6969b6611b939776f0921a8f3bfdc19f7f77
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
dynamicKey
密钥协商,异步 @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等) @param pubKey 公钥(一般为外部传入) @param priKey 私钥 @param coding 编码方式(base64/hex/utf8/utf-8) @returns 共享密钥
static async dynamicKey(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): Promise<string> { if (typeof pubKey === 'string') { pubKey = CryptoHelper.strToUint8Array(pubKey, coding); } if (typeof priKey === 'string') { priKey = CryptoHelper.strTo...
AST#method_declaration#Left static async dynamicKey AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_typ...
static async dynamicKey(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): Promise<string> { if (typeof pubKey === 'string') { pubKey = CryptoHelper.strToUint8Array(pubKey, coding); } if (typeof priKey === 'string') { priKey = CryptoHelper.strTo...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L443-L459
2c1d2fefc2da8f23bb92d8eff0e420c4499d8db7
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/utils/FileUtil.ets
arkts
downloadFile
下载文件
static downloadFile(fileName: string, fileSuffix: string, fileUrl: string): Promise<boolean> { return new Promise<boolean>((resolve, reject) => { // 判断文件是否已存在 FileUtil.isExist(fileName, fileSuffix) request.downloadFile(context, { url: fileUrl, filePath: filesDir + '/' + fileName + ...
AST#method_declaration#Left static downloadFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileSuffix : AST#type_annotation#Left AST#primary_type#Left string AST#p...
static downloadFile(fileName: string, fileSuffix: string, fileUrl: string): Promise<boolean> { return new Promise<boolean>((resolve, reject) => { FileUtil.isExist(fileName, fileSuffix) request.downloadFile(context, { url: fileUrl, filePath: filesDir + '/' + fileName + '.' + fileSu...
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/FileUtil.ets#L28-L44
7e13f565356159ba6f482d43057e32a7c8ec9ca4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_segmentation/RSASegmentationSync.ets
arkts
rsaDecryptBySegment
分段解密消息
function rsaDecryptBySegment(priKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('RSA1024|PKCS1'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, priKey, null); let cipherTextSplitLen = 128; // RSA密钥每次加密生成的密文字节长度计算方式:密钥位数/8 let decryptTex...
AST#function_declaration#Left function rsaDecryptBySegment AST#parameter_list#Left ( AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L...
function rsaDecryptBySegment(priKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('RSA1024|PKCS1'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, priKey, null); let cipherTextSplitLen = 128; let decryptText = new Uint8Array(); for (let...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_segmentation/RSASegmentationSync.ets#L40-L57
140c69112711b5557f20816d405213ba0f5cc938
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @returns
static encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); // 初始化加解密操作环境 let mode ...
AST#method_declaration#Left static encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); let mode = crypto.CryptoMode....
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L186-L202
32b77adb84d3e6d303b24a0c315c35a36a50d587
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/widgets/pages/WidgetCard4x4.ets
arkts
buildTodayBirthdays
构建今日生日
@Builder buildTodayBirthdays() { const todayBirthdays = this.widgetData.birthdayList.filter((item: any) => item.isToday); if (todayBirthdays.length > 0) { Column({ space: 8 }) { Row() { Image($r('app.media.ic_cake')) .width(16) .height(16) .fill...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTodayBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todayBirthdays = AST#expression#Left AST#call_expression#Le...
@Builder buildTodayBirthdays() { const todayBirthdays = this.widgetData.birthdayList.filter((item: any) => item.isToday); if (todayBirthdays.length > 0) { Column({ space: 8 }) { Row() { Image($r('app.media.ic_cake')) .width(16) .height(16) .fill...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard4x4.ets#L78-L105
9214a990a5ce5440d11bfb0b16b577a9d8b0d981
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.app.d.ets
arkts
requestFullWindow
Requests the application to run in full window. In some scenarios, such as semi-modal FA, the FA runs in non-full window. In this case, you can call this API. This API is invalid for an application already in full-window mode. @param { RequestFullWindowOptions } options Transition time from non-full window to full win...
static requestFullWindow(options?: RequestFullWindowOptions): void;
AST#method_declaration#Left static requestFullWindow AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left RequestFullWindowOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
static requestFullWindow(options?: RequestFullWindowOptions): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L295-L295
c58e537e2460f8faba2e58ba553dddf130f1d7c8
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
interfaces/ets/ani/animator/ets/@ohos.animator.ets
arkts
native
set and get onRepeat
private native setOnRepeat(value: () => void) : void;
AST#method_declaration#Left private native AST#ERROR#Left setOnRepeat AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS...
private native setOnRepeat(value: () => void) : void;
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/animator/ets/@ohos.animator.ets#L84-L84
10d65bd81a42d0fe733aa34e40b9d518e58238d8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets
arkts
cancelSuspendDelay
取消短时任务
cancelSuspendDelay() { backgroundTaskManager.cancelSuspendDelay(this.requestId); console.info('Request suspension delay cancel.'); }
AST#method_declaration#Left cancelSuspendDelay 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 backgroundTaskManager AST#expression#Right . ...
cancelSuspendDelay() { backgroundTaskManager.cancelSuspendDelay(this.requestId); console.info('Request suspension delay cancel.'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets#L45-L48
72a5ef48904992970c1f3e1f3c6846883ac4c3bb
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
startWatchdog
启动超时看门狗
private startWatchdog() { this.clearWatchdog(); this.watchdogTimer = setTimeout(() => { this.logService.warn('TTS', '播放超时,强制重置'); this.stop(); // 停止当前 // stop() 会清空队列,但我们需要继续播放剩下的(如果需要的话),或者仅仅跳过当前? // stop() 实现中清空了队列。如果只是单个超时,我们可能只想跳过这一个。 // 但为了简单起见,超时通常意味着引擎卡死,重置是安全的。 }, this....
AST#method_declaration#Left private startWatchdog 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 this AST#expression#Right . clearWatchdog ...
private startWatchdog() { this.clearWatchdog(); this.watchdogTimer = setTimeout(() => { this.logService.warn('TTS', '播放超时,强制重置'); this.stop(); }, this.TIMEOUT_MS); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L275-L284
13479047d63ffd93d8d0faca2c8458f0d8b7dc31
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/TextPickerOptions.ets
arkts
TODO 弹窗工具类,TextPicker参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface TextPickerOptions extends BasePickerOptions { value?: string | string[]; //选中 range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]; onChange?: (value: string | string[], index: number | number[]) => void; //滑动选中TextPicker文本内容后,触发该回调。 // selected?...
AST#export_declaration#Left export AST#interface_declaration#Left interface TextPickerOptions AST#extends_clause#Left extends BasePickerOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left value ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right ...
export interface TextPickerOptions extends BasePickerOptions { value?: string | string[]; range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]; onChange?: (value: string | string[], index: number | number[]) => void; onAction: ActionValueCallBack; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/TextPickerOptions.ets#L26-L34
795b515d779cc5ddf7a39479454291ac39990bf8
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringDealUtility.ets
arkts
removedDuplicationsBySep
/ 去重(按指定的符号分割后,去除重复的内容)
public static removedDuplicationsBySep( srcStr : string, seperator : string, subSeperator : string ): string | null { const tempList: Array<string> = []; return StringDealUtility.deal( srcStr, seperator, subSeperator, new RemoveDuplicateTransform(tempList) ); ...
AST#method_declaration#Left public static removedDuplicationsBySep AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#L...
public static removedDuplicationsBySep( srcStr : string, seperator : string, subSeperator : string ): string | null { const tempList: Array<string> = []; return StringDealUtility.deal( srcStr, seperator, subSeperator, new RemoveDuplicateTransform(tempList) ); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L65-L78
ac26e76690c321169401b6771924df5d8a99982d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHASync.ets
arkts
@Author csx @DateTime 2024/3/20 21:43 @TODO SHA @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class SHASync { /** * SHA1摘要 * @param str 带摘要的字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 摘要后的字符串 */ static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA1', resultCoding); } /** ...
AST#export_declaration#Left export AST#class_declaration#Left class SHASync AST#class_body#Left { /** * SHA1摘要 * @param str 带摘要的字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 摘要后的字符串 */ AST#method_declaration#Left static digestSHA1 AST#parameter_list#Left ( AST#parameter#Left st...
export class SHASync { static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA1', resultCoding); } static digestSHA224(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SH...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L28-L88
632ec68a6e61e3b8a39653c06461e84b8ec2ca0c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
loadProviders
加载提供商列表
private loadProviders(): void { this.providers = this.llmService.getAllProviders(); }
AST#method_declaration#Left private loadProviders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ...
private loadProviders(): void { this.providers = this.llmService.getAllProviders(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L43-L45
d6c089b766a55bbedf7b7269e4def54903bb2904
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
has
判断是否存在 数据 @param key 要查找的索引 @returns Promise<AssetStoreResult> 表示添加操作的异步结果
public static async has(key: string): Promise<AssetStoreResult> { if (canIUse("SystemCapability.Security.Asset")) { let query: asset.AssetMap = new Map(); // 关键资产别名,每条关键资产的唯一索引。 // 类型为Uint8Array,长度为1-256字节。 query.set(asset.Tag.ALIAS, AssetStore.stringToArray(key)); // 关键资产查询返回的结果类型。 ...
AST#method_declaration#Left public static async has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
public static async has(key: string): Promise<AssetStoreResult> { if (canIUse("SystemCapability.Security.Asset")) { let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, AssetStore.stringToArray(key)); query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL); ...
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L168-L188
7fa5726548aaa1e2a181ba7569d22d09ad6e7e25
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getUnitById
根据单元ID获取单元
getUnitById(unitId: number): Unit | undefined { return this.units.find(unit => unit.unitId === unitId); }
AST#method_declaration#Left getUnitById AST#parameter_list#Left ( AST#parameter#Left unitId : 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#union_type#Left AST#primary_type#Left Unit AS...
getUnitById(unitId: number): Unit | undefined { return this.units.find(unit => unit.unitId === unitId); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L397-L399
18b6fb9369ed14fff8d7a3b6999cb27d17c9e315
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
toLocalStorage
跳转到本地存储示例页 @returns {void} 无返回值
static toLocalStorage(): void { navigateTo(DemoRoutes.LocalStorage); }
AST#method_declaration#Left static toLocalStorage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#membe...
static toLocalStorage(): void { navigateTo(DemoRoutes.LocalStorage); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L39-L41
1fce117bed0c0284c8cd4839a524201436b1da7b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/RouteGraph.ets
arkts
路由图接口 每个模块实现该接口来注册自己的路由 @author Joker.X
export interface RouteGraph { /** * 注册路由 */ register(): void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RouteGraph AST#object_type#Left { /** * 注册路由 */ AST#type_member#Left register 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#...
export interface RouteGraph { register(): void; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/RouteGraph.ets#L6-L11
2bd051f611d4ccb2e37373a123fdc171e8e35f24
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/pages/MainPage.ets
arkts
deleteListItem
删除选中的列表项
deleteListItem() { this.accountTable.batchDelete(this.deleteList, () => { this.onAccountsChange(); }); this.deleteList = []; this.isEdit = false; }
AST#method_declaration#Left deleteListItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left th...
deleteListItem() { this.accountTable.batchDelete(this.deleteList, () => { this.onAccountsChange(); }); this.deleteList = []; this.isEdit = false; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/MainPage.ets#L80-L86
9e12a88335c66ba8f48347591461a27b89f40bde
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets
arkts
initSun
日出日落图 @param context @param img
function initSun(context: CanvasRenderingContext2D, img: ImageBitmap) { /* * 根据日出日落时间点绘制 * 获取两个时间点 * 分割成一个半圆 * 角度换算刻度 * 绘制 */ try { let begin = resourceManager!.getStringSync($r('app.string.sunrise_begin').id); let final = resourceManager!.getStringSync($r('app.string.sunset_final').id); ...
AST#function_declaration#Left function initSun AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left Ima...
function initSun(context: CanvasRenderingContext2D, img: ImageBitmap) { try { let begin = resourceManager!.getStringSync($r('app.string.sunrise_begin').id); let final = resourceManager!.getStringSync($r('app.string.sunset_final').id); let now = new Date(); let time: number = now.getHours(); le...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets#L27-L103
b663b90f86cb11a8192eaf83637ce4a8a8ca2248
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/ClinetConf.ets
arkts
客户端配置
export interface ClientConf { /** * 设备id,在平台注册设备获得,生成规则:productId_nodeId */ deviceId: string; /** * 设备密码,使用密码认证时填写 */ secret: string; /** * 设备接入平台地址,比如tcp://localhost:1883 或者 ssl://localhost:8883 */ serverUri: string; /** * 协议类型,当前仅支持mqtt */ protocol?: string; /** * 离线消息...
AST#export_declaration#Left export AST#interface_declaration#Left interface ClientConf AST#object_type#Left { /** * 设备id,在平台注册设备获得,生成规则:productId_nodeId */ AST#type_member#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ;...
export interface ClientConf { deviceId: string; secret: string; serverUri: string; protocol?: string; offlineBufferSize?: number; qos?: IoTMqttQos; mode?: number; caFilePath?: string; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/ClinetConf.ets#L20-L60
11509ab3c7f9bdb72194a2eb749b7fb2b4e4af00
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/RandomUtil.ets
arkts
randomInt
获得随机数number值 @return 随机数
static randomInt(): number { return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); }
AST#method_declaration#Left static randomInt 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#call_expressio...
static randomInt(): number { return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RandomUtil.ets#L65-L67
8b7372738ebab6c0cbd7f2761e68bf191b75363a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
digestSegment
SHA摘要,分段,同步 @param data 待摘要的数据 @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static async digestSegment(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex', len: number = 120): Promise<string> { return CryptoUtil.digestSegment(data, algName, resultCoding, len); }
AST#method_declaration#Left static async digestSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualifie...
static async digestSegment(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex', len: number = 120): Promise<string> { return CryptoUtil.digestSegment(data, algName, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L63-L66
b034e5359da95b9a60666a8b42616f6d5148b3a1
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
Fits tools with different sizes and lengths
export default class DimensionUtil { static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDi...
AST#export_declaration#Left export default AST#class_declaration#Left class DimensionUtil AST#class_body#Left { AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AS...
export default class DimensionUtil { static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDi...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets#L25-L58
b0a53f1738899e343179db163a26268b5bf2df0a
gitee
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets
arkts
HomeTabs
首页Tab页签("场景","设备")
@Component export struct HomeTabs { deleteDeviceName: string ='phone' deleteDeviceId: string ='phone' private scroller: Scroller = new Scroller() private controller: TabsController = new TabsController() @State homeTabIndex: number = 0 @State carryDevices: any[] = [] //随身设备 @State homeDevices: any[] = [] ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HomeTabs AST#component_body#Left { AST#property_declaration#Left deleteDeviceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expressio...
@Component export struct HomeTabs { deleteDeviceName: string ='phone' deleteDeviceId: string ='phone' private scroller: Scroller = new Scroller() private controller: TabsController = new TabsController() @State homeTabIndex: number = 0 @State carryDevices: any[] = [] @State homeDevices: any[] = [] @St...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets#L66-L132
aa287ef843cb898dea3db3a28da49ec8f8e85ab1
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
entry/src/main/ets/common/GlobalContext.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/entry/src/main/ets/common/GlobalContext.ets#L16-L37
ad04498f1a06c8bd0e792efb3a7a85f0bb7f397a
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AddressRepository.ets
arkts
getAddressList
查询地址列表 @returns 地址列表
async getAddressList(): Promise<NetworkResponse<Address[]>> { return this.networkDataSource.getAddressList(); }
AST#method_declaration#Left async getAddressList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AS...
async getAddressList(): Promise<NetworkResponse<Address[]>> { return this.networkDataSource.getAddressList(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L44-L46
e1cd88048133d535e6a4a5de844500ea955cf43d
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/buttons/TextStyleButton.ets
arkts
TextStyleButton
========================== 5. 使用 @ComponentV2 定义按钮组件 ==========================
@ComponentV2 export struct TextStyleButton { @Param text : ResourceStr = ''; // 按钮标题 @Param style : TextStyleButtonStyle = TextStyleButtonStyle.DEFAULT; // 按钮样式 @Event onClickCallBack : () => void = () => {} @Param isSelected : boolean = false; // 是否...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TextStyleButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#typ...
@ComponentV2 export struct TextStyleButton { @Param text : ResourceStr = ''; @Param style : TextStyleButtonStyle = TextStyleButtonStyle.DEFAULT; @Event onClickCallBack : () => void = () => {} @Param isSelected : boolean = false; @Param isEnabled...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/buttons/TextStyleButton.ets#L27-L129
f08466aad5afdfd578263340e875c44dc3f6aec7
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
imageSize
弹窗图标大小 @param imageSize @returns
imageSize(imageSize: SizeOptions) { this.builderOptions.imageSize = imageSize return this; }
AST#method_declaration#Left imageSize AST#parameter_list#Left ( AST#parameter#Left imageSize : AST#type_annotation#Left AST#primary_type#Left SizeOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement...
imageSize(imageSize: SizeOptions) { this.builderOptions.imageSize = imageSize return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L39-L42
55cd2bb621853acd8710a976fab9f7c18ce61d88
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isInt32Array
Check whether the entered value is the int32array array type. @param { Object } value - A Int32Array value @returns { boolean } Returns true if the value is a built-in Int32Array instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isInt32Array(value: Object): boolean;
AST#method_declaration#Left isInt32Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri...
isInt32Array(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1257-L1257
a3542f812f3a7f897f896a79de61e58ffc964c90
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_height_nowear/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 dex: number = 0 @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number, ...
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 dex: number = 0 @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number, ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_height_nowear/entry/src/main/ets/MainAbility/view/position/NavigationView.ets#L16-L69
cdd92227fedce69e21176aefe4fbc0dd9fc46e60
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/pages/Advertising.ets
arkts
onPageHide
生命周期函数:隐藏页面
onPageHide() { // 清除定时任务 clearInterval(this.endTime); }
AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 清除定时任务 AST#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right...
onPageHide() { clearInterval(this.endTime); }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/pages/Advertising.ets#L40-L43
e9337bade77fa8d80c46ac5f97728d103a8915ed
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
梦想目标简化模型
export interface DreamSimple { id: number; userId: number; title: string; description: string; category: string; priority: number; status: number; completionRate: number; deadline: string; imageUrl: string; isPublic: number; // 在数据库中是tinyint,需要使用number类型 taskCount?: number; completedTaskCount...
AST#export_declaration#Left export AST#interface_declaration#Left interface DreamSimple 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_annotation#Left A...
export interface DreamSimple { id: number; userId: number; title: string; description: string; category: string; priority: number; status: number; completionRate: number; deadline: string; imageUrl: string; isPublic: number; taskCount?: number; completedTaskCount?: number; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L80-L94
c420c2ca1c44a31327f13581b699659df65c01d4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/mockdata.ets
arkts
模拟评论数据
export function mockData(): CommentData { const commentList: CommentData = new CommentData(); commentList.pushData(new FriendMoment("0", "Zoologist", $r("app.media.Zoologist"), "好可爱的小鸟啊", $r("app.media.publish_photo_bird"))); commentList.pushData(new FriendMoment("1", "Scientist", $r("app.media.Scientist"), "...
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 FriendMoment("0", "Zoologist", $r("app.media.Zoologist"), "好可爱的小鸟啊", $r("app.media.publish_photo_bird"))); commentList.pushData(new FriendMoment("1", "Scientist", $r("app.media.Scientist"), "...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/mockdata.ets#L20-L35
edaa7aaa4434f9a4c0184560a2fb41984b3cc445
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
setSegment
限定动画资源播放时的整体帧范围 @param init 起始帧号 @param end 结束帧号 @since 8 @design
setSegment(init: number, end: number) { this.animationItem?.setSegment(init, end) }
AST#method_declaration#Left setSegment AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left end : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS...
setSegment(init: number, end: number) { this.animationItem?.setSegment(init, end) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L220-L222
eab347e82c4be40c9c1e616e2a830b1a148346e9
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/model/CollectInfo.ets
arkts
收藏排行榜 每一首类型
export class RankListItem{ author: string categoryId:number collectCount:number content: string id?: number origin: string userNameArr:string[] constructor
AST#export_declaration#Left export AST#ERROR#Left class RankListItem { author : AST#ERROR#Left string categoryId : number collectCount : number content : string id ? : number orig in : string userNameArr : AST#ERROR#Right AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right A...
export class RankListItem{ author: string categoryId:number collectCount:number content: string id?: number origin: string userNameArr:string[] constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/model/CollectInfo.ets#L25-L34
2f1561c2043b6dcb3ae92db109ce7cae1914f6a1
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/ZFunction.ets
arkts
findLongestCommonPrefix
查找两个字符串的最长公共前缀 @param str1 第一个字符串 @param str2 第二个字符串 @returns 最长公共前缀的长度
static findLongestCommonPrefix(str1: string, str2: string): number { if (!str1 || !str2) { return 0; } const combined = str1 + '$' + str2; const z = ZFunction.computeZArray(combined); let maxLen = 0; for (let i = str1.length + 1; i < combined.length; i++) { if (z[i] > maxLen) { ...
AST#method_declaration#Left static findLongestCommonPrefix AST#parameter_list#Left ( AST#parameter#Left str1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left str2 : AST#type_annotation#Left AST#primary_type#Left string AST#...
static findLongestCommonPrefix(str1: string, str2: string): number { if (!str1 || !str2) { return 0; } const combined = str1 + '$' + str2; const z = ZFunction.computeZArray(combined); let maxLen = 0; for (let i = str1.length + 1; i < combined.length; i++) { if (z[i] > maxLen) { ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/ZFunction.ets#L120-L136
9745c4c70b643139a50c7be419d50477cef48d7d
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
getPieStartAngleIncome
Calculate start angle for income pie chart
getPieStartAngleIncome(index: number): number { let angle = 0; for (let i = 0; i < index; i++) { angle += (this.incomeCategoryStatsList[i].percentage / 100) * 360; } return angle; }
AST#method_declaration#Left getPieStartAngleIncome AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
getPieStartAngleIncome(index: number): number { let angle = 0; for (let i = 0; i < index; i++) { angle += (this.incomeCategoryStatsList[i].percentage / 100) * 360; } return angle; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L240-L246
03f77e8882ddd31e03ce448ac70ffa6d764a1c75
github
kinghy949/kinghy_zufang.git
471cc1273fbea66b88a4b7803e3f08c83a2de7ce
entry/src/main/ets/constants/size.ets
arkts
边距
export const PADDING_S = 10;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PADDING_S = AST#expression#Left 10 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const PADDING_S = 10;
https://github.com/kinghy949/kinghy_zufang.git/blob/471cc1273fbea66b88a4b7803e3f08c83a2de7ce/entry/src/main/ets/constants/size.ets#L2-L2
9743e04eb90af10e566d999dc36d4fddcc8b121e
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/api/emby/EmbyFinApi.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2025/7/6 13:50 @Version V1.0 @Description Emby api
export class EmbyFinApi implements FinVideoApi { private readonly context: Context constructor
AST#export_declaration#Left export AST#ERROR#Left class EmbyFinApi AST#implements_clause#Left implements FinVideoApi AST#implements_clause#Right { private readonly context : Context AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declar...
export class EmbyFinApi implements FinVideoApi { private readonly context: Context constructor
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/api/emby/EmbyFinApi.ets#L17-L21
38dd440bba854e7acd22f5b8678e450dfc6a4eff
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets
arkts
onPageShow
When the SplashScreenPage is displayed, switch to the next page after 3 seconds.
onPageShow() { this.intervalID = setInterval(() => { this.pageShowTime += CommonConstants.INCREMENT_VALUE; if (this.pageShowTime > CommonConstants.DELAY_SECONDS) { router.replace({ url: CommonConstants.MAIN_PAGE_URL }); } }, CommonConstants.INTERVAL_DELAY); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalID AST#member_expression#Right ...
onPageShow() { this.intervalID = setInterval(() => { this.pageShowTime += CommonConstants.INCREMENT_VALUE; if (this.pageShowTime > CommonConstants.DELAY_SECONDS) { router.replace({ url: CommonConstants.MAIN_PAGE_URL }); } }, CommonConstants.INTERVAL_DELAY); }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets#L40-L49
db8e0a80594e5359dfecd8a1a0ae81182851631c
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/FileUtils.ets
arkts
createFolderSync
创建文件夹 @param path 文件夹绝对路径,只有是权限范围内的路径,可以生成 @param recursive
createFolderSync(path: string, recursive?: boolean) { try { if (recursive) { if (!this.existFolder(path)) { let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR) if (lastInterval == 0) { return } let newPath = path.substring(0, lastInterval) ...
AST#method_declaration#Left createFolderSync 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 recursive ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
createFolderSync(path: string, recursive?: boolean) { try { if (recursive) { if (!this.existFolder(path)) { let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR) if (lastInterval == 0) { return } let newPath = path.substring(0, lastInterval) ...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L191-L213
97a0ffe15a33f55159b332bc1cc6b5646a9bf911
gitee
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
@huaweicloud/iot-device-sdk/src/main/ets/client/listener/PropertyListener.d.ets
arkts
属性监听器,用于接收平台下发的属性读写操作
export interface PropertyListener { /** * 处理写属性操作 * * @param requestId 请求id * @param services 服务属性列表 */ onPropertiesSet: (requestId: string, services: ServiceProperty[]) => void; /** * 处理读属性操作 * * @param requestId 请求id * @param serviceId 服务id,可选 */ onPr...
AST#export_declaration#Left export AST#interface_declaration#Left interface PropertyListener AST#object_type#Left { /** * 处理写属性操作 * * @param requestId 请求id * @param services 服务属性列表 */ AST#type_member#Left onPropertiesSet : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left...
export interface PropertyListener { onPropertiesSet: (requestId: string, services: ServiceProperty[]) => void; onPropertiesGet: (requestId: string, serviceId?: string) => void; }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/listener/PropertyListener.d.ets#L5-L20
cb71568f5eac6ced1cfe51ae4dc81058d3e91604
github
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/model/AudioModel.ets
arkts
轮播图
export class Banner { url: string = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class Banner AST#class_body#Left { AST#property_declaration#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right } AST...
export class Banner { url: string = ''; }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/model/AudioModel.ets#L14-L16
252de4ddcebd1e4699608f4b261c289779e51fee
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
generateThumbnail
生成缩略图
async generateThumbnail(mediaPath: string, size: number = 120): Promise<string> { const mediaInfo = await this.getMediaFileInfo(mediaPath); if (mediaInfo.type === MediaType.IMAGE) { return await this.processImage(mediaPath, { width: size, height: size, quality: 80, format:...
AST#method_declaration#Left async generateThumbnail AST#parameter_list#Left ( AST#parameter#Left mediaPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
async generateThumbnail(mediaPath: string, size: number = 120): Promise<string> { const mediaInfo = await this.getMediaFileInfo(mediaPath); if (mediaInfo.type === MediaType.IMAGE) { return await this.processImage(mediaPath, { width: size, height: size, quality: 80, format:...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L601-L617
14fd074e0a5272a6fa39fec82954b4d180dab732
github