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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pendingitems/Index.ets
arkts
ToDoListComponent
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 { ToDoListComponent } from './src/main/ets/pages/ToDoList';
AST#export_declaration#Left export { ToDoListComponent } from './src/main/ets/pages/ToDoList' ; AST#export_declaration#Right
export { ToDoListComponent } from './src/main/ets/pages/ToDoList';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/Index.ets#L16-L16
c6dfd90e1d568f4f0b53b2e419ac0bd8959c53ff
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/app/App.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/7 21:01 @Version V1.0 @Description
export class App extends AbilityStage { onCreate(): void { // https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-light-dark-color-adaptation-V5#section1421172621111 this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); AppStorage.setOrC...
AST#export_declaration#Left export AST#class_declaration#Left class App extends AST#type_annotation#Left AST#primary_type#Left AbilityStage AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotati...
export class App extends AbilityStage { onCreate(): void { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); AppStorage.setOrCreate(AppPrefer.PREFER, new AppPrefer(this.context.getApplicationContext())) AppStorage.setOrCreate(AppConfig.CONFIG, new...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/app/App.ets#L13-L26
fd6a00c7cc4224827bd87cb8cd6a36a70f80e162
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
位置信息接口
export interface Position { x: number; y: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Position AST#object_type#Left { AST#type_member#Left x : 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 y : AST#type_annotation#Left AST#primar...
export interface Position { x: number; y: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L200-L203
4d88393a84b10342688b629870a3696330a016fd
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
checkDueTasks
检查是否有到期的任务(仅检查即将到期的任务,不检查已经过期很久的) @param alertedTaskIds - 已经提醒过的任务ID集合 @returns 到期的任务,如果没有则返回null
checkDueTasks(alertedTaskIds: Set<number>): Task | null { const now = Date.now(); const oneHourAgo = now - 60 * 60 * 1000; // 1小时前 for (const task of this.tasks) { // 跳过已完成的任务 if (task.isDone) continue; // 跳过已经提醒过的任务 if (alertedTaskIds.has(task.id)) continue; // 跳过没有截止时间的任务 ...
AST#method_declaration#Left checkDueTasks AST#parameter_list#Left ( AST#parameter#Left alertedTaskIds : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
checkDueTasks(alertedTaskIds: Set<number>): Task | null { const now = Date.now(); const oneHourAgo = now - 60 * 60 * 1000; for (const task of this.tasks) { if (task.isDone) continue; if (alertedTaskIds.has(task.id)) continue; if (!task.dueTime || task.dueTime === 0) ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L592-L612
2ddd95ef2c78ac9f3e5a9caeeaa220c3bf94af62
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/AppState.ets
arkts
addLoginStateListener
添加登录状态监听
public addLoginStateListener(listener: (isLoggedIn: boolean) => void) { this.loginStateListeners.push(listener); }
AST#method_declaration#Left public addLoginStateListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left isLoggedIn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Rig...
public addLoginStateListener(listener: (isLoggedIn: boolean) => void) { this.loginStateListeners.push(listener); }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L178-L180
f044071a50f549b096806bb418f6886b6b6d3fdf
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/VignetterTransformation.ets
arkts
VignetterTransformation
图片变换:装饰效果
@Sendable export class VignetterTransformation extends PixelMapTransformation { private mXCenter: number = 0.5; private mYCenter: number = 0.5; private mRed: number = 0.0; private mGreen: number = 0.0; private mBlue: number = 0.0; private mStart: number = 0.3; private mEnd: number = 0.75; constructor(c...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class VignetterTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private mXCenter...
@Sendable export class VignetterTransformation extends PixelMapTransformation { private mXCenter: number = 0.5; private mYCenter: number = 0.5; private mRed: number = 0.0; private mGreen: number = 0.0; private mBlue: number = 0.0; private mStart: number = 0.3; private mEnd: number = 0.75; constructor(c...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/VignetterTransformation.ets#L22-L76
d519f99c93fcbdb11a4f2c85aa5b18950b93399b
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
update
更新绘制 @param timestamp 当前时间戳,ms
update(timestamp: number) { this.instance.update(timestamp) this.invalidate() }
AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#...
update(timestamp: number) { this.instance.update(timestamp) this.invalidate() }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L287-L290
6c3eafb44494b0edf98dda89f457ad2df2701488
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets
arkts
构建商品详情底部操作栏 @returns {void} 无返回值
build(): void { Column() { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: { top: $r("app.float.space_vertical_small"), bottom: this.safeAreaEnabled && this.windowSafeAreaState.bottomInset > 0 ? 0 : $r("app.float.space_vertical_small") ...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_el...
build(): void { Column() { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: { top: $r("app.float.space_vertical_small"), bottom: this.safeAreaEnabled && this.windowSafeAreaState.bottomInset > 0 ? 0 : $r("app.float.space_vertical_small") ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets#L58-L118
2eaa852eb92ec03e26862ab3dfd355c4d6de24e1
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
get_current_year
Properties
get_current_year() { return this.current_year; }
AST#method_declaration#Left get_current_year AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_year AST#member_expression#Right AST#exp...
get_current_year() { return this.current_year; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L202-L204
84bed73909945d161a56a6a104d1564cca3e352c
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets
arkts
loadDreams
加载用户的梦想列表
async loadDreams() { this.isLoading = true; try { const dreams: Dream[] = await getDreamsByUserId(this.task.userId); if (dreams && dreams.length > 0) { this.dreams = dreams; // 如果是新任务且未选择梦想,默认选择第一个梦想 if (!this.isEdit && this.task.dreamId === 0 && this.dreams.length >...
AST#method_declaration#Left async loadDreams AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member...
async loadDreams() { this.isLoading = true; try { const dreams: Dream[] = await getDreamsByUserId(this.task.userId); if (dreams && dreams.length > 0) { this.dreams = dreams; if (!this.isEdit && this.task.dreamId === 0 && this.dreams.length > 0) { const fir...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L200-L234
51c5d4560186c0561896967b327db7b5dda8e58b
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesListener.ets
arkts
用户首选项监听器接口。
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesListener.ets#L4-L4
d369f333dcde188b5cd4ad0a3dfa0b954c0669c2
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/LoginSample/entry/src/main/ets/viewmodel/LoginViewMode.ets
arkts
getContactListItems
Get contact information of CustomerServicePage. @return {Array<ListItemData>} contactListItems.
getContactListItems(): Array<ListItemData> { let contactListItems: Array<ListItemData> = []; let serviceHotline = new ListItemData(); serviceHotline.title = $r('app.string.service_hotline'); serviceHotline.summary = $r("app.string.hotline_number"); contactListItems.push(serviceHotline); let emai...
AST#method_declaration#Left getContactListItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right > AST#t...
getContactListItems(): Array<ListItemData> { let contactListItems: Array<ListItemData> = []; let serviceHotline = new ListItemData(); serviceHotline.title = $r('app.string.service_hotline'); serviceHotline.summary = $r("app.string.hotline_number"); contactListItems.push(serviceHotline); let emai...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/viewmodel/LoginViewMode.ets#L28-L39
64a189aa0a048b492d5839c25facd71159e8ef92
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
TODO 设备相关工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class DeviceUtil { private static deviceId: string = ""; //设备ID /** * 获取设备ID(卸载APP后依旧不变),需要权限:ohos.permission.STORE_PERSISTENT_DATA。 * @param rule 是否带- * @param generateId 自己生成的id,不传使用默认生成的id * @returns */ static getDeviceId(rule: boolean = true, generateId?: string): string { let dev...
AST#export_declaration#Left export AST#class_declaration#Left class DeviceUtil AST#class_body#Left { AST#property_declaration#Left private static deviceId : 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...
export class DeviceUtil { private static deviceId: string = ""; static getDeviceId(rule: boolean = true, generateId?: string): string { let deviceId = DeviceUtil.deviceId; if (StrUtil.isEmpty(deviceId)) { if (AssetUtil.canIUse()) { deviceId = StrUtil.toStr(AssetUtil.getSync(DEVICE_ID_KE...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L37-L283
8d88cb6e435f23122095b9f3a7963d445b9c61c7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
通知设置接口(为NotificationSettings别名)
export interface NotificationSettings extends NotificationConfig { // 继承NotificationConfig的所有属性 }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationSettings AST#extends_clause#Left extends NotificationConfig AST#extends_clause#Right AST#object_type#Left { // 继承NotificationConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface NotificationSettings extends NotificationConfig { }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L43-L45
d869725e5388779b4e1020c69aa1b9066dd30a9c
github
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
checkSettingsAndInit
检查数据库是否存在设置 并初始化 ASF 的服务器地址和密码
private async checkSettingsAndInit(): Promise<void> { const isComplete = await this.db.areSettingsComplete(); if (!isComplete) this.showSetupDialog = true; else { await this.loadSettings(); this.initASF(); // Logger.info(this.LOG_TAG, `应用初始化完成, address: ${this...
AST#method_declaration#Left private async checkSettingsAndInit 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 checkSettingsAndInit(): Promise<void> { const isComplete = await this.db.areSettingsComplete(); if (!isComplete) this.showSetupDialog = true; else { await this.loadSettings(); this.initASF(); } }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L191-L199
e8abe5fd27274ad816558c8b3ea5c75123744f0b
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/util/UpdateUtils.ets
arkts
接口调用结果判断 @param err 返回信息 @param return 接口调用结果
export function isSuccessCallback(result: unknown, err: any): boolean { return result && !err; }
AST#export_declaration#Left export AST#function_declaration#Left function isSuccessCallback AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left unknown AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left err : AST#type_annotation#Lef...
export function isSuccessCallback(result: unknown, err: any): boolean { return result && !err; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/UpdateUtils.ets#L79-L81
732add8954ad2d723f8a84a2b5b9f1ed088fae34
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
customDialog
显示自定义弹窗
customDialog(index: number) { if (index == 0) { //自定义一个Tip弹出框 let tipOptions: TipOptions = { autoCancel: true, backCancel: true, title: "提交成功", content: "请假单已成功提交给您的领导啦", levelMode: DialogHelper.isApiSupported(15) ? LevelMode.EMBEDDED : undefined, // level...
AST#method_declaration#Left customDialog 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST...
customDialog(index: number) { if (index == 0) { let tipOptions: TipOptions = { autoCancel: true, backCancel: true, title: "提交成功", content: "请假单已成功提交给您的领导啦", levelMode: DialogHelper.isApiSupported(15) ? LevelMode.EMBEDDED : undefined, immersiveMod...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L897-L947
0cabc86a2b25ede4fcc327a887d06aa67e997da8
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pageconfig/ContentItemData.ets
arkts
addData
添加页面跳转路径
public static addData(): Array<ContentItem> { //Line Charts ContentItemData.itemData.push(new ContentItem("Line Charts")); ContentItemData.itemData.push(new ContentItem("Basic ", "Simple line chart.", "pages/lineCharts/LineChartPage")); ContentItemData.itemData.push(new ContentItem("Multiple ", "Show...
AST#method_declaration#Left public static addData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContentItem AST#primary_type#Right AST#type_annotation#Right > AST#...
public static addData(): Array<ContentItem> { ContentItemData.itemData.push(new ContentItem("Line Charts")); ContentItemData.itemData.push(new ContentItem("Basic ", "Simple line chart.", "pages/lineCharts/LineChartPage")); ContentItemData.itemData.push(new ContentItem("Multiple ", "Show multiple dat...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pageconfig/ContentItemData.ets#L32-L112
1e8e6bde4942f68fb0a44fbeb57ed6d4f2df57c1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
2025年01月05日 14时
export const DATE_FORMAT15: string = "yyyy年MM月dd日";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT15 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy年MM月dd日" AST#expression#Right AST#variable_declarator#Right ; AST#variable...
export const DATE_FORMAT15: string = "yyyy年MM月dd日";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L32-L32
dc7a0c1d0ead127235a3addb87d1d8c079f1bff4
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Language/LanguageManager.ets
arkts
getDefault
返回默认语言(简体)
static getDefault(): AppLanguage { return AppLanguage.Simplified; }
AST#method_declaration#Left static getDefault AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppLanguage AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e...
static getDefault(): AppLanguage { return AppLanguage.Simplified; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Language/LanguageManager.ets#L26-L28
9c8d89c5532eaa4aff6a6b19c0860cebbfd2115a
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/promise_callback/promise_callback_003_T.ets
arkts
Introduction 异步-Promise-catch
export function promise_callback_003_T(taint_src : string) { let p = f(taint_src); p.then((result) => {}).catch((error : string) => { taint.Sink(error); }) }
AST#export_declaration#Left export AST#function_declaration#Left function promise_callback_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function promise_callback_003_T(taint_src : string) { let p = f(taint_src); p.then((result) => {}).catch((error : string) => { taint.Sink(error); }) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/promise_callback/promise_callback_003_T.ets#L6-L11
6cb4f9bfb3509c0ce5a40e8659e14648d0bfa854
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
handleRefresh
处理刷新
handleRefresh() { console.info('========================================'); console.info('ReviewPage: Manual refresh button clicked'); DataStorage.loadCompletedTasks().then(tasks => { AppState.completedTasks = tasks; return DataStorage.loadTasks(); }).then(tasks => { AppState.task...
AST#method_declaration#Left handleRefresh 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 console AST#expression#Right . info AST#member_exp...
handleRefresh() { console.info('========================================'); console.info('ReviewPage: Manual refresh button clicked'); DataStorage.loadCompletedTasks().then(tasks => { AppState.completedTasks = tasks; return DataStorage.loadTasks(); }).then(tasks => { AppState.task...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L412-L425
a81a6b95055544ed8354d9b167bcbb6fdfc9e45f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/animation/ChartAnimator.ets
arkts
animateXY
/** * Animates values along both the X and Y axes, in a linear fashion. * * @param durationMillisX animation duration along the X axis * @param durationMillisY animation duration along the Y axis public animateXY(durationMillisX:number,durationMillisY:number) { animateXY(durationMillisX, durationMillisY, Easing.Linea...
public animateXY(durationMillisX: number, durationMillisY: number): void;
AST#method_declaration#Left public animateXY AST#parameter_list#Left ( AST#parameter#Left durationMillisX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left durationMillisY : AST#type_annotation#Left AST#primary_type#Left num...
public animateXY(durationMillisX: number, durationMillisY: number): void;
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L131-L131
f92d3cc041a3f4e7f7a748659a8cea4af1e8d0c7
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getDetailListData
Get detail list Data. @return {Array<CategoryItemInfo>} listItems
getDetailListData() { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.DETAIL_PAGE_LIST_SIZE; i++) { let itemInfo: ListItemData = new ListItemData(); itemInfo.title = $r('app.string.detail_page_list_title'); itemInfo.summary = $r('app.string.list_item_summary'); ...
AST#method_declaration#Left getDetailListData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left <...
getDetailListData() { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.DETAIL_PAGE_LIST_SIZE; i++) { let itemInfo: ListItemData = new ListItemData(); itemInfo.title = $r('app.string.detail_page_list_title'); itemInfo.summary = $r('app.string.list_item_summary'); ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets#L51-L60
8dfc786b431a3a02b0db5a997d125c6072461248
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
getFlawStatusColor
获取故障状态颜色
getFlawStatusColor(confirmed: boolean): string { return confirmed ? AppConstants.COLORS.SUCCESS : AppConstants.COLORS.WARNING; }
AST#method_declaration#Left getFlawStatusColor AST#parameter_list#Left ( AST#parameter#Left confirmed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
getFlawStatusColor(confirmed: boolean): string { return confirmed ? AppConstants.COLORS.SUCCESS : AppConstants.COLORS.WARNING; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L593-L595
32418ae0be903a32a49ccac9b14d0167d8100dec
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinR.ets
arkts
SpinR
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinR { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinR AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinR { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinR.ets#L26-L316
0c85d19e8f13296c0a1655abdb82bfc1e136eb71
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets
arkts
@file 短信登录页面 ViewModel @author Joker.X
@ObservedV2 export default class SmsLoginViewModel extends BaseViewModel { /** * 更新手机号 * @param {string} value - 手机号 * @returns {void} 无返回值 */ updatePhone(value: string): void { } /** * 更新验证码 * @param {string} value - 验证码 * @returns {void} 无返回值 */ updateVerificationCode(value: string)...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class SmsLoginViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 更新手机号 * @par...
@ObservedV2 export default class SmsLoginViewModel extends BaseViewModel { updatePhone(value: string): void { } updateVerificationCode(value: string): void { } onSendVerificationCode(): void { } login(): void { } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets#L8-L39
f726927895d6c1fa38160c351f1362b966a98a16
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
aboutToDisappear
页面隐藏时的生命周期回调 @returns {void} 无返回值
aboutToDisappear(): void { this.viewModel.aboutToDisappear(); }
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.viewModel.aboutToDisappear(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L81-L83
c76c0fd22c684eb48f49c1f97a965dff605ef5ef
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/highlightguide/Index.ets
arkts
HighLightGuideMainComponent
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 { HighLightGuideMainComponent } from "./src/main/ets/pages/Index";
AST#export_declaration#Left export { HighLightGuideMainComponent } from "./src/main/ets/pages/Index" ; AST#export_declaration#Right
export { HighLightGuideMainComponent } from "./src/main/ets/pages/Index";
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/highlightguide/Index.ets#L15-L15
30fffe26699da8e7d9d7e836fcaa2f7681d1924b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/CommonConstaint.ets
arkts
Common constants for project.
export default class CommonConstants { /** * Minimum finger moving distance. */ static readonly MINIMUM_FINGER_DISTANCE: number = 50; /** * Scale-down in the x direction. */ static readonly X_SCALE_DOWN: number = 0.85; /** * Scale-down in the y direction. */ static readonly Y_SCALE_DOWN:...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Minimum finger moving distance. */ AST#property_declaration#Left static readonly MINIMUM_FINGER_DISTANCE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a...
export default class CommonConstants { static readonly MINIMUM_FINGER_DISTANCE: number = 50; static readonly X_SCALE_DOWN: number = 0.85; static readonly Y_SCALE_DOWN: number = 0.85; static readonly NO_SCALE_DOWN: number = 1; static readonly TITLE_FONT_WEIGHT: number = 700; static rea...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/CommonConstaint.ets#L54-L192
b71d7c2c8e3eb709d51fae5df9df58a82c48758b
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ActionSheetBuilderProxy.ets
arkts
isSeparateBottom
底部取消按钮是否 分离样式,默认true。否则连接 @param isSeparateBottom 默认true-分离 @returns
isSeparateBottom(isSeparateBottom: boolean) { if (!this.builderOptions.style) { this.builderOptions.style = new BottomActionSheetStyle() } this.builderOptions.style.isSeparateBottom = isSeparateBottom return this }
AST#method_declaration#Left isSeparateBottom AST#parameter_list#Left ( AST#parameter#Left isSeparateBottom : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AS...
isSeparateBottom(isSeparateBottom: boolean) { if (!this.builderOptions.style) { this.builderOptions.style = new BottomActionSheetStyle() } this.builderOptions.style.isSeparateBottom = isSeparateBottom return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ActionSheetBuilderProxy.ets#L49-L55
97b5e2d02f680f000b42e74ba525cfdc0b724b36
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets
arkts
readContentFromFile
从文件读取内容
readContentFromFile(fileUri: string): ArrayBuffer { let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let fsStat = fs.lstatSync(fileUri); let buf = new ArrayBuffer(fsStat.size); fs.readSync(file.fd, buf); fs.fsyncSync(file.fd) fs.closeSync(file); return buf }
AST#method_declaration#Left readContentFromFile AST#parameter_list#Left ( AST#parameter#Left fileUri : 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 ArrayBuffer AST#pr...
readContentFromFile(fileUri: string): ArrayBuffer { let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let fsStat = fs.lstatSync(fileUri); let buf = new ArrayBuffer(fsStat.size); fs.readSync(file.fd, buf); fs.fsyncSync(file.fd) fs.closeSync(file); return buf }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L238-L246
3ab77f4f9d74c5bfeaa72ba7cd3e0aacd9e83815
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/CustomShare/ShareComponent/index.ets
arkts
ButtonDialogBuilder
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { ButtonDialogBuilder } from './src/main/ets/pages/Dialog';
AST#export_declaration#Left export { ButtonDialogBuilder } from './src/main/ets/pages/Dialog' ; AST#export_declaration#Right
export { ButtonDialogBuilder } from './src/main/ets/pages/Dialog';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/CustomShare/ShareComponent/index.ets#L16-L16
0fc5032d502486131312978f76ddbe53efeadffe
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/view/SelectFolderDialog.ets
arkts
aboutToAppear
初始化文件夹数据。
public aboutToAppear(): void { PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, []) .then((value: string) => { this.allFolders = JSON.parse(value) as Array<Folder>; }); }
AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp...
public aboutToAppear(): void { PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, []) .then((value: string) => { this.allFolders = JSON.parse(value) as Array<Folder>; }); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/SelectFolderDialog.ets#L43-L48
f770c167512388253c3facf5542a58baa3dd10bc
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
预设主题类型
export enum ThemeType { DEFAULT = 'default', SPRING = 'spring', SUMMER = 'summer', AUTUMN = 'autumn', WINTER = 'winter', BIRTHDAY = 'birthday', ELEGANT = 'elegant', VIBRANT = 'vibrant', MINIMAL = 'minimal', CUSTOM = 'custom' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ThemeType AST#enum_body#Left { AST#enum_member#Left DEFAULT = AST#expression#Left 'default' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SPRING = AST#expression#Left 'spring' AST#expression#Right AST#enum_member#Right , AST#enum_memb...
export enum ThemeType { DEFAULT = 'default', SPRING = 'spring', SUMMER = 'summer', AUTUMN = 'autumn', WINTER = 'winter', BIRTHDAY = 'birthday', ELEGANT = 'elegant', VIBRANT = 'vibrant', MINIMAL = 'minimal', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L23-L34
cfec36cdfafd36ed663e4c02ab86a8ed9a9a8838
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
构造函数,保存上下文与文件名 @param {common.Context} context UIAbility 上下文 @param {string} prefsName 存储文件名(不含后缀)
constructor(context: common.Context, prefsName: string) { this.context = context; this.prefsName = prefsName; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left prefsName : AST#t...
constructor(context: common.Context, prefsName: string) { this.context = context; this.prefsName = prefsName; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L19-L22
6463831233e5ae63c72ba0f7abd90902e5deaf13
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/FocusableDivider.ets
arkts
构建分割线 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100 }) { if (this.withSpacing) { SpaceVerticalLarge(); } Column() .width(P100) .height(this.thickness) .backgroundColor(this.focused ? this.activeColor : this.inactiveColor); } }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { ColumnStart({ widthValue: P100 }) { if (this.withSpacing) { SpaceVerticalLarge(); } Column() .width(P100) .height(this.thickness) .backgroundColor(this.focused ? this.activeColor : this.inactiveColor); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/FocusableDivider.ets#L39-L50
1aae28a7b249ece6c2135e3f1a0c7a37d4516617
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setStartAtZero
This method is deprecated. Use setAxisMinimum(...) / setAxisMaximum(...) instead. @param startAtZero @Deprecated
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) { super.setAxisMinimum(0); } else { super.resetAxisMinimum(); } }
AST#method_declaration#Left public setStartAtZero AST#parameter_list#Left ( AST#parameter#Left startAtZero : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr...
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) { super.setAxisMinimum(0); } else { super.resetAxisMinimum(); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L259-L265
788249582f6d5d090f06e25f9827ee432771a3f3
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
getVideoTime
录制时间定时器 @param millisecond-数据值
getVideoTime(millisecond: number): string { let millisecond2minute = 60000; let millisecond2second = 1000; let minute = Math.floor(millisecond / millisecond2minute); let second = Math.floor((millisecond - minute * millisecond2minute) / millisecond2second); return `${this.fill(minute)} : ${this.fill(...
AST#method_declaration#Left getVideoTime AST#parameter_list#Left ( AST#parameter#Left millisecond : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
getVideoTime(millisecond: number): string { let millisecond2minute = 60000; let millisecond2second = 1000; let minute = Math.floor(millisecond / millisecond2minute); let second = Math.floor((millisecond - minute * millisecond2minute) / millisecond2second); return `${this.fill(minute)} : ${this.fill(...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L49-L55
fe085bf5f85b2d9ecebaad6f731491a240140768
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/model/modelChecker/OperatorChecker.ets
arkts
放大字符的deque
private constructor() { this.operatorQueue = new Deque<Operator>(); // 改为队列 this.enlargeItemQueue = new Deque<string>(); }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . operatorQueu...
private constructor() { this.operatorQueue = new Deque<Operator>(); this.enlargeItemQueue = new Deque<string>(); }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/modelChecker/OperatorChecker.ets#L15-L18
23b4a2a24317a76af59e29c2e6c649d8f17a4bff
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets
arkts
The constant of PickerComponent.
export class GoodsPicker { /** * The line height of GoodsPicker text. */ static readonly LINE_HEIGHT_TEXT_SELECTED: number = 25; /** * The max lines. */ static readonly MAX_LINES: number = 2; /** * The lines height of description text. */ static readonly LINE_HEIGHT_DESCRIPTION: number ...
AST#export_declaration#Left export AST#class_declaration#Left class GoodsPicker AST#class_body#Left { /** * The line height of GoodsPicker text. */ AST#property_declaration#Left static readonly LINE_HEIGHT_TEXT_SELECTED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annota...
export class GoodsPicker { static readonly LINE_HEIGHT_TEXT_SELECTED: number = 25; static readonly MAX_LINES: number = 2; static readonly LINE_HEIGHT_DESCRIPTION: number = 25; static readonly MARGIN_LEFT_DESCRIPTION: number = 15; static readonly LAYOUT_WEIGHT_LEFT: string = '10%'; st...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L218-L254
6559378fbf322eb5608a46cf542e076e41063ade
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/Logger.ets
arkts
构造函数。 @param prefix 标识日志标签的前缀 @param domain 域,表示服务域,范围从 0x0 到 0xFFFFF 的十六进制整数
constructor(prefix: string = 'AlarmClock', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'AlarmClock' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_ann...
constructor(prefix: string = 'AlarmClock', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L14-L17
28f5111267f5937680f4bc7ee283efd6428d69a6
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
create
Create a TextEncoder object. @param { string } [encoding] - The string for encoding format. @returns { TextEncoder } @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
static create(encoding?: string): TextEncoder;
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_list#Right : AST#type_annotation#Left AST#primary_type#Left TextEncoder AST#prima...
static create(encoding?: string): TextEncoder;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1084-L1084
8c3b8fb2578d39febd8f42550f94680bdfb909a5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
@file 购物车本地仓库,封装数据库数据源并提供业务方法。 @author Joker.X
export class CartRepository { /** * 本地数据源实例 */ private dataSource: CartLocalDataSource; /** * 构造函数 * @param {CartLocalDataSource} dataSource 可选的数据源实例 */ constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) { this.dataSource = dataSource; } /** * 添加商品到购物车 * ...
AST#export_declaration#Left export AST#class_declaration#Left class CartRepository AST#class_body#Left { /** * 本地数据源实例 */ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left CartLocalDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaratio...
export class CartRepository { private dataSource: CartLocalDataSource; constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) { this.dataSource = dataSource; } addToCart(cart: Cart): Promise<void> { return this.dataSource.addToCart(cart); } updateCart(cart: Cart)...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L8-L102
f64e67e2b32cc25802b37db513f5c1ff2a88f86f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets
arkts
navigation title
export const ADD_TASK_TITLE: string = '添加任务';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ADD_TASK_TITLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '添加任务' AST#expression#Right AST#variable_declarator#Right ; AST#variable_decla...
export const ADD_TASK_TITLE: string = '添加任务';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L45-L45
3464208df1e7ef9aed85b82533785ee30f8748a8
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
frameworks/text/interface/export/ani/@ohos.graphics.text.ets
arkts
Enumeration of font style of text. @enum { number } @syscap SystemCapability.Graphics.Drawing @since 12
export enum FontStyle { /** * Upright font type. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ NORMAL, /** * Slant font. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ ITALIC, /** * Oblique font. * @syscap SystemCapability....
AST#export_declaration#Left export AST#enum_declaration#Left enum FontStyle AST#enum_body#Left { /** * Upright font type. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#enum_member#Left NORMAL AST#enum_member#Right , /** * Slant font. * @syscap SystemCapability.Graphics.Dra...
export enum FontStyle { NORMAL, ITALIC, OBLIQUE, }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L1123-L1144
7b78a2610f19fa98fdfde6fb2ca52f900a115a63
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
resetInputs
重置输入框内容 @returns {void} 无返回值
private resetInputs(): void { this.titleInput = ""; this.descInput = ""; this.editingId = 0; }
AST#method_declaration#Left private resetInputs 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 AS...
private resetInputs(): void { this.titleInput = ""; this.descInput = ""; this.editingId = 0; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L150-L154
2fb25ce1784528eed7474bdcf511e23f1f0b1399
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/net/RequestUtils.ets
arkts
封装一个静态类的方法出来使用
export class Request { static get<T>(url: string, data?: object): Promise<T> { return requestHttp<T>(url, http.RequestMethod.GET, data) } static post<T>(url: string, data?: object): Promise<T> { return requestHttp<T>(url, http.RequestMethod.POST, data) } static put<T>(url: string, data?: object): Pr...
AST#export_declaration#Left export AST#class_declaration#Left class Request AST#class_body#Left { AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left A...
export class Request { static get<T>(url: string, data?: object): Promise<T> { return requestHttp<T>(url, http.RequestMethod.GET, data) } static post<T>(url: string, data?: object): Promise<T> { return requestHttp<T>(url, http.RequestMethod.POST, data) } static put<T>(url: string, data?: object): Pr...
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/net/RequestUtils.ets#L94-L110
7408cb797094fe1027206acecc85c0d48fd05eda
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
createUpcomingBirthdayReminder
创建即将到来的生日提醒
public async createUpcomingBirthdayReminder(contacts: Contact[], days: number, triggerTime: Date): Promise<boolean> { try { const names = contacts.map(c => c.name).join('、'); const config: ReminderConfig = { id: `upcoming_${days}_${triggerTime.getTime()}`, type: ReminderType.BIRTHDAY_UPC...
AST#method_declaration#Left public async createUpcomingBirthdayReminder AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left da...
public async createUpcomingBirthdayReminder(contacts: Contact[], days: number, triggerTime: Date): Promise<boolean> { try { const names = contacts.map(c => c.name).join('、'); const config: ReminderConfig = { id: `upcoming_${days}_${triggerTime.getTime()}`, type: ReminderType.BIRTHDAY_UPC...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L107-L125
48002a5e7d65da54bc0f3fa1d0b79ea69e69ded5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets
arkts
PullToRefreshNewsComponent
列表ID
@Component export struct PullToRefreshNewsComponent { // 创建用于懒加载的数据对象 @State newsData: NewsDataSource = new NewsDataSource(); // 需绑定列表或宫格组件 private scroller: Scroller = new Scroller(); // 模拟数据列表页 @State newsDataListIndex: number = 1; private refreshConfigurator: PullToRefreshConfigurator = new PullToRefre...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PullToRefreshNewsComponent AST#component_body#Left { // 创建用于懒加载的数据对象 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newsData : AST#type_annotation#Left AST#primary_type#Left NewsDataSourc...
@Component export struct PullToRefreshNewsComponent { @State newsData: NewsDataSource = new NewsDataSource(); private scroller: Scroller = new Scroller(); @State newsDataListIndex: number = 1; private refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator(); @State isPullUp: b...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets#L53-L331
56eca8458bfdf3d9dfdaae7edf2148c63edacf43
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isInt16Array
Check whether the entered value is the int16array type. @param { Object } value - A Int16Array value @returns { boolean } Returns true if the value is a built-in Int16Array instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isInt16Array(value: Object): boolean;
AST#method_declaration#Left isInt16Array 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...
isInt16Array(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1246-L1246
3f126110a35d53198aca1b9d76f0c19fe66d608b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryInfoUtil.ets
arkts
disposeBatterySOC
处理电量 @param soc 电量值
private disposeBatterySOC(soc: number): number { if (soc < 0) { soc = 0 } else if (soc > 100) { soc = 100 } mBatterySOC.set(soc.toString()) return soc }
AST#method_declaration#Left private disposeBatterySOC AST#parameter_list#Left ( AST#parameter#Left soc : 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#prima...
private disposeBatterySOC(soc: number): number { if (soc < 0) { soc = 0 } else if (soc > 100) { soc = 100 } mBatterySOC.set(soc.toString()) return soc }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryInfoUtil.ets#L73-L81
fe450b002f50471380b274378acd971f64f1a4d8
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/Utils/ReminderNotification.ets
arkts
新增 / 修改某一天某个开始时间的所有提醒 - RemindTime.toMinutes() 决定提前多久 - notificationId = 提前的分钟数 - reminderId 只用于 cancelReminder,来自 publishReminder 的返回值
export async function updateScheduleReminders( year: number, month: number, day: number, beginHour: number, beginMinute: number, title : string, remindTimeArray: Array<RemindTime> ): Promise<void> { const beginDate = new Date(year, month - 1, day, beginHour, beginMinute, 0, 0); const now = new Date();...
AST#export_declaration#Left export AST#function_declaration#Left async function updateScheduleReminders AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_ann...
export async function updateScheduleReminders( year: number, month: number, day: number, beginHour: number, beginMinute: number, title : string, remindTimeArray: Array<RemindTime> ): Promise<void> { const beginDate = new Date(year, month - 1, day, beginHour, beginMinute, 0, 0); const now = new Date();...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/Utils/ReminderNotification.ets#L17-L115
bc6c3d0f8401e8e619af3352bf6c0e5c91bebd1c
github
dou101101/ZenFocus-HarmonyOS.git
9364599b8b20bc6377fc55ac68b991b61ceb8496
MyApplication/entry/src/main/ets/pages/Index.ets
arkts
selectTask
=== 任务与计时逻辑 ===
async selectTask(index: number) { if (this.isRunning) return; this.currentTaskIndex = index; this.totalSeconds = Math.floor(this.tasks[index].duration * 60); this.remainingSeconds = this.totalSeconds; this.progress = 0; // 注意:Progress 从 0 开始增加到 1 // 初始化背景色 this.currentColor = this.tasks[ind...
AST#method_declaration#Left async selectTask 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if (...
async selectTask(index: number) { if (this.isRunning) return; this.currentTaskIndex = index; this.totalSeconds = Math.floor(this.tasks[index].duration * 60); this.remainingSeconds = this.totalSeconds; this.progress = 0; this.currentColor = this.tasks[index].startColor; const url = th...
https://github.com/dou101101/ZenFocus-HarmonyOS.git/blob/9364599b8b20bc6377fc55ac68b991b61ceb8496/MyApplication/entry/src/main/ets/pages/Index.ets#L266-L282
d1afedc7354e03d1e482b51a0b39e2d88eaba825
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/Detail/dialog/CommonDialog.ets
arkts
actionBtnStyle
扩展 Button 样式
@Extend(Button) function actionBtnStyle() { .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_button_font_size'))) .height(DimensionUtil.getVp($r('app.float.common_dialog_button_height'))) .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) .fontColor($r('app.color.green_light')) .backgroundColor($r(...
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Button AST#expression#Right ) AST#decorator#Right function actionBtnStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST...
@Extend(Button) function actionBtnStyle() { .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_button_font_size'))) .height(DimensionUtil.getVp($r('app.float.common_dialog_button_height'))) .layoutWeight(CommonConstants.DEFAULT_LAYOUT_WEIGHT) .fontColor($r('app.color.green_light')) .backgroundColor($r(...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/CommonDialog.ets#L61-L67
8713b39503df808c8bbe1614207d77c496a5ed0f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressListPage.ets
arkts
AddressListItem
渲染地址列表项 @param {Address} item - 地址数据 @returns {void} 无返回值
@Builder private AddressListItem(item: Address): void { AddressCard({ address: item, onTap: (): void => this.vm.onAddressClick(item), actionSlot: (): void => this.AddressActionSlot(item) }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AddressListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
@Builder private AddressListItem(item: Address): void { AddressCard({ address: item, onTap: (): void => this.vm.onAddressClick(item), actionSlot: (): void => this.AddressActionSlot(item) }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressListPage.ets#L111-L118
e01c18f5d78468a91068a818c1547b100d6fb610
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/AcademyManager.ets
arkts
getLearningProgress
获取学习进度
getLearningProgress(): LearningProgress[] { return Array.from(this.learningProgress.values()); }
AST#method_declaration#Left getLearningProgress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LearningProgress [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_st...
getLearningProgress(): LearningProgress[] { return Array.from(this.learningProgress.values()); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L254-L256
b60e70faf0ac2c47a827eb2100b88f5762669acc
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/basic_expression_operation/binary_expression_add_002_F.ets
arkts
Introduction 基础表达式运算-二元运算-加
export function binary_expression_add_002_F(taint_src : string) { let _t = taint_src; let clean = "a" + "b"; taint.Sink(clean); }
AST#export_declaration#Left export AST#function_declaration#Left function binary_expression_add_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_s...
export function binary_expression_add_002_F(taint_src : string) { let _t = taint_src; let clean = "a" + "b"; taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/basic_expression_operation/binary_expression_add_002_F.ets#L6-L10
d1a9f33ba91e8b0ba90ae182aca9c2808a7c6e9f
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
getAxisMinLabels
The minumum number of labels on the axis
public getAxisMinLabels(): number { return this.mAxisMinLabels; }
AST#method_declaration#Left public getAxisMinLabels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
public getAxisMinLabels(): number { return this.mAxisMinLabels; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L161-L163
3d01edf4f054ab850961ba53878dc0e0bbfcbe72
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets
arkts
TopTitle
地图顶部标题栏
@Component export struct TopTitle { @Link isShow: boolean; // 是否显示顶部 @State statusBarHeight: number = 0; // 状态栏高度 private windowModel: WindowModel = WindowModel.getInstance(); // 窗口管理model aboutToAppear(): void { // 获取顶部导航栏高度 this.windowModel.getStatusBarHeight((statusBarHeight) => { this.statusB...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopTitle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation...
@Component export struct TopTitle { @Link isShow: boolean; @State statusBarHeight: number = 0; private windowModel: WindowModel = WindowModel.getInstance(); aboutToAppear(): void { this.windowModel.getStatusBarHeight((statusBarHeight) => { this.statusBarHeight = px2vp(statusBarHeight); })...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets#L20-L78
38b6cb84345228a7be1eec7b5c4e3f2b7ee3f158
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/ContentView.ets
arkts
dotMenu
设置菜单
@Builder dotMenu() { Menu() { MenuItem({ symbolStartIcon: this.MenuIconModifierSetting, content: $r('app.string.settings_text') }) .onClick(() => { // 开启菜单项触感反馈 if (this.appGeneralData.isHapticMenu) { StartVibrator() } this.isToolViewShow = true; ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dotMenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#Le...
@Builder dotMenu() { Menu() { MenuItem({ symbolStartIcon: this.MenuIconModifierSetting, content: $r('app.string.settings_text') }) .onClick(() => { if (this.appGeneralData.isHapticMenu) { StartVibrator() } this.isToolViewShow = true; }) ...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L225-L237
46ec480936f04a130cf7d626ad6ef96fb758c8da
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
setWindowBackgroundColor
设置窗口的背景色。该方法已过时,推荐使用:WindowUtil.setWindowBackgroundColor()
static setWindowBackgroundColor(color: string, windowClass: window.Window = AppUtil.getMainWindow()) { WindowUtil.setWindowBackgroundColor(color, windowClass); }
AST#method_declaration#Left static setWindowBackgroundColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AS...
static setWindowBackgroundColor(color: string, windowClass: window.Window = AppUtil.getMainWindow()) { WindowUtil.setWindowBackgroundColor(color, windowClass); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L606-L608
0dd20958dac69decb0517baf052f703bcc482b77
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
showDialog
多个按钮的AlertDialog(AlertDialogParamWithOptions) @param options
static showDialog(options: OptionDialogOptions) { DialogUtil.initDialogDefault(options); DialogUtil.initDialogButton(options); AlertDialog.show(options as AlertDialogParamWithOptions); }
AST#method_declaration#Left static showDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left OptionDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statemen...
static showDialog(options: OptionDialogOptions) { DialogUtil.initDialogDefault(options); DialogUtil.initDialogButton(options); AlertDialog.show(options as AlertDialogParamWithOptions); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L75-L79
b1eef9a1979566f0850132985313328a6763d0eb
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
AchievementView
成就视图
@Builder AchievementView() { Scroll() { Column({ space: 16 }) { // 工具栏 ReviewToolbar( (): void => this.handleRefresh(), (): void => this.handleAddTestTask() ) // 核心统计卡片 - 直接内联以确保 @State 变量更新时 UI 能刷新 Column() { Row() { Column(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AchievementView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_...
@Builder AchievementView() { Scroll() { Column({ space: 16 }) { ReviewToolbar( (): void => this.handleRefresh(), (): void => this.handleAddTestTask() ) Column() { Row() { Column({ space: 8 }) { Text('累计专注时长') ...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L143-L409
7e93ae6bef40277218cbfb3e68bf9ae4388ed2b4
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/DataTypeUtils.ets
arkts
数据类型工具类。
export default class DataTypeUtils { /** * 判断对象是否为 null。 * * @param obj 要检查的对象 * @return 是否为 null 的布尔值 */ static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); } /** * 从对象 obj 创建一个深拷贝的新对象。 * * @param obj 要深拷贝的对象 * @return 与 obj 类型...
AST#export_declaration#Left export default AST#class_declaration#Left class DataTypeUtils AST#class_body#Left { /** * 判断对象是否为 null。 * * @param obj 要检查的对象 * @return 是否为 null 的布尔值 */ AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#pr...
export default class DataTypeUtils { static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); } static deepCopy(obj: number[]) { let newObj: number[] = []; for (let i = 0; i < obj.length; i++) { newObj[i] = JSON.parse(JSON.stringify(obj[i]));...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/DataTypeUtils.ets#L4-L25
c4494e2fb4d3be1165f621ce5db9fd9cd0494e2b
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PickerUtils.ets
arkts
selectDocument
通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。 @param options @returns
static async selectDocument(options?: DocumentSelectOptions): Promise<Array<string>> { try { if (!options) { options = new DocumentSelectOptions(); } if (!options.maxSelectNumber) { //选择媒体文件数量的最大值,默认9 options.maxSelectNumber = PHOTO_DEFAULT_SELECT_NUMBER; } if (!options...
AST#method_declaration#Left static async selectDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left DocumentSelectOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
static async selectDocument(options?: DocumentSelectOptions): Promise<Array<string>> { try { if (!options) { options = new DocumentSelectOptions(); } if (!options.maxSelectNumber) { options.maxSelectNumber = PHOTO_DEFAULT_SELECT_NUMBER; } if (!options.selectMode) { ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L140-L164
37c6386e58218941a90980bc0f6cf39eef920fdd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets
arkts
RegisterDeviceListCallback
发现设备列表
function RegisterDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { let discoveredDeviceSize = remoteDeviceModel.discoverList.length; let deviceSize = remoteDeviceModel.deviceList.length; localDeviceId = remoteDeviceModel.localDeviceId; discovereDeviceIdList.length = 0; f...
AST#function_declaration#Left function RegisterDeviceListCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left remoteDeviceM...
function RegisterDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { let discoveredDeviceSize = remoteDeviceModel.discoverList.length; let deviceSize = remoteDeviceModel.deviceList.length; localDeviceId = remoteDeviceModel.localDeviceId; discovereDeviceIdList.length = 0; f...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L31-L58
f61d2aaf9cef30316b5402ff466f2a654faabda0
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/common.d.ets
arkts
Defines the WrappedBuilder class. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines the WrappedBuilder class. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare class WrappedBuilder<Args extends Array<Object>> { /** * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 *...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class WrappedBuilder AST#type_parameters#Left < AST#type_parameter#Left Args extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#prim...
export declare class WrappedBuilder<Args extends Array<Object>> { builder: (args: Args) => void; constructor(builder: (args: Args) => void); }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/common.d.ets#L1584-L1614
ed8a4ba2d2028852f8d7a0764a79dfd41e2b9f8a
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/AlarmClockPage.ets
arkts
AlarmClockPage
闹钟页面。
@Component export default struct AlarmClockPage { // 用于定时刷新最近的闹钟时间的定时器ID private intervalId: number = CommonConstants.DEFAULT_NUMBER_NEGATIVE; // 闹钟模型,用于管理和查询闹钟数据 private alarmClockModel: AlarmClockViewModel = AlarmClockViewModel.instant; // 存储闹钟列表数据的状态 @State alarmItems: Array<AlarmItem> = new Array(); ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct AlarmClockPage AST#ERROR#Left { // 用于定时刷新最近的闹钟时间的定时器ID AST#property_declaration#Left private intervalId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ...
@Component export default struct AlarmClockPage { private intervalId: number = CommonConstants.DEFAULT_NUMBER_NEGATIVE; private alarmClockModel: AlarmClockViewModel = AlarmClockViewModel.instant; @State alarmItems: Array<AlarmItem> = new Array(); @State nearestAlarmTime: { days: number, h...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/AlarmClockPage.ets#L16-L100
5ba8d64a9e33a26d2eedda6beb4031d4ca04f93c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
cleanExpiredSuggestions
清理过期建议
private cleanExpiredSuggestions(): void { const now = new Date().getTime(); this.smartSuggestions = this.smartSuggestions.filter(suggestion => { return new Date(suggestion.expiresAt).getTime() > now; }); }
AST#method_declaration#Left private cleanExpiredSuggestions 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_declarato...
private cleanExpiredSuggestions(): void { const now = new Date().getTime(); this.smartSuggestions = this.smartSuggestions.filter(suggestion => { return new Date(suggestion.expiresAt).getTime() > now; }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L536-L541
e991a7a0f1e23f0f6abd6807c8bd3bfefb325aab
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
initPositionInfos
initPositionInfos @param appInfos
initPositionInfos(appInfos: Array<AppItemInfo>) { if (CheckEmptyUtils.isEmptyArr(appInfos)) { return []; } Logger.info(TAG, `initPositionInfos, appInfos size = ${appInfos.length}`); let countsOnePage = CommonConstants.DEFAULT_COLUMN_COUNT * CommonConstants.DEFAULT_ROW_COUNT; let result: Array<...
AST#method_declaration#Left initPositionInfos AST#parameter_list#Left ( AST#parameter#Left appInfos : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AppItemInfo AST#primary_type#Right AST#type_annotation#Right > AST#typ...
initPositionInfos(appInfos: Array<AppItemInfo>) { if (CheckEmptyUtils.isEmptyArr(appInfos)) { return []; } Logger.info(TAG, `initPositionInfos, appInfos size = ${appInfos.length}`); let countsOnePage = CommonConstants.DEFAULT_COLUMN_COUNT * CommonConstants.DEFAULT_ROW_COUNT; let result: Array<...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L377-L408
e7d5c5e56fa693bf51b66be789605ad266574123
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
拉起应用的通知设置界面,该页面以半模态形式呈现,可用于设置通知开关、通知提醒方式等。使用Promise异步回调。 @param context @returns {Promise<void>} void
export async function openSettings(): Promise<void> { return await notificationManager.openNotificationSettings(ContextUtil.getUIAbilityCtx()); }
AST#export_declaration#Left export AST#function_declaration#Left async function openSettings 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#...
export async function openSettings(): Promise<void> { return await notificationManager.openNotificationSettings(ContextUtil.getUIAbilityCtx()); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L39-L41
5648c1cdc5203920f0a37498aeedd71f53809244
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
getLabelXOffset
获取标签在 X 轴上的偏移量 @returns 偏移量
public getLabelXOffset(): number { return this.mLabelXOffset; }
AST#method_declaration#Left public getLabelXOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e...
public getLabelXOffset(): number { return this.mLabelXOffset; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L163-L165
33817b3be7d35651d772db9847d3882b249f721e
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/entryability/WindowAbility.ets
arkts
initAvoidArea
Initialize avoid area parameters @param - mainWindow windows @returns void
async initAvoidArea(mainWindow: window.Window): Promise<void> { hilog.info(0x0000, TAG, 'initAvoidArea start'); // Initialize default values AppStorage.setOrCreate<number>('statusBarHeight', 36); AppStorage.setOrCreate<number>('navigationAiBarHeight', 28); const defaultDisplay = display.getDefaultDi...
AST#method_declaration#Left async initAvoidArea AST#parameter_list#Left ( AST#parameter#Left mainWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
async initAvoidArea(mainWindow: window.Window): Promise<void> { hilog.info(0x0000, TAG, 'initAvoidArea start'); AppStorage.setOrCreate<number>('statusBarHeight', 36); AppStorage.setOrCreate<number>('navigationAiBarHeight', 28); const defaultDisplay = display.getDefaultDisplaySync(); let scaledD...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/entryability/WindowAbility.ets#L55-L91
1ba0721e31d58ce9ccc52d5bf75bc06822eff9e5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
preparePartsAndUnits
构建分类和单元的数据结构
private preparePartsAndUnits(): void { this.parts = []; this.units = []; // 使用Map来快速查找和分组,避免重复遍历 const unitMap = new Map<number, Unit>(); const partMap = new Map<number, Part>(); // 先按unitId和partId分组 for (let i = 0; i < this.allWords.length; i++) { const word = this.allWords[i]; ...
AST#method_declaration#Left private preparePartsAndUnits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignm...
private preparePartsAndUnits(): void { this.parts = []; this.units = []; const unitMap = new Map<number, Unit>(); const partMap = new Map<number, Part>(); for (let i = 0; i < this.allWords.length; i++) { const word = this.allWords[i]; const unitId = word.unitId || 0; co...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L188-L249
558cbe1ad772ec67439418f39f281795e6759c0f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
setWebLineWidthInner
Sets the width of the web lines that are in between the lines coming from the center. @param width
public setWebLineWidthInner(width: number): void { this.mInnerWebLineWidth = Utils.handleDataValues(width); }
AST#method_declaration#Left public setWebLineWidthInner 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#pri...
public setWebLineWidthInner(width: number): void { this.mInnerWebLineWidth = Utils.handleDataValues(width); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L247-L249
30c8ac5ed15f0fdbf21325b5ab4958e228f4369e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.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 WaterFlowDataSource implements IDataSource { private dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i = 0; i < 40; i++) { this.dataArray.push(i); } } // Obtain the data corresponding to the index public getData(index: number): nu...
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#...
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i = 0; i < 40; i++) { this.dataArray.push(i); } } public getData(index: number): number { return this.dataArray[index]; } ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L16-L141
ab2d838e8b22aab6c76dcfd570704c6390beedf3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets
arkts
getPixelFromResource
从Resource获取pixelMap· @param context 上下文 @param res 资源 @returns PixelMap
async function getPixelFromResource(context: Context, res: Resource): Promise<image.PixelMap | null> { try { let tempArray: Uint8Array = context.resourceManager.getMediaContentSync(res.id); let imageSource: image.ImageSource = image.createImageSource(tempArray.buffer); console.debug("从Resource获取pixelMap成功...
AST#function_declaration#Left async function getPixelFromResource AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left R...
async function getPixelFromResource(context: Context, res: Resource): Promise<image.PixelMap | null> { try { let tempArray: Uint8Array = context.resourceManager.getMediaContentSync(res.id); let imageSource: image.ImageSource = image.createImageSource(tempArray.buffer); console.debug("从Resource获取pixelMap成功...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L221-L234
242fb2692a6ee5b152c94c0441b37266e687b4a3
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/Index.ets
arkts
SwipeConfig
导出类型定义
export type { SwipeConfig, SwipeEventHandler, OnCardSwipedCallback, OnCardClickedCallback, OnStackNearEmptyCallback, OnStackEmptyCallback, OnLoadNextPageCallback, AnimationParams, GestureState } from './src/main/ets/types/SwipeCardTypes';
AST#export_declaration#Left export AST#ERROR#Left type AST#ERROR#Right { SwipeConfig , SwipeEventHandler , OnCardSwipedCallback , OnCardClickedCallback , OnStackNearEmptyCallback , OnStackEmptyCallback , OnLoadNextPageCallback , AnimationParams , GestureState } from './src/main/ets/types/SwipeCardTypes' ; AST#export_de...
export type { SwipeConfig, SwipeEventHandler, OnCardSwipedCallback, OnCardClickedCallback, OnStackNearEmptyCallback, OnStackEmptyCallback, OnLoadNextPageCallback, AnimationParams, GestureState } from './src/main/ets/types/SwipeCardTypes';
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/Index.ets#L15-L25
6f420f47489346f0c7e07900d66d3cebec9bae77
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleDelete.ets
arkts
应用约束61: 使用export default代替module.exports
export default GuildRoleDeleteHandler;
AST#export_declaration#Left export default AST#expression#Left GuildRoleDeleteHandler AST#expression#Right ; AST#export_declaration#Right
export default GuildRoleDeleteHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleDelete.ets#L15-L15
9f821de2c9804536273ce0859f7333a6f3f8252e
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/param/shared/utils/ComponentAttrUtils.ets
arkts
getRectInfoById
获取组件id对应的位置信息
public static getRectInfoById(context: UIContext, id: string): RectInfoInPx { if (!context || !id) { throw CustomExceptions.EMPTY_OBJECT_EXCEPTION; } let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id); hilog.info(0x0000, 'ComponentAttrUtils', 'the v...
AST#method_declaration#Left public static getRectInfoById AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string A...
public static getRectInfoById(context: UIContext, id: string): RectInfoInPx { if (!context || !id) { throw CustomExceptions.EMPTY_OBJECT_EXCEPTION; } let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id); hilog.info(0x0000, 'ComponentAttrUtils', 'the v...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/shared/utils/ComponentAttrUtils.ets#L27-L57
657ea5bbfb8e79166c0b54c3a32b9ccd45e448b7
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusEngineList.ets
arkts
fetch
应用约束10:使用具体类型代替any
function fetch(Encoder: new (options: Object) => Object, engineOptions: Object): Object | null { try { return new Encoder(engineOptions); } catch (err) { // 应用约束40:catch参数不标注类型 const error = err as Error; if (error.message.includes('Cannot find module')) { return null...
AST#function_declaration#Left function fetch AST#parameter_list#Left ( AST#parameter#Left Encoder : AST#ERROR#Left new AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#t...
function fetch(Encoder: new (options: Object) => Object, engineOptions: Object): Object | null { try { return new Encoder(engineOptions); } catch (err) { const error = err as Error; if (error.message.includes('Cannot find module')) { return null; } th...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusEngineList.ets#L12-L23
cb996c4484dd77a4491eceb3766e2a7623cc3348
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Sub.ets
arkts
clickBack
返回
clickBack(): void { const routerState = router.getState(); if(routerState.index > 1){ router.back(); }else{ router.replaceUrl({ url: 'pages/Index' }) } }
AST#method_declaration#Left clickBack 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 routerState = A...
clickBack(): void { const routerState = router.getState(); if(routerState.index > 1){ router.back(); }else{ router.replaceUrl({ url: 'pages/Index' }) } }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Sub.ets#L24-L33
afc60910344af9b9cdc8287952868b273d1eb359
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/itemview/ShortCutSelectItem.ets
arkts
ShortCutSelectItem
快捷方式的选择Item组件
@ComponentV2 export struct ShortCutSelectItem { @Require @Param itemData: SelectShortCutItemEntity @Event changeIsSelect: (val: boolean) => void; // @Local selectStatus: boolean = false build() { RelativeContainer() { Text(this.itemData.cardBean.name) .fontSize(30) .fontColor('#ffffff'...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ShortCutSelectItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right itemData : AST#type_annotation#Left AST#prim...
@ComponentV2 export struct ShortCutSelectItem { @Require @Param itemData: SelectShortCutItemEntity @Event changeIsSelect: (val: boolean) => void; build() { RelativeContainer() { Text(this.itemData.cardBean.name) .fontSize(30) .fontColor('#ffffff') .margin({ left: 15, top: 15 }...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ShortCutSelectItem.ets#L6-L47
1bd0210375314172a90ce8b3489235d3628ef08f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/view/WebPage.ets
arkts
构建网页页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "网页", viewModel: this.vm }) { this.WebContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "网页" AST#expression#Right AST#component_parameter#Right , AST#component_pa...
build() { AppNavDestination({ title: "网页", viewModel: this.vm }) { this.WebContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/WebPage.ets#L20-L27
17b73f5a0961c6ab1cd0ad01de81e0dcd60a2140
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/MoodInsightPage.ets
arkts
onPageShow
页面每次显示时刷新数据(从其他页面返回时)
onPageShow(): void { console.info('[MoodInsightPage] 页面显示,刷新数据'); this.loadMoodData(); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le...
onPageShow(): void { console.info('[MoodInsightPage] 页面显示,刷新数据'); this.loadMoodData(); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/MoodInsightPage.ets#L57-L60
a8b8390df971ab9f0ce21f534cc198bdf35d883b
github
huazheleyoushang/harmony_template.git
9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
Binds data to components and provides interfaces.
export class MainViewModel { /** * Get swiper image data. * * @return {Array<Resource>} swiperImages. */ getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4') ]; re...
AST#export_declaration#Left export AST#class_declaration#Left class MainViewModel AST#class_body#Left { /** * Get swiper image data. * * @return {Array<Resource>} swiperImages. */ AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#...
export class MainViewModel { getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.fig1'), $r('app.media.fig2'), $r('app.media.fig3'), $r('app.media.fig4') ]; return swiperImages; } getFirstGridData(): Array<ItemData> { let firstGridDat...
https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/viewmodel/MainViewModel.ets#L21-L90
6f5f26d8b9d2a36470b9d17e499cd77553ad81f6
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets
arkts
MARK: - Plan Learn / 该结构体表示一个学习记录(Learn),记录了某个Piece的学习情况
export class DBLearn { planId : number | null = null; // 计划ID bookId : number | null = null; // 书籍ID num : number | null = null; // 学习次数 distance : number | null = null; // 学习的距离 pieceNo : number | null = null; // 学习的Piece编号 wordId : number | null = null; // 学习的文本的wordId lear...
AST#export_declaration#Left export AST#class_declaration#Left class DBLearn AST#class_body#Left { 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#type_anno...
export class DBLearn { planId : number | null = null; bookId : number | null = null; num : number | null = null; distance : number | null = null; pieceNo : number | null = null; wordId : number | null = null; learnDate : Date | null = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets#L32-L40
43df8e2084ab1b05a15b027388a051991ff1d17b
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setDrawTopYLabelEntry
set this to true to enable drawing the top y-label entry. Disabling this can be helpful when the top y-label and left x-label interfere with each other. default: true @param enabled
public setDrawTopYLabelEntry(enabled: boolean): void { this.mDrawTopYLabelEntry = enabled; }
AST#method_declaration#Left public setDrawTopYLabelEntry AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST...
public setDrawTopYLabelEntry(enabled: boolean): void { this.mDrawTopYLabelEntry = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L292-L294
e8fcb3d13a31357b7e8a4db3142c3dab98707946
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets
arkts
isSandboxFunc
是否为沙箱应用
async isSandboxFunc(): Promise<void> { try { this.inSandbox = await dlpPermission.isInSandbox(); Logger.info(TAG, 'inSandbox:' + this.inSandbox); promptAction.showToast({ message: 'isSandbox:' + this.inSandbox, duration: 2000 }); } catch (err) { Logger.error(TAG, 'error' + (err as Busine...
AST#method_declaration#Left async isSandboxFunc AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async isSandboxFunc(): Promise<void> { try { this.inSandbox = await dlpPermission.isInSandbox(); Logger.info(TAG, 'inSandbox:' + this.inSandbox); promptAction.showToast({ message: 'isSandbox:' + this.inSandbox, duration: 2000 }); } catch (err) { Logger.error(TAG, 'error' + (err as Busine...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L80-L88
377ce9f71cf73e169b26bdcb51301c2118974137
gitee
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/constants/BreakpointConstants.ets
arkts
Constants for breakpoint.
export class BreakpointConstants { /** * Breakpoints that represent small device types. */ static readonly BREAKPOINT_SM: string = 'sm'; /** * Breakpoints that represent middle device types. */ static readonly BREAKPOINT_MD: string = 'md'; /** * Breakpoints that represent large device types. ...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /** * Breakpoints that represent small device types. */ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
export class BreakpointConstants { static readonly BREAKPOINT_SM: string = 'sm'; static readonly BREAKPOINT_MD: string = 'md'; static readonly BREAKPOINT_LG: string = 'lg'; static readonly CURRENT_BREAKPOINT: string = 'currentBreakpoint'; static readonly RANGE_SM: string = '(320vp<=width<52...
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/constants/BreakpointConstants.ets#L5-L40
e47844d0887cdb6dd2de3b633145de82a884b5e1
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets
arkts
testFetchMetadataFromDataSrc
在以下demo中,使用fs文件系统打开沙箱地址获取媒体文件地址,设置dataSrc属性,获取音频元数据并打印。 获取音频专辑封面并通过Image控件显示在屏幕上。
async testFetchMetadataFromDataSrc() { if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) { try { // 通过UIAbilityContext获取沙箱地址filesDir(以Stage模型为例)。 let fd: number = fs.openSync(this.rootPath + this.testFilename).fd; let fileSize: number = fs.statSync(this.rootPath + t...
AST#method_declaration#Left async testFetchMetadataFromDataSrc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expressi...
async testFetchMetadataFromDataSrc() { if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) { try { let fd: number = fs.openSync(this.rootPath + this.testFilename).fd; let fileSize: number = fs.statSync(this.rootPath + this.testFilename).size; let dat...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets#L169-L215
de825f27a7defb32cd65a27f97e0e1049e093aee
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/userModel.ets
arkts
saveUsers
保存当前 userData 数组到 Preferences
async saveUsers() { try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(this.userData)); await preference.flush(); // 将数据写入存储 Logger.info(`userdata have ${this.userData.length} users.Save succesfully.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to save u...
AST#method_declaration#Left async saveUsers AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#membe...
async saveUsers() { try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(this.userData)); await preference.flush(); Logger.info(`userdata have ${this.userData.length} users.Save succesfully.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to save users, Caus...
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L59-L67
7693159375488dcc72b89f6db68236150e3450a1
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setMaxWidth
Sets the maximum width that the axis can take (in dp). @param maxWidth
public setMaxWidth(maxWidth: number): void { this.mMaxWidth = maxWidth; }
AST#method_declaration#Left public setMaxWidth AST#parameter_list#Left ( AST#parameter#Left maxWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
public setMaxWidth(maxWidth: number): void { this.mMaxWidth = maxWidth; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L167-L169
61a86d4d5c7d44ac5be5a85dba066586e682d421
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getDownloadUri
获取当前应用的Download Uri @param relativePath 文件路径;相对路径(wps/doc);relativePath传空字符串表示根目录 @param fileName 不传或传空 返回当前应用的Download文件夹Uri
static getDownloadUri(relativePath: string | undefined = undefined, fileName?: string) { const downloadPath = FileUtil.getDownloadPath(relativePath, fileName); //'file://docs/storage/Users/currentUser/Download/' + bundleName let downloadUri = FileUtil.getUriFromPath(downloadPath); return downloadUri; ...
AST#method_declaration#Left static getDownloadUri AST#parameter_list#Left ( AST#parameter#Left relativePath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#exp...
static getDownloadUri(relativePath: string | undefined = undefined, fileName?: string) { const downloadPath = FileUtil.getDownloadPath(relativePath, fileName); let downloadUri = FileUtil.getUriFromPath(downloadPath); return downloadUri; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L119-L124
ed246f25a4c23be8983524b7046ce03ed4bebbef
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
createARCard
创建AR生日卡片
async createARCard( contact: Contact, cardType: ARCardType, personalMessage: string, customConfig?: Partial<ARSceneConfig> ): Promise<ARCardData> { try { if (!this.renderState.isInitialized) { throw new Error('AR service not initialized'); } const cardId = `ar_card_${c...
AST#method_declaration#Left async createARCard AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cardType : AST#type_annotation#Left AST#primary_type#Left ARCardType AST#...
async createARCard( contact: Contact, cardType: ARCardType, personalMessage: string, customConfig?: Partial<ARSceneConfig> ): Promise<ARCardData> { try { if (!this.renderState.isInitialized) { throw new Error('AR service not initialized'); } const cardId = `ar_card_${c...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L351-L406
67a10f41b1a6dc83b9f0da99cf3c6af7f9794355
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/SHA256.ets
arkts
rightRotate
右循环移位
private static rightRotate(n: number, rotate: number): number { return (n >>> rotate) | (n << (32 - rotate)); }
AST#method_declaration#Left private static rightRotate AST#parameter_list#Left ( AST#parameter#Left n : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rotate : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
private static rightRotate(n: number, rotate: number): number { return (n >>> rotate) | (n << (32 - rotate)); }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/SHA256.ets#L21-L23
91e4990e82015e2ed333ea0ab0666a7f3ee122dc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets
arkts
模拟服务端进行RSA密钥生成、解密、签名
export class LocalMockServer { private publicKey: string = ""; private privateKey: string = ""; private messageStorage: string[] = []; private aesKey: string = ""; //生成证书 async createKey() { sendProcessMessage("模拟服务端开始生成证书", MessagePosition.Left); let rsaKey: RsaKey | undefined = await generateRsaK...
AST#export_declaration#Left export AST#class_declaration#Left class LocalMockServer AST#class_body#Left { AST#property_declaration#Left private publicKey : 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_...
export class LocalMockServer { private publicKey: string = ""; private privateKey: string = ""; private messageStorage: string[] = []; private aesKey: string = ""; async createKey() { sendProcessMessage("模拟服务端开始生成证书", MessagePosition.Left); let rsaKey: RsaKey | undefined = await generateRsaKey() ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets#L32-L92
6c69eb92752fcb9fa8cb12bf2395ee2e2f5679c5
gitee
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/dust/DustMonitorCard.ets
arkts
getStatusColor
辅助函数:根据状态返回颜色
private getStatusColor(status: DustStatus): string { if (status === DustStatus.WARNING) return '#FAAD14'; // 黄色警告 return '#52C41A'; // 绿色正常 }
AST#method_declaration#Left private getStatusColor AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left DustStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#p...
private getStatusColor(status: DustStatus): string { if (status === DustStatus.WARNING) return '#FAAD14'; return '#52C41A'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L135-L138
e16ff38e5c48801f1419d80379bea6dc272ce255
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
assign
合并多个对象到目标对象 @param target 目标对象(合并结果将修改此对象) @param source 待合并的源对象(可多个) @returns
static assign(target: Object, ...source: Object[]): Object { for (const items of source) { for (const key of Object.keys(items)) { Reflect.set(target, key, Reflect.get(items, key)); } } return target; }
AST#method_declaration#Left static assign AST#parameter_list#Left ( AST#parameter#Left target : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... source : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ...
static assign(target: Object, ...source: Object[]): Object { for (const items of source) { for (const key of Object.keys(items)) { Reflect.set(target, key, Reflect.get(items, key)); } } return target; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L127-L134
4b38e01fe3a8109d48a52dc11b5b9fa78f2f19c3
gitee